@remixhq/core 0.1.41 → 0.1.42
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 +30 -0
- package/dist/api.js +1 -1
- package/dist/auth.d.ts +65 -1
- package/dist/auth.js +3 -1
- package/dist/{chunk-QCRTVR5N.js → chunk-PDX2IQJO.js} +42 -6
- package/dist/{chunk-Y2QPVJFH.js → chunk-UN3Q7P5E.js} +19 -0
- package/dist/cliError-Bels0ULL.d.ts +14 -0
- package/dist/errors.d.ts +2 -13
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -2
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -909,6 +909,8 @@ type ApiClient = {
|
|
|
909
909
|
}): Promise<Json>;
|
|
910
910
|
importFromGithubFirstParty(payload: {
|
|
911
911
|
repoFullName: string;
|
|
912
|
+
installationId?: number;
|
|
913
|
+
githubRepoId?: number;
|
|
912
914
|
branch?: string;
|
|
913
915
|
path?: string;
|
|
914
916
|
appName?: string;
|
|
@@ -921,6 +923,34 @@ type ApiClient = {
|
|
|
921
923
|
defaultBranch?: string;
|
|
922
924
|
repoFingerprint?: string;
|
|
923
925
|
}): Promise<Json>;
|
|
926
|
+
getGithubStatus(): Promise<Json>;
|
|
927
|
+
startGithubOAuth(): Promise<Json>;
|
|
928
|
+
getGithubInstallUrl(): Promise<Json>;
|
|
929
|
+
syncGithubInstallations(): Promise<Json>;
|
|
930
|
+
listGithubInstallations(): Promise<Json>;
|
|
931
|
+
listGithubRepositories(installationId: number): Promise<Json>;
|
|
932
|
+
linkAppGithubSource(appId: string, payload: {
|
|
933
|
+
installationId: number;
|
|
934
|
+
githubRepoId?: number;
|
|
935
|
+
repoFullName: string;
|
|
936
|
+
branch: string;
|
|
937
|
+
path?: string;
|
|
938
|
+
defaultBranch?: string;
|
|
939
|
+
remoteUrl?: string;
|
|
940
|
+
repoFingerprint?: string;
|
|
941
|
+
headCommitHash?: string;
|
|
942
|
+
}): Promise<Json>;
|
|
943
|
+
getAppGithubPullRequest(appId: string): Promise<Json>;
|
|
944
|
+
createAppGithubPullRequest(appId: string, payload?: {
|
|
945
|
+
title?: string;
|
|
946
|
+
body?: string;
|
|
947
|
+
baseBranch?: string;
|
|
948
|
+
draft?: boolean;
|
|
949
|
+
}): Promise<Json>;
|
|
950
|
+
updateAppGithubPullRequest(appId: string, payload?: {
|
|
951
|
+
title?: string;
|
|
952
|
+
body?: string;
|
|
953
|
+
}): Promise<Json>;
|
|
924
954
|
forkApp(appId: string, payload?: {
|
|
925
955
|
name?: string;
|
|
926
956
|
platform?: string;
|
package/dist/api.js
CHANGED
package/dist/auth.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { W as WithRefreshLock, S as SessionStore, a as StoredSession } from './tokenProvider-BP3YfJHm.js';
|
|
2
2
|
export { R as RefreshLockOptions, e as RefreshStoredSession, f as ResolvedAuthToken, T as TokenProvider, c as createRefreshLock, b as createStoredSessionTokenProvider, s as shouldRefreshSoon, d as storedSessionSchema } from './tokenProvider-BP3YfJHm.js';
|
|
3
3
|
import { CoreConfig } from './config.js';
|
|
4
|
+
import { R as RemixError } from './cliError-Bels0ULL.js';
|
|
4
5
|
import 'zod';
|
|
5
6
|
|
|
6
7
|
declare function createLocalSessionStore(params?: {
|
|
@@ -46,7 +47,62 @@ declare function createDefaultRefreshLock(filePath?: string): WithRefreshLock;
|
|
|
46
47
|
declare function isNetworkError(err: unknown): boolean;
|
|
47
48
|
declare function isInvalidGrantError(err: unknown): boolean;
|
|
48
49
|
|
|
50
|
+
type RemixAuthProvider = "google" | "github";
|
|
51
|
+
type WorkosAuthOrganization = {
|
|
52
|
+
id: string;
|
|
53
|
+
name?: string | null;
|
|
54
|
+
};
|
|
55
|
+
type WorkosAuthFactor = {
|
|
56
|
+
id: string;
|
|
57
|
+
type: string;
|
|
58
|
+
authenticationChallengeId?: string | null;
|
|
59
|
+
};
|
|
60
|
+
type WorkosAuthChallenge = {
|
|
61
|
+
code: string;
|
|
62
|
+
message: string;
|
|
63
|
+
email?: string | null;
|
|
64
|
+
pendingAuthenticationToken?: string | null;
|
|
65
|
+
emailVerificationId?: string | null;
|
|
66
|
+
organizations?: WorkosAuthOrganization[];
|
|
67
|
+
authenticationFactors?: WorkosAuthFactor[];
|
|
68
|
+
user?: {
|
|
69
|
+
id?: string | null;
|
|
70
|
+
email?: string | null;
|
|
71
|
+
firstName?: string | null;
|
|
72
|
+
lastName?: string | null;
|
|
73
|
+
emailVerified?: boolean | null;
|
|
74
|
+
} | null;
|
|
75
|
+
authMethods?: Record<string, boolean> | null;
|
|
76
|
+
connectionIds?: string[];
|
|
77
|
+
ssoConnectionIds?: string[];
|
|
78
|
+
};
|
|
79
|
+
type WorkosContinuationInput = {
|
|
80
|
+
type: "email_verification";
|
|
81
|
+
pendingAuthenticationToken: string;
|
|
82
|
+
code: string;
|
|
83
|
+
} | {
|
|
84
|
+
type: "organization_selection";
|
|
85
|
+
pendingAuthenticationToken: string;
|
|
86
|
+
organizationId: string;
|
|
87
|
+
} | {
|
|
88
|
+
type: "mfa_totp";
|
|
89
|
+
pendingAuthenticationToken: string;
|
|
90
|
+
authenticationChallengeId: string;
|
|
91
|
+
code: string;
|
|
92
|
+
};
|
|
93
|
+
declare class RemixAuthContinuationError extends RemixError {
|
|
94
|
+
readonly challenge: WorkosAuthChallenge;
|
|
95
|
+
constructor(message: string, challenge: WorkosAuthChallenge, statusCode: number);
|
|
96
|
+
}
|
|
49
97
|
type RemixAuthHelpers = {
|
|
98
|
+
startLogin(params: {
|
|
99
|
+
redirectTo: string;
|
|
100
|
+
state?: string;
|
|
101
|
+
provider?: RemixAuthProvider;
|
|
102
|
+
}): Promise<{
|
|
103
|
+
url: string;
|
|
104
|
+
codeVerifier?: string;
|
|
105
|
+
}>;
|
|
50
106
|
startGoogleLogin(params: {
|
|
51
107
|
redirectTo: string;
|
|
52
108
|
state?: string;
|
|
@@ -54,14 +110,22 @@ type RemixAuthHelpers = {
|
|
|
54
110
|
url: string;
|
|
55
111
|
codeVerifier?: string;
|
|
56
112
|
}>;
|
|
113
|
+
startGithubLogin(params: {
|
|
114
|
+
redirectTo: string;
|
|
115
|
+
state?: string;
|
|
116
|
+
}): Promise<{
|
|
117
|
+
url: string;
|
|
118
|
+
codeVerifier?: string;
|
|
119
|
+
}>;
|
|
57
120
|
exchangeCode(params: {
|
|
58
121
|
code: string;
|
|
59
122
|
codeVerifier?: string;
|
|
60
123
|
}): Promise<StoredSession>;
|
|
124
|
+
continueAuthentication(input: WorkosContinuationInput): Promise<StoredSession>;
|
|
61
125
|
refreshWithStoredSession(params: {
|
|
62
126
|
session: StoredSession;
|
|
63
127
|
}): Promise<StoredSession>;
|
|
64
128
|
};
|
|
65
129
|
declare function createRemixAuthHelpers(config: CoreConfig): RemixAuthHelpers;
|
|
66
130
|
|
|
67
|
-
export { type RemixAuthHelpers, SessionStore, StoredSession, WithRefreshLock, createDefaultRefreshLock, createLocalSessionStore, createRemixAuthHelpers, defaultSessionFilePath, isInvalidGrantError, isNetworkError };
|
|
131
|
+
export { RemixAuthContinuationError, type RemixAuthHelpers, SessionStore, StoredSession, WithRefreshLock, type WorkosAuthChallenge, type WorkosContinuationInput, createDefaultRefreshLock, createLocalSessionStore, createRemixAuthHelpers, defaultSessionFilePath, isInvalidGrantError, isNetworkError };
|
package/dist/auth.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
RemixAuthContinuationError,
|
|
2
3
|
createDefaultRefreshLock,
|
|
3
4
|
createLocalSessionStore,
|
|
4
5
|
createRefreshLock,
|
|
@@ -9,9 +10,10 @@ import {
|
|
|
9
10
|
isNetworkError,
|
|
10
11
|
shouldRefreshSoon,
|
|
11
12
|
storedSessionSchema
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PDX2IQJO.js";
|
|
13
14
|
import "./chunk-7XJGOKEO.js";
|
|
14
15
|
export {
|
|
16
|
+
RemixAuthContinuationError,
|
|
15
17
|
createDefaultRefreshLock,
|
|
16
18
|
createLocalSessionStore,
|
|
17
19
|
createRefreshLock,
|
|
@@ -288,6 +288,20 @@ function createStoredSessionTokenProvider(params) {
|
|
|
288
288
|
|
|
289
289
|
// src/auth/supabase.ts
|
|
290
290
|
import crypto from "crypto";
|
|
291
|
+
var RemixAuthContinuationError = class extends RemixError {
|
|
292
|
+
challenge;
|
|
293
|
+
constructor(message, challenge, statusCode) {
|
|
294
|
+
super(message, { code: challenge.code, exitCode: 1, statusCode });
|
|
295
|
+
this.name = "RemixAuthContinuationError";
|
|
296
|
+
this.challenge = challenge;
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
function isRecord(value) {
|
|
300
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
301
|
+
}
|
|
302
|
+
function isWorkosAuthChallenge(value) {
|
|
303
|
+
return isRecord(value) && typeof value.code === "string";
|
|
304
|
+
}
|
|
291
305
|
async function postBackend(config, path3, body, options) {
|
|
292
306
|
const response = await fetch(new URL(path3, config.apiUrl), {
|
|
293
307
|
method: "POST",
|
|
@@ -296,6 +310,16 @@ async function postBackend(config, path3, body, options) {
|
|
|
296
310
|
body: JSON.stringify(body)
|
|
297
311
|
});
|
|
298
312
|
const payload = await response.json();
|
|
313
|
+
if (response.status === 403 && !payload.success && isWorkosAuthChallenge(payload.responseObject)) {
|
|
314
|
+
throw new RemixAuthContinuationError(
|
|
315
|
+
payload.message || payload.responseObject.message || "Authentication continuation required.",
|
|
316
|
+
{
|
|
317
|
+
...payload.responseObject,
|
|
318
|
+
message: payload.responseObject.message || payload.message || "Authentication continuation required."
|
|
319
|
+
},
|
|
320
|
+
response.status
|
|
321
|
+
);
|
|
322
|
+
}
|
|
299
323
|
if (!response.ok || !payload.success || payload.responseObject == null) {
|
|
300
324
|
throw new RemixError(payload.message || `Remix backend request failed with status ${response.status}.`, {
|
|
301
325
|
exitCode: 1
|
|
@@ -332,14 +356,21 @@ function normalizeBrowserReturnTo(redirectTo) {
|
|
|
332
356
|
return redirectTo;
|
|
333
357
|
}
|
|
334
358
|
function createRemixAuthHelpers(config) {
|
|
359
|
+
async function startLogin(params) {
|
|
360
|
+
const path3 = params.state ? "/v1/auth/cli/login-url" : "/v1/auth/login-url";
|
|
361
|
+
const pkce = params.state ? createPkcePair() : null;
|
|
362
|
+
const body = params.state ? { returnTo: params.redirectTo, state: params.state, codeChallenge: pkce?.codeChallenge, provider: params.provider ?? "google" } : { returnTo: normalizeBrowserReturnTo(params.redirectTo), provider: params.provider ?? "google" };
|
|
363
|
+
const result = await postBackend(config, path3, body, params.state ? void 0 : { credentials: "include" });
|
|
364
|
+
if (!result.url) throw new RemixError("Remix backend did not return an auth URL.", { exitCode: 1 });
|
|
365
|
+
return pkce ? { url: result.url, codeVerifier: pkce.codeVerifier } : { url: result.url };
|
|
366
|
+
}
|
|
335
367
|
return {
|
|
368
|
+
startLogin,
|
|
336
369
|
async startGoogleLogin(params) {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
if (!result.url) throw new RemixError("Remix backend did not return an auth URL.", { exitCode: 1 });
|
|
342
|
-
return pkce ? { url: result.url, codeVerifier: pkce.codeVerifier } : { url: result.url };
|
|
370
|
+
return startLogin({ ...params, provider: "google" });
|
|
371
|
+
},
|
|
372
|
+
async startGithubLogin(params) {
|
|
373
|
+
return startLogin({ ...params, provider: "github" });
|
|
343
374
|
},
|
|
344
375
|
async exchangeCode(params) {
|
|
345
376
|
const result = await postBackend(config, "/v1/auth/cli/exchange", {
|
|
@@ -348,6 +379,10 @@ function createRemixAuthHelpers(config) {
|
|
|
348
379
|
});
|
|
349
380
|
return toStoredSession(result);
|
|
350
381
|
},
|
|
382
|
+
async continueAuthentication(input) {
|
|
383
|
+
const result = await postBackend(config, "/v1/auth/cli/continue", input);
|
|
384
|
+
return toStoredSession(result);
|
|
385
|
+
},
|
|
351
386
|
async refreshWithStoredSession(params) {
|
|
352
387
|
const result = await postBackend(config, "/v1/auth/token/refresh", {
|
|
353
388
|
refreshToken: params.session.refresh_token
|
|
@@ -367,5 +402,6 @@ export {
|
|
|
367
402
|
isInvalidGrantError,
|
|
368
403
|
shouldRefreshSoon,
|
|
369
404
|
createStoredSessionTokenProvider,
|
|
405
|
+
RemixAuthContinuationError,
|
|
370
406
|
createRemixAuthHelpers
|
|
371
407
|
};
|
|
@@ -284,6 +284,25 @@ function createApiClient(config, opts) {
|
|
|
284
284
|
body: JSON.stringify(payload ?? {})
|
|
285
285
|
}),
|
|
286
286
|
getAppPreview: (appId, params) => request(`/v1/apps/${encodeURIComponent(appId)}/preview${buildAppPreviewQuery(params)}`, { method: "GET" }),
|
|
287
|
+
getGithubStatus: () => request("/v1/github/status", { method: "GET" }),
|
|
288
|
+
startGithubOAuth: () => request("/v1/github/oauth/start", { method: "GET" }),
|
|
289
|
+
getGithubInstallUrl: () => request("/v1/github/install-url", { method: "GET" }),
|
|
290
|
+
syncGithubInstallations: () => request("/v1/github/installations/sync", { method: "POST" }),
|
|
291
|
+
listGithubInstallations: () => request("/v1/github/installations", { method: "GET" }),
|
|
292
|
+
listGithubRepositories: (installationId) => request(`/v1/github/installations/${encodeURIComponent(String(installationId))}/repositories`, { method: "GET" }),
|
|
293
|
+
linkAppGithubSource: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/github/link`, {
|
|
294
|
+
method: "POST",
|
|
295
|
+
body: JSON.stringify(payload)
|
|
296
|
+
}),
|
|
297
|
+
getAppGithubPullRequest: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/github/pull-request`, { method: "GET" }),
|
|
298
|
+
createAppGithubPullRequest: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/github/pull-request`, {
|
|
299
|
+
method: "POST",
|
|
300
|
+
body: JSON.stringify(payload ?? {})
|
|
301
|
+
}),
|
|
302
|
+
updateAppGithubPullRequest: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/github/pull-request`, {
|
|
303
|
+
method: "PATCH",
|
|
304
|
+
body: JSON.stringify(payload ?? {})
|
|
305
|
+
}),
|
|
287
306
|
createAppShareLink: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/share-links`, {
|
|
288
307
|
method: "POST",
|
|
289
308
|
body: JSON.stringify(payload ?? {})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare class RemixError extends Error {
|
|
2
|
+
readonly code: string | null;
|
|
3
|
+
readonly exitCode: number;
|
|
4
|
+
readonly hint: string | null;
|
|
5
|
+
readonly statusCode: number | null;
|
|
6
|
+
constructor(message: string, opts?: {
|
|
7
|
+
code?: string | null;
|
|
8
|
+
exitCode?: number;
|
|
9
|
+
hint?: string | null;
|
|
10
|
+
statusCode?: number | null;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { RemixError as R };
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
readonly code: string | null;
|
|
3
|
-
readonly exitCode: number;
|
|
4
|
-
readonly hint: string | null;
|
|
5
|
-
readonly statusCode: number | null;
|
|
6
|
-
constructor(message: string, opts?: {
|
|
7
|
-
code?: string | null;
|
|
8
|
-
exitCode?: number;
|
|
9
|
-
hint?: string | null;
|
|
10
|
-
statusCode?: number | null;
|
|
11
|
-
});
|
|
12
|
-
}
|
|
1
|
+
export { R as CliError, R as RemixError } from './cliError-Bels0ULL.js';
|
|
13
2
|
|
|
14
3
|
declare const REMIX_ERROR_CODES: {
|
|
15
4
|
readonly REPO_LOCK_HELD: "REPO_LOCK_HELD";
|
|
@@ -20,4 +9,4 @@ declare const REMIX_ERROR_CODES: {
|
|
|
20
9
|
};
|
|
21
10
|
type RemixErrorCode = (typeof REMIX_ERROR_CODES)[keyof typeof REMIX_ERROR_CODES];
|
|
22
11
|
|
|
23
|
-
export {
|
|
12
|
+
export { REMIX_ERROR_CODES, type RemixErrorCode };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { CliError,
|
|
1
|
+
export { R as CliError, R as RemixError } from './cliError-Bels0ULL.js';
|
|
2
|
+
export { REMIX_ERROR_CODES, RemixErrorCode } from './errors.js';
|
|
2
3
|
export { CoreConfig, ResolveConfigOptions, configSchema, resolveConfig } from './config.js';
|
|
3
4
|
export { S as SessionStore, a as StoredSession, W as WithRefreshLock, c as createRefreshLock, b as createStoredSessionTokenProvider, s as shouldRefreshSoon, d as storedSessionSchema } from './tokenProvider-BP3YfJHm.js';
|
|
4
|
-
export { createDefaultRefreshLock, createLocalSessionStore, createRemixAuthHelpers, defaultSessionFilePath, isInvalidGrantError, isNetworkError } from './auth.js';
|
|
5
|
+
export { RemixAuthContinuationError, WorkosAuthChallenge, WorkosContinuationInput, createDefaultRefreshLock, createLocalSessionStore, createRemixAuthHelpers, defaultSessionFilePath, isInvalidGrantError, isNetworkError } from './auth.js';
|
|
5
6
|
export { AgentMemoryItem, AgentMemoryKind, AgentMemorySearchItem, AgentMemorySearchResponse, AgentMemorySummary, AgentMemoryTimelineResponse, ApiClient, AppContext, AppContextAccessPath, AppPreviewExpectedKind, AppPreviewProcessStatus, AppPreviewQuery, AppPreviewResponse, AppReconcileResponse, AppSandboxCommandRun, AppShareLinkSummary, Bundle, BundlePlatform, BundleStatus, ChangeStepDiffResponse, CreateAppShareLinkPayload, DetectProjectRuntimeTargetsPayload, ImportProjectRuntimeEnvPayload, InitiateBundleRequest, InvitationRecord, MergeRequest, MergeRequestReview, MergeRequestStatus, MobileQrPayloads, ProjectRuntimeEnvMetadata, ProjectRuntimeEnvScope, ProjectRuntimeTargetMetadata, ProjectRuntimeTargetScope, ProjectTrigger, ProjectTriggerPayload, ProjectTriggerScope, ProjectTriggerStep, ProjectTriggerStepPayload, ReconcilePreflightResponse, ResolveProjectRuntimeEnvForLocalPullResponse, RunAppRuntimeTargetPayload, RunAppSandboxCommandPayload, RunAppTriggerEventPayload, RunAppTriggerPayload, RuntimeCommandKind, RuntimeTargetKind, SetProjectRuntimeEnvPayload, SetProjectRuntimeTargetPayload, SyncLocalResponse, SyncUpstreamResponse, TriggerEventMetadata, TriggerEventSource, TriggerIntegrationStatus, TriggerMode, TriggerRun, TriggerStepRun, TriggerStepType, UpdateProjectTriggerPayload, createApiClient } from './api.js';
|
|
6
7
|
import 'zod';
|
|
7
8
|
import './contracts-DTeSJnoC.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createApiClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UN3Q7P5E.js";
|
|
4
4
|
import {
|
|
5
|
+
RemixAuthContinuationError,
|
|
5
6
|
createDefaultRefreshLock,
|
|
6
7
|
createLocalSessionStore,
|
|
7
8
|
createRefreshLock,
|
|
@@ -12,7 +13,7 @@ import {
|
|
|
12
13
|
isNetworkError,
|
|
13
14
|
shouldRefreshSoon,
|
|
14
15
|
storedSessionSchema
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PDX2IQJO.js";
|
|
16
17
|
import {
|
|
17
18
|
configSchema,
|
|
18
19
|
resolveConfig
|
|
@@ -27,6 +28,7 @@ import {
|
|
|
27
28
|
export {
|
|
28
29
|
RemixError as CliError,
|
|
29
30
|
REMIX_ERROR_CODES,
|
|
31
|
+
RemixAuthContinuationError,
|
|
30
32
|
RemixError,
|
|
31
33
|
configSchema,
|
|
32
34
|
createApiClient,
|