@remixhq/core 0.1.13 → 0.1.14
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/api.d.ts +76 -1
- package/dist/api.js +1 -1
- package/dist/auth.js +1 -1
- package/dist/binding-WiIRI2fl.d.ts +43 -0
- package/dist/binding.d.ts +1 -21
- package/dist/binding.js +2 -0
- package/dist/chunk-P6JHXOV4.js +236 -0
- package/dist/chunk-US5SM7ZC.js +433 -0
- package/dist/collab.d.ts +376 -611
- package/dist/collab.js +2382 -377
- package/dist/contracts-NbV3P_Rl.d.ts +677 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/package.json +4 -2
package/dist/api.d.ts
CHANGED
|
@@ -1,7 +1,76 @@
|
|
|
1
1
|
import { CoreConfig } from './config.js';
|
|
2
2
|
import { T as TokenProvider } from './tokenProvider-BWTusyj4.js';
|
|
3
|
+
import { E as TurnUsage } from './contracts-NbV3P_Rl.js';
|
|
3
4
|
import 'zod';
|
|
4
5
|
|
|
6
|
+
type HistoryImportProvider = "claude_code" | "cursor";
|
|
7
|
+
type HistoryImportCaptureSource = "claude_local_v1" | "cursor_local_v1" | "cursor_local_v1_drift";
|
|
8
|
+
type HistoryImportRecordMetadata = {
|
|
9
|
+
importBatchId: string;
|
|
10
|
+
importerVersion: string;
|
|
11
|
+
scannerSchemaFingerprint?: string;
|
|
12
|
+
rawCwd?: string;
|
|
13
|
+
driftDetected?: boolean;
|
|
14
|
+
};
|
|
15
|
+
type HistoryImportWorkspaceMetadata = {
|
|
16
|
+
turnUsage: TurnUsage;
|
|
17
|
+
branch?: string;
|
|
18
|
+
} & Record<string, unknown>;
|
|
19
|
+
type HistoricalTurnRecord = {
|
|
20
|
+
provider: HistoryImportProvider;
|
|
21
|
+
providerSessionId: string | null;
|
|
22
|
+
providerTurnId: string;
|
|
23
|
+
repoFingerprint: string;
|
|
24
|
+
captureSource: HistoryImportCaptureSource;
|
|
25
|
+
occurredAt: string;
|
|
26
|
+
promptText: string | null;
|
|
27
|
+
assistantText?: string | null;
|
|
28
|
+
workspaceMetadata: HistoryImportWorkspaceMetadata;
|
|
29
|
+
metadata: HistoryImportRecordMetadata;
|
|
30
|
+
dedupKey: string;
|
|
31
|
+
};
|
|
32
|
+
type ImportHistoryRequest = {
|
|
33
|
+
records: HistoricalTurnRecord[];
|
|
34
|
+
};
|
|
35
|
+
type ImportHistoryRecordOutcome = {
|
|
36
|
+
ok: true;
|
|
37
|
+
outcome: "inserted";
|
|
38
|
+
historicalRepoTurnId: string;
|
|
39
|
+
} | {
|
|
40
|
+
ok: true;
|
|
41
|
+
outcome: "skipped_duplicate";
|
|
42
|
+
} | {
|
|
43
|
+
ok: false;
|
|
44
|
+
outcome: "validation_failed";
|
|
45
|
+
reason: string;
|
|
46
|
+
} | {
|
|
47
|
+
ok: false;
|
|
48
|
+
outcome: "dedup_key_mismatch";
|
|
49
|
+
expected: string;
|
|
50
|
+
} | {
|
|
51
|
+
ok: false;
|
|
52
|
+
outcome: "insert_failed";
|
|
53
|
+
reason: string;
|
|
54
|
+
};
|
|
55
|
+
type ImportHistoryResponse = {
|
|
56
|
+
importBatchId: string;
|
|
57
|
+
processed: number;
|
|
58
|
+
inserted: number;
|
|
59
|
+
skipped: number;
|
|
60
|
+
failed: number;
|
|
61
|
+
perRepo: Array<{
|
|
62
|
+
repoFingerprint: string;
|
|
63
|
+
inserted: number;
|
|
64
|
+
skipped: number;
|
|
65
|
+
failed: number;
|
|
66
|
+
}>;
|
|
67
|
+
failures: Array<{
|
|
68
|
+
dedupKey: string;
|
|
69
|
+
outcome: Exclude<ImportHistoryRecordOutcome["outcome"], "inserted" | "skipped_duplicate">;
|
|
70
|
+
reason: string;
|
|
71
|
+
}>;
|
|
72
|
+
};
|
|
73
|
+
|
|
5
74
|
type Json = Record<string, unknown> | unknown[] | string | number | boolean | null;
|
|
6
75
|
type MergeRequestStatus = "open" | "approved" | "rejected" | "merged" | "closed";
|
|
7
76
|
type MergeRequest = {
|
|
@@ -413,6 +482,7 @@ type ApiClient = {
|
|
|
413
482
|
defaultBranch?: string;
|
|
414
483
|
repoFingerprint?: string;
|
|
415
484
|
headCommitHash?: string;
|
|
485
|
+
forceNew?: boolean;
|
|
416
486
|
}): Promise<Json>;
|
|
417
487
|
importFromGithubFirstParty(payload: {
|
|
418
488
|
repoFullName: string;
|
|
@@ -499,6 +569,10 @@ type ApiClient = {
|
|
|
499
569
|
workspaceMetadata?: Record<string, unknown>;
|
|
500
570
|
idempotencyKey?: string;
|
|
501
571
|
}): Promise<Json>;
|
|
572
|
+
attachCollabTurnUsage(appId: string, payload: {
|
|
573
|
+
prompt: string;
|
|
574
|
+
workspaceMetadata: Record<string, unknown>;
|
|
575
|
+
}): Promise<Json>;
|
|
502
576
|
listCollabTurns(appId: string, params?: {
|
|
503
577
|
limit?: number;
|
|
504
578
|
offset?: number;
|
|
@@ -660,10 +734,11 @@ type ApiClient = {
|
|
|
660
734
|
createdBefore?: string;
|
|
661
735
|
}): Promise<Json>;
|
|
662
736
|
getSandboxStatus(appId: string): Promise<Json>;
|
|
737
|
+
importHistory(payload: ImportHistoryRequest): Promise<ImportHistoryResponse>;
|
|
663
738
|
};
|
|
664
739
|
declare function createApiClient(config: CoreConfig, opts?: {
|
|
665
740
|
apiKey?: string | null;
|
|
666
741
|
tokenProvider?: TokenProvider;
|
|
667
742
|
}): ApiClient;
|
|
668
743
|
|
|
669
|
-
export { type AgentMemoryItem, type AgentMemoryKind, type AgentMemorySearchItem, type AgentMemorySearchResponse, type AgentMemorySummary, type AgentMemoryTimelineResponse, type ApiClient, type AppContext, type AppContextAccessPath, type AppReconcileResponse, type Bundle, type BundlePlatform, type BundleStatus, type ChangeStepDiffResponse, type InitiateBundleRequest, type InvitationRecord, type MergeRequest, type MergeRequestReview, type MergeRequestStatus, type ReconcilePreflightResponse, type SyncLocalResponse, type SyncUpstreamResponse, createApiClient };
|
|
744
|
+
export { type AgentMemoryItem, type AgentMemoryKind, type AgentMemorySearchItem, type AgentMemorySearchResponse, type AgentMemorySummary, type AgentMemoryTimelineResponse, type ApiClient, type AppContext, type AppContextAccessPath, type AppReconcileResponse, type Bundle, type BundlePlatform, type BundleStatus, type ChangeStepDiffResponse, type HistoricalTurnRecord, type HistoryImportCaptureSource, type HistoryImportProvider, type HistoryImportRecordMetadata, type HistoryImportWorkspaceMetadata, type ImportHistoryRecordOutcome, type ImportHistoryRequest, type ImportHistoryResponse, type InitiateBundleRequest, type InvitationRecord, type MergeRequest, type MergeRequestReview, type MergeRequestStatus, type ReconcilePreflightResponse, type SyncLocalResponse, type SyncUpstreamResponse, createApiClient };
|
package/dist/api.js
CHANGED
package/dist/auth.js
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type BranchBindingMode = "legacy" | "lane" | "explicit_root";
|
|
2
|
+
type BranchBinding = {
|
|
3
|
+
projectId: string | null;
|
|
4
|
+
currentAppId: string;
|
|
5
|
+
upstreamAppId: string;
|
|
6
|
+
threadId: string | null;
|
|
7
|
+
laneId: string | null;
|
|
8
|
+
bindingMode: BranchBindingMode;
|
|
9
|
+
};
|
|
10
|
+
type CollabBinding = {
|
|
11
|
+
schemaVersion: 3;
|
|
12
|
+
projectId: string | null;
|
|
13
|
+
currentAppId: string;
|
|
14
|
+
upstreamAppId: string;
|
|
15
|
+
threadId: string | null;
|
|
16
|
+
repoFingerprint: string | null;
|
|
17
|
+
remoteUrl: string | null;
|
|
18
|
+
defaultBranch: string | null;
|
|
19
|
+
laneId: string | null;
|
|
20
|
+
branchName: string | null;
|
|
21
|
+
bindingMode: BranchBindingMode;
|
|
22
|
+
};
|
|
23
|
+
declare function getCollabBindingPath(repoRoot: string): string;
|
|
24
|
+
type CollabBindingState = {
|
|
25
|
+
schemaVersion: 1 | 2 | 3;
|
|
26
|
+
projectId: string | null;
|
|
27
|
+
repoFingerprint: string | null;
|
|
28
|
+
remoteUrl: string | null;
|
|
29
|
+
defaultBranch: string | null;
|
|
30
|
+
currentBranch: string | null;
|
|
31
|
+
binding: CollabBinding | null;
|
|
32
|
+
branchBindings: Record<string, BranchBinding>;
|
|
33
|
+
explicitRootBinding: CollabBinding | null;
|
|
34
|
+
};
|
|
35
|
+
declare function readCollabBindingState(repoRoot: string, options?: {
|
|
36
|
+
persist?: boolean;
|
|
37
|
+
}): Promise<CollabBindingState | null>;
|
|
38
|
+
declare function readCollabBinding(repoRoot: string): Promise<CollabBinding | null>;
|
|
39
|
+
declare function writeCollabBinding(repoRoot: string, binding: Omit<CollabBinding, "schemaVersion" | "branchName"> & {
|
|
40
|
+
branchName?: string | null;
|
|
41
|
+
}): Promise<string>;
|
|
42
|
+
|
|
43
|
+
export { type BranchBindingMode as B, type CollabBinding as C, type CollabBindingState as a, readCollabBindingState as b, getCollabBindingPath as g, readCollabBinding as r, writeCollabBinding as w };
|
package/dist/binding.d.ts
CHANGED
|
@@ -1,21 +1 @@
|
|
|
1
|
-
|
|
2
|
-
type CollabBinding = {
|
|
3
|
-
schemaVersion: 3;
|
|
4
|
-
projectId: string | null;
|
|
5
|
-
currentAppId: string;
|
|
6
|
-
upstreamAppId: string;
|
|
7
|
-
threadId: string | null;
|
|
8
|
-
repoFingerprint: string | null;
|
|
9
|
-
remoteUrl: string | null;
|
|
10
|
-
defaultBranch: string | null;
|
|
11
|
-
laneId: string | null;
|
|
12
|
-
branchName: string | null;
|
|
13
|
-
bindingMode: BranchBindingMode;
|
|
14
|
-
};
|
|
15
|
-
declare function getCollabBindingPath(repoRoot: string): string;
|
|
16
|
-
declare function readCollabBinding(repoRoot: string): Promise<CollabBinding | null>;
|
|
17
|
-
declare function writeCollabBinding(repoRoot: string, binding: Omit<CollabBinding, "schemaVersion" | "branchName"> & {
|
|
18
|
-
branchName?: string | null;
|
|
19
|
-
}): Promise<string>;
|
|
20
|
-
|
|
21
|
-
export { type CollabBinding, getCollabBindingPath, readCollabBinding, writeCollabBinding };
|
|
1
|
+
export { C as CollabBinding, a as CollabBindingState, g as getCollabBindingPath, r as readCollabBinding, b as readCollabBindingState, w as writeCollabBinding } from './binding-WiIRI2fl.js';
|
package/dist/binding.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCollabBindingPath,
|
|
3
3
|
readCollabBinding,
|
|
4
|
+
readCollabBindingState,
|
|
4
5
|
writeCollabBinding
|
|
5
6
|
} from "./chunk-YCFLOHJV.js";
|
|
6
7
|
import "./chunk-WT6VRLXU.js";
|
|
@@ -9,5 +10,6 @@ import "./chunk-YZ34ICNN.js";
|
|
|
9
10
|
export {
|
|
10
11
|
getCollabBindingPath,
|
|
11
12
|
readCollabBinding,
|
|
13
|
+
readCollabBindingState,
|
|
12
14
|
writeCollabBinding
|
|
13
15
|
};
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RemixError
|
|
3
|
+
} from "./chunk-YZ34ICNN.js";
|
|
4
|
+
|
|
5
|
+
// src/auth/session.ts
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
var storedSessionSchema = z.object({
|
|
8
|
+
access_token: z.string().min(1),
|
|
9
|
+
refresh_token: z.string().min(1),
|
|
10
|
+
expires_at: z.number().int().positive(),
|
|
11
|
+
token_type: z.string().min(1).optional(),
|
|
12
|
+
user: z.object({
|
|
13
|
+
id: z.string().min(1),
|
|
14
|
+
email: z.string().email().optional().nullable()
|
|
15
|
+
}).optional()
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// src/auth/localSessionStore.ts
|
|
19
|
+
import fs from "fs/promises";
|
|
20
|
+
import os from "os";
|
|
21
|
+
import path from "path";
|
|
22
|
+
function xdgConfigHome() {
|
|
23
|
+
const value = process.env.XDG_CONFIG_HOME;
|
|
24
|
+
if (typeof value === "string" && value.trim()) return value;
|
|
25
|
+
return path.join(os.homedir(), ".config");
|
|
26
|
+
}
|
|
27
|
+
async function maybeLoadKeytar() {
|
|
28
|
+
try {
|
|
29
|
+
const mod = await new Function("return import('keytar')")();
|
|
30
|
+
const candidates = [mod, mod?.default].filter(Boolean);
|
|
31
|
+
for (const candidate of candidates) {
|
|
32
|
+
const value = candidate;
|
|
33
|
+
if (typeof value.getPassword === "function" && typeof value.setPassword === "function") {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
} catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
async function ensurePathPermissions(filePath) {
|
|
43
|
+
const dir = path.dirname(filePath);
|
|
44
|
+
await fs.mkdir(dir, { recursive: true });
|
|
45
|
+
try {
|
|
46
|
+
await fs.chmod(dir, 448);
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
await fs.chmod(filePath, 384);
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async function writeJsonAtomic(filePath, value) {
|
|
55
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
56
|
+
const tmpPath = `${filePath}.tmp-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
57
|
+
await fs.writeFile(tmpPath, JSON.stringify(value, null, 2) + "\n", "utf8");
|
|
58
|
+
await fs.rename(tmpPath, filePath);
|
|
59
|
+
}
|
|
60
|
+
async function writeSessionFileFallback(filePath, session) {
|
|
61
|
+
await writeJsonAtomic(filePath, session);
|
|
62
|
+
await ensurePathPermissions(filePath);
|
|
63
|
+
}
|
|
64
|
+
function createLocalSessionStore(params) {
|
|
65
|
+
const service = params?.service?.trim() || "remix-cli";
|
|
66
|
+
const account = params?.account?.trim() || "default";
|
|
67
|
+
const filePath = params?.filePath?.trim() || path.join(xdgConfigHome(), "remix", "session.json");
|
|
68
|
+
async function readKeytar() {
|
|
69
|
+
const keytar = await maybeLoadKeytar();
|
|
70
|
+
if (!keytar) return null;
|
|
71
|
+
const raw = await keytar.getPassword(service, account).catch(() => null);
|
|
72
|
+
if (!raw) return null;
|
|
73
|
+
try {
|
|
74
|
+
const parsed = storedSessionSchema.safeParse(JSON.parse(raw));
|
|
75
|
+
return parsed.success ? parsed.data : null;
|
|
76
|
+
} catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function readFile() {
|
|
81
|
+
const raw = await fs.readFile(filePath, "utf8").catch(() => null);
|
|
82
|
+
if (!raw) return null;
|
|
83
|
+
try {
|
|
84
|
+
const parsed = storedSessionSchema.safeParse(JSON.parse(raw));
|
|
85
|
+
if (!parsed.success) return null;
|
|
86
|
+
await ensurePathPermissions(filePath);
|
|
87
|
+
return parsed.data;
|
|
88
|
+
} catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function pickFreshest(a, b) {
|
|
93
|
+
if (!a) return b;
|
|
94
|
+
if (!b) return a;
|
|
95
|
+
return a.expires_at >= b.expires_at ? a : b;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
async getSession() {
|
|
99
|
+
const [k, f] = await Promise.all([readKeytar(), readFile()]);
|
|
100
|
+
return pickFreshest(k, f);
|
|
101
|
+
},
|
|
102
|
+
async setSession(session) {
|
|
103
|
+
const parsed = storedSessionSchema.safeParse(session);
|
|
104
|
+
if (!parsed.success) {
|
|
105
|
+
throw new Error("Session data is invalid and was not stored.");
|
|
106
|
+
}
|
|
107
|
+
await writeSessionFileFallback(filePath, parsed.data);
|
|
108
|
+
const keytar = await maybeLoadKeytar();
|
|
109
|
+
if (keytar) {
|
|
110
|
+
try {
|
|
111
|
+
await keytar.setPassword(service, account, JSON.stringify(parsed.data));
|
|
112
|
+
} catch {
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// src/auth/tokenProvider.ts
|
|
120
|
+
function shouldRefreshSoon(session, skewSeconds = 60) {
|
|
121
|
+
const nowSec = Math.floor(Date.now() / 1e3);
|
|
122
|
+
return session.expires_at <= nowSec + skewSeconds;
|
|
123
|
+
}
|
|
124
|
+
function createStoredSessionTokenProvider(params) {
|
|
125
|
+
return async (opts) => {
|
|
126
|
+
const forceRefresh = Boolean(opts?.forceRefresh);
|
|
127
|
+
const envToken = process.env.COMERGE_ACCESS_TOKEN;
|
|
128
|
+
if (typeof envToken === "string" && envToken.trim().length > 0) {
|
|
129
|
+
return { token: envToken.trim(), session: null, fromEnv: true };
|
|
130
|
+
}
|
|
131
|
+
let session = await params.sessionStore.getSession();
|
|
132
|
+
if (!session) {
|
|
133
|
+
throw new RemixError("Not signed in.", {
|
|
134
|
+
exitCode: 2,
|
|
135
|
+
hint: "Run `remix login`, or set COMERGE_ACCESS_TOKEN for CI."
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (forceRefresh || shouldRefreshSoon(session)) {
|
|
139
|
+
try {
|
|
140
|
+
session = await params.refreshStoredSession({ config: params.config, session });
|
|
141
|
+
await params.sessionStore.setSession(session);
|
|
142
|
+
} catch (err) {
|
|
143
|
+
void err;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return { token: session.access_token, session, fromEnv: false };
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// src/auth/supabase.ts
|
|
151
|
+
import { createClient } from "@supabase/supabase-js";
|
|
152
|
+
function createInMemoryStorage() {
|
|
153
|
+
const map = /* @__PURE__ */ new Map();
|
|
154
|
+
return {
|
|
155
|
+
getItem: (k) => map.get(k) ?? null,
|
|
156
|
+
setItem: (k, v) => {
|
|
157
|
+
map.set(k, v);
|
|
158
|
+
},
|
|
159
|
+
removeItem: (k) => {
|
|
160
|
+
map.delete(k);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function createSupabaseClient(config, storage) {
|
|
165
|
+
return createClient(config.supabaseUrl, config.supabaseAnonKey, {
|
|
166
|
+
auth: {
|
|
167
|
+
flowType: "pkce",
|
|
168
|
+
persistSession: false,
|
|
169
|
+
autoRefreshToken: false,
|
|
170
|
+
detectSessionInUrl: false,
|
|
171
|
+
storage
|
|
172
|
+
},
|
|
173
|
+
global: {
|
|
174
|
+
headers: {
|
|
175
|
+
"X-Requested-By": "comerge-cli"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function toStoredSession(session) {
|
|
181
|
+
if (!session.access_token || !session.refresh_token || !session.expires_at) {
|
|
182
|
+
throw new RemixError("Supabase session is missing required fields.", { exitCode: 1 });
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
access_token: session.access_token,
|
|
186
|
+
refresh_token: session.refresh_token,
|
|
187
|
+
expires_at: session.expires_at,
|
|
188
|
+
token_type: session.token_type ?? void 0,
|
|
189
|
+
user: session.user ? { id: session.user.id, email: session.user.email ?? null } : void 0
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function createSupabaseAuthHelpers(config) {
|
|
193
|
+
const storage = createInMemoryStorage();
|
|
194
|
+
const supabase = createSupabaseClient(config, storage);
|
|
195
|
+
return {
|
|
196
|
+
async startGoogleLogin(params) {
|
|
197
|
+
const { data, error } = await supabase.auth.signInWithOAuth({
|
|
198
|
+
provider: "google",
|
|
199
|
+
options: {
|
|
200
|
+
redirectTo: params.redirectTo,
|
|
201
|
+
skipBrowserRedirect: true,
|
|
202
|
+
queryParams: {
|
|
203
|
+
access_type: "offline",
|
|
204
|
+
prompt: "consent"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
if (error) throw error;
|
|
209
|
+
if (!data?.url) throw new RemixError("Supabase did not return an OAuth URL.", { exitCode: 1 });
|
|
210
|
+
return { url: data.url };
|
|
211
|
+
},
|
|
212
|
+
async exchangeCode(params) {
|
|
213
|
+
const { data, error } = await supabase.auth.exchangeCodeForSession(params.code);
|
|
214
|
+
if (error) throw error;
|
|
215
|
+
if (!data?.session) throw new RemixError("Supabase did not return a session.", { exitCode: 1 });
|
|
216
|
+
return toStoredSession(data.session);
|
|
217
|
+
},
|
|
218
|
+
async refreshWithStoredSession(params) {
|
|
219
|
+
const { data, error } = await supabase.auth.setSession({
|
|
220
|
+
access_token: params.session.access_token,
|
|
221
|
+
refresh_token: params.session.refresh_token
|
|
222
|
+
});
|
|
223
|
+
if (error) throw error;
|
|
224
|
+
if (!data?.session) throw new RemixError("No session returned after refresh.", { exitCode: 1 });
|
|
225
|
+
return toStoredSession(data.session);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export {
|
|
231
|
+
storedSessionSchema,
|
|
232
|
+
createLocalSessionStore,
|
|
233
|
+
shouldRefreshSoon,
|
|
234
|
+
createStoredSessionTokenProvider,
|
|
235
|
+
createSupabaseAuthHelpers
|
|
236
|
+
};
|