create-mastra 1.39.1-alpha.2 → 1.40.0-alpha.4
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-CSviCYXh-CboSV6gD.js → api-BkUGttRB-CFkaHXG2.js} +2 -2
- package/dist/api-CXLd7dkW-DwcV9wMs.js +1 -0
- package/dist/{client-B7vqie2S-CGxnd8kP.js → client-CKs2N-Pd-CM1O2G7j.js} +2 -2
- package/dist/{credentials-CYOAlKRZ-BGpZoM5m.js → credentials-BV9JpjhI-OPP2mOdJ.js} +19 -9
- package/dist/{credentials-Dd5ECZBX-BM-JBgiK.js → credentials-GNkkLs-b-E1keXpZi.js} +1 -1
- package/dist/index.js +22 -18
- package/package.json +3 -3
- package/dist/api-B0_-zO-S-BrrR8KES.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as createApiClient, s as throwApiError } from "./client-
|
|
2
|
-
// ../cli/dist/api-
|
|
1
|
+
import { i as createApiClient, s as throwApiError } from "./client-CKs2N-Pd-CM1O2G7j.js";
|
|
2
|
+
// ../cli/dist/api-BkUGttRB.js
|
|
3
3
|
async function fetchOrgs(token) {
|
|
4
4
|
const { data, error, response } = await createApiClient(token).GET("/v1/auth/orgs");
|
|
5
5
|
if (error) throwApiError("Failed to fetch orgs", response.status, error.detail);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as fetchOrgs } from "./api-BkUGttRB-CFkaHXG2.js";
|
|
@@ -386,7 +386,7 @@ function removeTrailingSlash(url) {
|
|
|
386
386
|
if (url.endsWith("/")) return url.substring(0, url.length - 1);
|
|
387
387
|
return url;
|
|
388
388
|
}
|
|
389
|
-
// ../cli/dist/client-
|
|
389
|
+
// ../cli/dist/client-CKs2N-Pd.js
|
|
390
390
|
const MASTRA_PLATFORM_API_URL = process.env.MASTRA_PLATFORM_API_URL || "https://platform.mastra.ai";
|
|
391
391
|
const MASTRA_PROJECTS_URL = process.env.MASTRA_PROJECTS_URL || "https://projects.mastra.ai";
|
|
392
392
|
/**
|
|
@@ -460,7 +460,7 @@ async function authenticatedFetch(input, init) {
|
|
|
460
460
|
if (response.status !== 401 || !_currentToken) return response;
|
|
461
461
|
if (!_refreshInFlight) _refreshInFlight = (async () => {
|
|
462
462
|
try {
|
|
463
|
-
const { tryRefreshToken, loadCredentials } = await import("./credentials-
|
|
463
|
+
const { tryRefreshToken, loadCredentials } = await import("./credentials-GNkkLs-b-E1keXpZi.js");
|
|
464
464
|
const creds = await loadCredentials();
|
|
465
465
|
if (!creds) throw new Error("No credentials");
|
|
466
466
|
const newToken = await tryRefreshToken(creds);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as MASTRA_PLATFORM_API_URL } from "./client-
|
|
1
|
+
import { t as MASTRA_PLATFORM_API_URL } from "./client-CKs2N-Pd-CM1O2G7j.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import "node:path";
|
|
4
4
|
import process$1, { stdin, stdout } from "node:process";
|
|
@@ -1144,7 +1144,7 @@ ${r ? styleText("cyan", S_BAR_END) : ""}
|
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
1146
|
}).prompt();
|
|
1147
|
-
// ../cli/dist/credentials-
|
|
1147
|
+
// ../cli/dist/credentials-BV9JpjhI.js
|
|
1148
1148
|
const CREDENTIALS_DIR = join(homedir(), ".mastra");
|
|
1149
1149
|
const CREDENTIALS_FILE = join(CREDENTIALS_DIR, "credentials.json");
|
|
1150
1150
|
var LoginCancelledError = class extends Error {
|
|
@@ -1197,14 +1197,24 @@ function isWSL() {
|
|
|
1197
1197
|
return false;
|
|
1198
1198
|
}
|
|
1199
1199
|
}
|
|
1200
|
-
|
|
1200
|
+
/**
|
|
1201
|
+
* Parses `url` and returns its normalized form. Throws unless it is an http(s) URL, so that values
|
|
1202
|
+
* such as `file:`, `javascript:` or option-like strings (`--foo`) never reach the OS opener.
|
|
1203
|
+
*/
|
|
1204
|
+
function toBrowserUrl(url) {
|
|
1205
|
+
let parsed;
|
|
1206
|
+
try {
|
|
1207
|
+
parsed = new URL(url);
|
|
1208
|
+
} catch {
|
|
1209
|
+
throw new Error(`Refusing to open invalid URL: ${url}`);
|
|
1210
|
+
}
|
|
1211
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new Error(`Refusing to open non-http(s) URL: ${url}`);
|
|
1212
|
+
return parsed.href;
|
|
1213
|
+
}
|
|
1214
|
+
function openBrowser(rawUrl) {
|
|
1215
|
+
const url = toBrowserUrl(rawUrl);
|
|
1201
1216
|
if (process.platform === "darwin") execFileSync("open", [url]);
|
|
1202
|
-
else if (process.platform === "win32") execFileSync("
|
|
1203
|
-
"/c",
|
|
1204
|
-
"start",
|
|
1205
|
-
"",
|
|
1206
|
-
url
|
|
1207
|
-
]);
|
|
1217
|
+
else if (process.platform === "win32") execFileSync("rundll32.exe", ["url.dll,FileProtocolHandler", url]);
|
|
1208
1218
|
else if (isWSL()) execFileSync("powershell.exe", [
|
|
1209
1219
|
"-NoProfile",
|
|
1210
1220
|
"-NonInteractive",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { i as loadCredentials, s as tryRefreshToken } from "./credentials-
|
|
1
|
+
export { i as loadCredentials, s as tryRefreshToken } from "./credentials-BV9JpjhI-OPP2mOdJ.js";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
import { _ as __commonJSMin, a as openBrowser, c as cancel, d as outro, f as password, g as isCancel, h as text, l as log, m as spinner, n as getCurrentOrgId, o as setCurrentOrgId, p as select, r as getToken, t as LoginCancelledError, u as note, v as __require, y as __toESM } from "./credentials-
|
|
3
|
-
import { t as fetchOrgs } from "./api-
|
|
4
|
-
import { a as extractApiErrorDetail, n as MASTRA_PROJECTS_URL, o as platformFetch, r as authHeaders, t as MASTRA_PLATFORM_API_URL } from "./client-
|
|
2
|
+
import { _ as __commonJSMin, a as openBrowser, c as cancel, d as outro, f as password, g as isCancel, h as text, l as log, m as spinner, n as getCurrentOrgId, o as setCurrentOrgId, p as select, r as getToken, t as LoginCancelledError, u as note, v as __require, y as __toESM } from "./credentials-BV9JpjhI-OPP2mOdJ.js";
|
|
3
|
+
import { t as fetchOrgs } from "./api-BkUGttRB-CFkaHXG2.js";
|
|
4
|
+
import { a as extractApiErrorDetail, n as MASTRA_PROJECTS_URL, o as platformFetch, r as authHeaders, t as MASTRA_PLATFORM_API_URL } from "./client-CKs2N-Pd-CM1O2G7j.js";
|
|
5
5
|
import { EventEmitter, addAbortListener, on, once, setMaxListeners } from "node:events";
|
|
6
6
|
import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
|
|
7
7
|
import path, { basename, delimiter, dirname, isAbsolute, normalize, resolve } from "node:path";
|
|
@@ -3037,7 +3037,7 @@ const { program: program$1, createCommand, createArgument, createOption, Command
|
|
|
3037
3037
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
3038
3038
|
exports.InvalidOptionArgumentError = InvalidArgumentError;
|
|
3039
3039
|
})))(), 1)).default;
|
|
3040
|
-
// ../cli/dist/orgs-
|
|
3040
|
+
// ../cli/dist/orgs-U8xs5uGQ.js
|
|
3041
3041
|
var OrgSelectionCancelledError = class extends Error {
|
|
3042
3042
|
constructor() {
|
|
3043
3043
|
super("Organization selection cancelled");
|
|
@@ -18331,7 +18331,7 @@ var require_yocto_spinner = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
18331
18331
|
return new YoctoSpinner(options);
|
|
18332
18332
|
};
|
|
18333
18333
|
}));
|
|
18334
|
-
// ../cli/dist/analytics-
|
|
18334
|
+
// ../cli/dist/analytics-DcvNOF6c.js
|
|
18335
18335
|
const CREATE_LLM_PROVIDERS = [
|
|
18336
18336
|
{
|
|
18337
18337
|
value: "mastra",
|
|
@@ -20427,7 +20427,7 @@ var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20427
20427
|
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
20428
20428
|
};
|
|
20429
20429
|
}));
|
|
20430
|
-
// ../cli/dist/create-
|
|
20430
|
+
// ../cli/dist/create-DlrSzNAx.js
|
|
20431
20431
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
20432
20432
|
var import_yocto_spinner = /* @__PURE__ */ __toESM(require_yocto_spinner(), 1);
|
|
20433
20433
|
var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
|
|
@@ -20611,17 +20611,21 @@ async function request(token, orgId, path, init = {}, signal) {
|
|
|
20611
20611
|
return await res.json();
|
|
20612
20612
|
}
|
|
20613
20613
|
/**
|
|
20614
|
-
* Create a Gateway API key
|
|
20615
|
-
*
|
|
20614
|
+
* Create a Gateway API key. The server picks the kind: an organization (v2) key with a `keyId`
|
|
20615
|
+
* for an organization in the Gateway v2 rollout, otherwise a Gateway project key without one.
|
|
20616
20616
|
*/
|
|
20617
20617
|
async function createGatewayApiKey(token, orgId, label, signal) {
|
|
20618
|
-
|
|
20618
|
+
const result = await request(token, orgId, "/v1/gateway/projects/provision", {
|
|
20619
20619
|
method: "POST",
|
|
20620
20620
|
body: JSON.stringify({
|
|
20621
20621
|
name: label,
|
|
20622
20622
|
keyLabel: label
|
|
20623
20623
|
})
|
|
20624
|
-
}, signal)
|
|
20624
|
+
}, signal);
|
|
20625
|
+
return typeof result.keyId === "string" && result.keyId ? {
|
|
20626
|
+
apiKey: result.apiKey,
|
|
20627
|
+
keyId: result.keyId
|
|
20628
|
+
} : { apiKey: result.apiKey };
|
|
20625
20629
|
}
|
|
20626
20630
|
/** Revoke an organization key, e.g. one created for a project that was never written. */
|
|
20627
20631
|
async function revokeGatewayApiKey(token, orgId, keyId) {
|
|
@@ -21678,8 +21682,8 @@ const create = async (args) => {
|
|
|
21678
21682
|
});
|
|
21679
21683
|
};
|
|
21680
21684
|
async function setUpGateway({ token, org, projectName, signal }) {
|
|
21681
|
-
const spinner$
|
|
21682
|
-
spinner$
|
|
21685
|
+
const spinner$1 = spinner();
|
|
21686
|
+
spinner$1.start("Setting up your Gateway key...");
|
|
21683
21687
|
let spinning = true;
|
|
21684
21688
|
let key;
|
|
21685
21689
|
try {
|
|
@@ -21690,7 +21694,7 @@ async function setUpGateway({ token, org, projectName, signal }) {
|
|
|
21690
21694
|
} catch (error) {
|
|
21691
21695
|
if (signal.aborted) throw error;
|
|
21692
21696
|
}
|
|
21693
|
-
spinner$
|
|
21697
|
+
spinner$1.stop(`Created a Gateway key in ${org.orgName}.`);
|
|
21694
21698
|
spinning = false;
|
|
21695
21699
|
let openedDashboard = false;
|
|
21696
21700
|
if (credits) try {
|
|
@@ -21713,7 +21717,7 @@ async function setUpGateway({ token, org, projectName, signal }) {
|
|
|
21713
21717
|
openedDashboard
|
|
21714
21718
|
};
|
|
21715
21719
|
} catch (error) {
|
|
21716
|
-
if (spinning) spinner$
|
|
21720
|
+
if (spinning) spinner$1.stop("Could not set up a Gateway key.");
|
|
21717
21721
|
if (signal.aborted) {
|
|
21718
21722
|
await discardGatewayKey({
|
|
21719
21723
|
token,
|
|
@@ -21927,16 +21931,16 @@ async function resolveTemplate(mode, template) {
|
|
|
21927
21931
|
if (typeof template !== "string") throw new Error("No template selected");
|
|
21928
21932
|
const githubUrl = parseGitHubRepositoryUrl(template);
|
|
21929
21933
|
if (githubUrl) {
|
|
21930
|
-
const spinner$
|
|
21931
|
-
spinner$
|
|
21934
|
+
const spinner$2 = spinner();
|
|
21935
|
+
spinner$2.start("Validating GitHub repository...");
|
|
21932
21936
|
const validation = await validateGitHubProject(githubUrl);
|
|
21933
21937
|
if (!validation.isValid) {
|
|
21934
|
-
spinner$
|
|
21938
|
+
spinner$2.stop("Validation failed");
|
|
21935
21939
|
log.error("This does not appear to be a valid Mastra project:");
|
|
21936
21940
|
validation.errors.forEach((error) => log.error(` - ${error}`));
|
|
21937
21941
|
throw new Error("Invalid Mastra project");
|
|
21938
21942
|
}
|
|
21939
|
-
spinner$
|
|
21943
|
+
spinner$2.stop("Valid Mastra project ✓");
|
|
21940
21944
|
return createFromGitHubUrl(githubUrl);
|
|
21941
21945
|
}
|
|
21942
21946
|
if (looksLikeGitHubUrl(template)) throw new Error("Invalid GitHub repository URL. Use https://github.com/<owner>/<repository>.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mastra",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.40.0-alpha.4",
|
|
4
4
|
"description": "Create Mastra apps with one command",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"tsdown": "0.23.1",
|
|
37
37
|
"typescript": "^7.0.2",
|
|
38
38
|
"vitest": "5.1.0",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
39
|
+
"@internal/lint": "0.0.149",
|
|
40
|
+
"mastra": "^1.40.0-alpha.4"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=22.13.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { t as fetchOrgs } from "./api-CSviCYXh-CboSV6gD.js";
|