@remixhq/core 0.1.41 → 0.1.43

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 CHANGED
@@ -416,6 +416,7 @@ type AppPreviewQuery = {
416
416
  environment?: string;
417
417
  autostart?: boolean;
418
418
  probe?: "metadata" | "full";
419
+ targetKind?: RuntimeTargetKind;
419
420
  };
420
421
  type AppShareLinkSummary = {
421
422
  id: string;
@@ -431,6 +432,10 @@ type MobileQrPayloads = {
431
432
  ios?: string | null;
432
433
  android?: string | null;
433
434
  };
435
+ type MobileMetroBundleUrls = {
436
+ ios?: string | null;
437
+ android?: string | null;
438
+ };
434
439
  type AppPreviewResponse = {
435
440
  kind: "url";
436
441
  appId: string;
@@ -456,6 +461,7 @@ type AppPreviewResponse = {
456
461
  qrPayload: string;
457
462
  tunnelUrl: string | null;
458
463
  platformQrPayloads?: MobileQrPayloads;
464
+ metroBundleUrls?: MobileMetroBundleUrls;
459
465
  status: AppPreviewProcessStatus;
460
466
  } | {
461
467
  kind: "logs";
@@ -909,6 +915,8 @@ type ApiClient = {
909
915
  }): Promise<Json>;
910
916
  importFromGithubFirstParty(payload: {
911
917
  repoFullName: string;
918
+ installationId?: number;
919
+ githubRepoId?: number;
912
920
  branch?: string;
913
921
  path?: string;
914
922
  appName?: string;
@@ -921,6 +929,34 @@ type ApiClient = {
921
929
  defaultBranch?: string;
922
930
  repoFingerprint?: string;
923
931
  }): Promise<Json>;
932
+ getGithubStatus(): Promise<Json>;
933
+ startGithubOAuth(): Promise<Json>;
934
+ getGithubInstallUrl(): Promise<Json>;
935
+ syncGithubInstallations(): Promise<Json>;
936
+ listGithubInstallations(): Promise<Json>;
937
+ listGithubRepositories(installationId: number): Promise<Json>;
938
+ linkAppGithubSource(appId: string, payload: {
939
+ installationId: number;
940
+ githubRepoId?: number;
941
+ repoFullName: string;
942
+ branch: string;
943
+ path?: string;
944
+ defaultBranch?: string;
945
+ remoteUrl?: string;
946
+ repoFingerprint?: string;
947
+ headCommitHash?: string;
948
+ }): Promise<Json>;
949
+ getAppGithubPullRequest(appId: string): Promise<Json>;
950
+ createAppGithubPullRequest(appId: string, payload?: {
951
+ title?: string;
952
+ body?: string;
953
+ baseBranch?: string;
954
+ draft?: boolean;
955
+ }): Promise<Json>;
956
+ updateAppGithubPullRequest(appId: string, payload?: {
957
+ title?: string;
958
+ body?: string;
959
+ }): Promise<Json>;
924
960
  forkApp(appId: string, payload?: {
925
961
  name?: string;
926
962
  platform?: string;
package/dist/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-Y2QPVJFH.js";
3
+ } from "./chunk-OSHNZWYW.js";
4
4
  import "./chunk-7XJGOKEO.js";
5
5
  export {
6
6
  createApiClient
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-QCRTVR5N.js";
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,
@@ -48,6 +48,7 @@ function buildAppPreviewQuery(params) {
48
48
  if (params?.environment) qs.set("environment", params.environment);
49
49
  if (params?.autostart !== void 0) qs.set("autostart", params.autostart ? "true" : "false");
50
50
  if (params?.probe) qs.set("probe", params.probe);
51
+ if (params?.targetKind) qs.set("targetKind", params.targetKind);
51
52
  return suffix(qs);
52
53
  }
53
54
  function buildAppListQuery(params) {
@@ -284,6 +285,25 @@ function createApiClient(config, opts) {
284
285
  body: JSON.stringify(payload ?? {})
285
286
  }),
286
287
  getAppPreview: (appId, params) => request(`/v1/apps/${encodeURIComponent(appId)}/preview${buildAppPreviewQuery(params)}`, { method: "GET" }),
288
+ getGithubStatus: () => request("/v1/github/status", { method: "GET" }),
289
+ startGithubOAuth: () => request("/v1/github/oauth/start", { method: "GET" }),
290
+ getGithubInstallUrl: () => request("/v1/github/install-url", { method: "GET" }),
291
+ syncGithubInstallations: () => request("/v1/github/installations/sync", { method: "POST" }),
292
+ listGithubInstallations: () => request("/v1/github/installations", { method: "GET" }),
293
+ listGithubRepositories: (installationId) => request(`/v1/github/installations/${encodeURIComponent(String(installationId))}/repositories`, { method: "GET" }),
294
+ linkAppGithubSource: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/github/link`, {
295
+ method: "POST",
296
+ body: JSON.stringify(payload)
297
+ }),
298
+ getAppGithubPullRequest: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/github/pull-request`, { method: "GET" }),
299
+ createAppGithubPullRequest: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/github/pull-request`, {
300
+ method: "POST",
301
+ body: JSON.stringify(payload ?? {})
302
+ }),
303
+ updateAppGithubPullRequest: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/github/pull-request`, {
304
+ method: "PATCH",
305
+ body: JSON.stringify(payload ?? {})
306
+ }),
287
307
  createAppShareLink: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/share-links`, {
288
308
  method: "POST",
289
309
  body: JSON.stringify(payload ?? {})
@@ -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
- const path3 = params.state ? "/v1/auth/cli/login-url" : "/v1/auth/login-url";
338
- const pkce = params.state ? createPkcePair() : null;
339
- const body = params.state ? { returnTo: params.redirectTo, state: params.state, codeChallenge: pkce?.codeChallenge } : { returnTo: normalizeBrowserReturnTo(params.redirectTo) };
340
- const result = await postBackend(config, path3, body, params.state ? void 0 : { credentials: "include" });
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
  };
@@ -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
- 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
- }
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 { RemixError as CliError, REMIX_ERROR_CODES, RemixError, type RemixErrorCode };
12
+ export { REMIX_ERROR_CODES, type RemixErrorCode };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- export { CliError, REMIX_ERROR_CODES, CliError as RemixError, RemixErrorCode } from './errors.js';
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-Y2QPVJFH.js";
3
+ } from "./chunk-OSHNZWYW.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-QCRTVR5N.js";
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remixhq/core",
3
- "version": "0.1.41",
3
+ "version": "0.1.43",
4
4
  "description": "Remix core library",
5
5
  "homepage": "https://github.com/RemixDotOne/remix-core",
6
6
  "license": "MIT",