@scalar/cli 1.9.8 → 2.0.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/README.md +25 -7
- package/docs.html +161 -116
- package/index.js +589 -402
- package/package.json +11 -11
package/index.js
CHANGED
|
@@ -6890,14 +6890,14 @@ var require_parser = __commonJS({
|
|
|
6890
6890
|
case "scalar":
|
|
6891
6891
|
case "single-quoted-scalar":
|
|
6892
6892
|
case "double-quoted-scalar": {
|
|
6893
|
-
const
|
|
6893
|
+
const fs22 = this.flowScalar(this.type);
|
|
6894
6894
|
if (atNextItem || it.value) {
|
|
6895
|
-
map2.items.push({ start, key:
|
|
6895
|
+
map2.items.push({ start, key: fs22, sep: [] });
|
|
6896
6896
|
this.onKeyLine = true;
|
|
6897
6897
|
} else if (it.sep) {
|
|
6898
|
-
this.stack.push(
|
|
6898
|
+
this.stack.push(fs22);
|
|
6899
6899
|
} else {
|
|
6900
|
-
Object.assign(it, { key:
|
|
6900
|
+
Object.assign(it, { key: fs22, sep: [] });
|
|
6901
6901
|
this.onKeyLine = true;
|
|
6902
6902
|
}
|
|
6903
6903
|
return;
|
|
@@ -7025,13 +7025,13 @@ var require_parser = __commonJS({
|
|
|
7025
7025
|
case "scalar":
|
|
7026
7026
|
case "single-quoted-scalar":
|
|
7027
7027
|
case "double-quoted-scalar": {
|
|
7028
|
-
const
|
|
7028
|
+
const fs22 = this.flowScalar(this.type);
|
|
7029
7029
|
if (!it || it.value)
|
|
7030
|
-
fc.items.push({ start: [], key:
|
|
7030
|
+
fc.items.push({ start: [], key: fs22, sep: [] });
|
|
7031
7031
|
else if (it.sep)
|
|
7032
|
-
this.stack.push(
|
|
7032
|
+
this.stack.push(fs22);
|
|
7033
7033
|
else
|
|
7034
|
-
Object.assign(it, { key:
|
|
7034
|
+
Object.assign(it, { key: fs22, sep: [] });
|
|
7035
7035
|
return;
|
|
7036
7036
|
}
|
|
7037
7037
|
case "flow-map-end":
|
|
@@ -11822,7 +11822,7 @@ var require_parse2 = __commonJS({
|
|
|
11822
11822
|
var require_gray_matter = __commonJS({
|
|
11823
11823
|
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js"(exports2, module2) {
|
|
11824
11824
|
"use strict";
|
|
11825
|
-
var
|
|
11825
|
+
var fs22 = __require("fs");
|
|
11826
11826
|
var sections = require_section_matter();
|
|
11827
11827
|
var defaults = require_defaults();
|
|
11828
11828
|
var stringify = require_stringify3();
|
|
@@ -11906,7 +11906,7 @@ var require_gray_matter = __commonJS({
|
|
|
11906
11906
|
return stringify(file2, data, options2);
|
|
11907
11907
|
};
|
|
11908
11908
|
matter2.read = function(filepath, options2) {
|
|
11909
|
-
const str2 =
|
|
11909
|
+
const str2 = fs22.readFileSync(filepath, "utf8");
|
|
11910
11910
|
const file2 = matter2(str2, options2);
|
|
11911
11911
|
file2.path = filepath;
|
|
11912
11912
|
return file2;
|
|
@@ -69163,18 +69163,18 @@ Visit https://nodejs.org to download the latest version.`
|
|
|
69163
69163
|
}
|
|
69164
69164
|
|
|
69165
69165
|
// src/program.ts
|
|
69166
|
-
import { Command as
|
|
69166
|
+
import { Command as Command51 } from "commander";
|
|
69167
69167
|
|
|
69168
69168
|
// package.json
|
|
69169
69169
|
var name = "@scalar/cli";
|
|
69170
|
-
var version = "
|
|
69170
|
+
var version = "2.0.0";
|
|
69171
69171
|
var bin = {
|
|
69172
69172
|
scalar: "./dist/index.js",
|
|
69173
69173
|
"scalar-cli": "./dist/index.js"
|
|
69174
69174
|
};
|
|
69175
69175
|
|
|
69176
69176
|
// src/domains/schema/index.ts
|
|
69177
|
-
import { Command as
|
|
69177
|
+
import { Command as Command7 } from "commander";
|
|
69178
69178
|
|
|
69179
69179
|
// src/domains/schema/delete.ts
|
|
69180
69180
|
import { select } from "@clack/prompts";
|
|
@@ -86697,6 +86697,9 @@ var siteDeploySchema = entitySchema.extend({
|
|
|
86697
86697
|
projectUid: nanoidSchema,
|
|
86698
86698
|
subpaths: subpathSchema.array().default([])
|
|
86699
86699
|
}).meta({ id: "site-deploy" });
|
|
86700
|
+
var searchConfigResponseSchema = external_exports.object({
|
|
86701
|
+
subpaths: subpathSchema.array()
|
|
86702
|
+
}).meta({ id: "search-config-response" });
|
|
86700
86703
|
|
|
86701
86704
|
// ../../packages/entities/dist/login-portals/customization.js
|
|
86702
86705
|
var loginPortalEmailSchema = external_exports.object({
|
|
@@ -86982,7 +86985,7 @@ var monthlyUsageSchema = zod_default.object({
|
|
|
86982
86985
|
messages: zod_default.number()
|
|
86983
86986
|
}).meta({ id: "monthly-usage" });
|
|
86984
86987
|
|
|
86985
|
-
// ../../node_modules/.pnpm/@scalar+helpers@0.8.
|
|
86988
|
+
// ../../node_modules/.pnpm/@scalar+helpers@0.8.2/node_modules/@scalar/helpers/dist/http/http-methods.js
|
|
86986
86989
|
var HTTP_METHODS = ["delete", "get", "head", "options", "patch", "post", "put", "trace"];
|
|
86987
86990
|
var httpMethods = Object.freeze(new Set(HTTP_METHODS));
|
|
86988
86991
|
|
|
@@ -87724,11 +87727,22 @@ var docsProjectRepositorySchema = external_exports.discriminatedUnion("provider"
|
|
|
87724
87727
|
githubRepositorySchema,
|
|
87725
87728
|
bitbucketRepositorySchema
|
|
87726
87729
|
]);
|
|
87730
|
+
var remoteActivitySchema = external_exports.object({
|
|
87731
|
+
at: timestampSchema,
|
|
87732
|
+
branch: external_exports.string().nullable(),
|
|
87733
|
+
sha: external_exports.string().nullable(),
|
|
87734
|
+
actorName: external_exports.string().nullable()
|
|
87735
|
+
}).meta({ id: "docs-project-remote-activity" });
|
|
87727
87736
|
var docsProjectSchema = sharedProjectSchema.extend({
|
|
87728
87737
|
slug: slugSchema,
|
|
87729
87738
|
publishStatus: external_exports.string().default(""),
|
|
87730
87739
|
publishMessage: external_exports.string().default(""),
|
|
87731
|
-
repository: docsProjectRepositorySchema
|
|
87740
|
+
repository: docsProjectRepositorySchema,
|
|
87741
|
+
/**
|
|
87742
|
+
* `.catch(undefined)` so a malformed bump degrades to "no signal" instead
|
|
87743
|
+
* of failing the schema parse inside every subscribed dashboard.
|
|
87744
|
+
*/
|
|
87745
|
+
remoteActivity: remoteActivitySchema.optional().catch(void 0)
|
|
87732
87746
|
}).meta({ id: "docs-project" });
|
|
87733
87747
|
function isGithubBackedDocsProject(project) {
|
|
87734
87748
|
return project.repository.provider === "github";
|
|
@@ -87785,14 +87799,19 @@ var signupDataSchema = external_exports.object({
|
|
|
87785
87799
|
yjsReferences: external_exports.record(external_exports.string(), external_exports.string())
|
|
87786
87800
|
}).meta({ id: "signup-data" });
|
|
87787
87801
|
|
|
87802
|
+
// ../../packages/entities/dist/sdk/helpers.js
|
|
87803
|
+
import semver3 from "semver";
|
|
87804
|
+
|
|
87788
87805
|
// ../../packages/entities/dist/sdk/scalar-config.js
|
|
87789
87806
|
var import_yaml = __toESM(require_dist(), 1);
|
|
87807
|
+
import semver4 from "semver";
|
|
87790
87808
|
|
|
87791
87809
|
// ../../packages/entities/dist/sdk/schema.js
|
|
87792
87810
|
var SdkLanguage;
|
|
87793
87811
|
(function(SdkLanguage2) {
|
|
87794
87812
|
SdkLanguage2["Typescript"] = "typescript";
|
|
87795
87813
|
SdkLanguage2["Python"] = "python";
|
|
87814
|
+
SdkLanguage2["Cli"] = "cli";
|
|
87796
87815
|
SdkLanguage2["CSharp"] = "csharp";
|
|
87797
87816
|
SdkLanguage2["Java"] = "java";
|
|
87798
87817
|
SdkLanguage2["Ruby"] = "ruby";
|
|
@@ -87807,6 +87826,7 @@ var SdkLanguage;
|
|
|
87807
87826
|
var SdkLanguageLabels = {
|
|
87808
87827
|
[SdkLanguage.Typescript]: "Typescript",
|
|
87809
87828
|
[SdkLanguage.Python]: "Python",
|
|
87829
|
+
[SdkLanguage.Cli]: "CLI",
|
|
87810
87830
|
[SdkLanguage.CSharp]: "C#",
|
|
87811
87831
|
[SdkLanguage.Java]: "Java",
|
|
87812
87832
|
[SdkLanguage.Ruby]: "Ruby",
|
|
@@ -87818,32 +87838,74 @@ var SdkLanguageLabels = {
|
|
|
87818
87838
|
[SdkLanguage.Cpp]: "C++",
|
|
87819
87839
|
[SdkLanguage.Dart]: "Dart"
|
|
87820
87840
|
};
|
|
87821
|
-
var
|
|
87822
|
-
|
|
87823
|
-
|
|
87824
|
-
|
|
87841
|
+
var SdkLanguageExperimental = {
|
|
87842
|
+
[SdkLanguage.Typescript]: false,
|
|
87843
|
+
[SdkLanguage.Python]: false,
|
|
87844
|
+
[SdkLanguage.Cli]: false,
|
|
87845
|
+
[SdkLanguage.CSharp]: true,
|
|
87846
|
+
[SdkLanguage.Java]: true,
|
|
87847
|
+
[SdkLanguage.Ruby]: true,
|
|
87848
|
+
[SdkLanguage.Php]: true,
|
|
87849
|
+
[SdkLanguage.Go]: true,
|
|
87850
|
+
[SdkLanguage.Rust]: true,
|
|
87851
|
+
[SdkLanguage.Kotlin]: true,
|
|
87852
|
+
[SdkLanguage.Swift]: true,
|
|
87853
|
+
[SdkLanguage.Cpp]: true,
|
|
87854
|
+
[SdkLanguage.Dart]: true
|
|
87855
|
+
};
|
|
87856
|
+
var sdkTargetDestinationSchema = external_exports.object({
|
|
87857
|
+
provider: external_exports.literal("github").default("github"),
|
|
87858
|
+
linkedBy: external_exports.string(),
|
|
87859
|
+
/**
|
|
87860
|
+
* GitHub App installation that grants push access. Optional because legacy
|
|
87861
|
+
* links predate it and it is derivable from `linkedBy` + repo at sync time.
|
|
87862
|
+
*/
|
|
87863
|
+
installationId: external_exports.number().int().optional(),
|
|
87864
|
+
id: external_exports.number().int(),
|
|
87865
|
+
/** "owner/repo" */
|
|
87866
|
+
name: external_exports.string().min(2),
|
|
87867
|
+
baseBranch: external_exports.string().min(1).default("main"),
|
|
87868
|
+
publishOnMerge: external_exports.boolean().default(false),
|
|
87869
|
+
prComments: external_exports.boolean().default(false),
|
|
87870
|
+
expired: external_exports.boolean().default(false)
|
|
87871
|
+
}).meta({ id: "sdk-target-destination" });
|
|
87872
|
+
var sdkTargetSchema = external_exports.object({
|
|
87873
|
+
language: external_exports.enum(SdkLanguage),
|
|
87874
|
+
slug: slugSchema,
|
|
87875
|
+
destination: sdkTargetDestinationSchema.nullable().default(null)
|
|
87876
|
+
}).meta({ id: "sdk-target" });
|
|
87877
|
+
var sdkVersionTargetStateSchema = external_exports.object({
|
|
87825
87878
|
activeSync: external_exports.object({
|
|
87826
87879
|
repository: external_exports.string(),
|
|
87827
87880
|
pullRequest: external_exports.number(),
|
|
87828
87881
|
commitHash: external_exports.string()
|
|
87829
87882
|
}).optional(),
|
|
87830
87883
|
activeBuild: nanoidSchema.optional()
|
|
87884
|
+
}).meta({ id: "sdk-version-target-state" });
|
|
87885
|
+
var sdkVersionStatusSchema = external_exports.enum(["draft", "published"]);
|
|
87886
|
+
var sdkVersionSchema = external_exports.object({
|
|
87887
|
+
version: docVersionSchema,
|
|
87888
|
+
apiVersion: docVersionSchema,
|
|
87889
|
+
createdAt: timestampSchema.optional(),
|
|
87890
|
+
/** Draft while being edited; published once a build of it succeeds. */
|
|
87891
|
+
status: sdkVersionStatusSchema.default("published"),
|
|
87892
|
+
/** Config snapshot for this version. Defaults to `{}` so pre-migration docs still validate. */
|
|
87893
|
+
config: external_exports.string().default("{}"),
|
|
87894
|
+
/** Language targets this version ships, derived from `config`. */
|
|
87895
|
+
languages: external_exports.enum(SdkLanguage).array().default([]),
|
|
87896
|
+
publishedAt: timestampSchema.optional(),
|
|
87897
|
+
/** What created/last-touched this version, for display. */
|
|
87898
|
+
changeSource: external_exports.enum(["user", "api-version", "created"]).optional(),
|
|
87899
|
+
changeNote: external_exports.string().optional(),
|
|
87900
|
+
/** Active sync/build per language, for this version. */
|
|
87901
|
+
targets: external_exports.partialRecord(external_exports.enum(SdkLanguage), sdkVersionTargetStateSchema).default({})
|
|
87831
87902
|
}).meta({ id: "sdk-version" });
|
|
87832
|
-
var sdkRepositorySchema = external_exports.object({
|
|
87833
|
-
linkedBy: external_exports.string(),
|
|
87834
|
-
id: external_exports.number(),
|
|
87835
|
-
name: external_exports.string().min(2),
|
|
87836
|
-
baseBranch: external_exports.string().min(1).default("main")
|
|
87837
|
-
}).meta({ id: "sdk-repository" });
|
|
87838
87903
|
var sdkSchema = baseRegistrySchema.extend({
|
|
87839
87904
|
/**
|
|
87840
|
-
*
|
|
87841
|
-
*
|
|
87842
|
-
* moment.
|
|
87905
|
+
* The registry API this SDK is generated from. Null when unlinked — the SDK
|
|
87906
|
+
* keeps its versions/builds but can't build a new version until re-linked.
|
|
87843
87907
|
*/
|
|
87844
|
-
apiUid: nanoidSchema,
|
|
87845
|
-
/** Linked GitHub repository */
|
|
87846
|
-
repository: sdkRepositorySchema.nullable().default(null),
|
|
87908
|
+
apiUid: nanoidSchema.nullable(),
|
|
87847
87909
|
/**
|
|
87848
87910
|
* Current latest revision
|
|
87849
87911
|
* for SDK. Can be selected
|
|
@@ -87852,9 +87914,18 @@ var sdkSchema = baseRegistrySchema.extend({
|
|
|
87852
87914
|
currentVersion: nanoidSchema,
|
|
87853
87915
|
/** All versions available for SDK. */
|
|
87854
87916
|
versions: sdkVersionSchema.array().default([]),
|
|
87855
|
-
/**
|
|
87856
|
-
|
|
87857
|
-
|
|
87917
|
+
/**
|
|
87918
|
+
* Persistent per-language registry: every language the SDK has, each with its
|
|
87919
|
+
* registry slug + git destination. Survives across versions — destinations and
|
|
87920
|
+
* slugs persist even when a version drops a language. The *active* language set
|
|
87921
|
+
* is the latest published version's `languages`.
|
|
87922
|
+
*/
|
|
87923
|
+
targets: sdkTargetSchema.array().min(1),
|
|
87924
|
+
/**
|
|
87925
|
+
* @deprecated Config now lives per-version (`sdkVersionSchema.config`). Kept
|
|
87926
|
+
* optional for the migration/legacy path; new code reads the version config.
|
|
87927
|
+
*/
|
|
87928
|
+
config: external_exports.string().optional()
|
|
87858
87929
|
}).meta({ id: "sdk" });
|
|
87859
87930
|
var sdkBuildStatusSchema = external_exports.enum(["pending", "error", "generated"]).meta({ id: "sdk-build-status" });
|
|
87860
87931
|
var sdkGitStatusSchema = external_exports.enum(["pending", "error", "synced"]).meta({ id: "sdk-git-status" });
|
|
@@ -87875,33 +87946,44 @@ var sdkBuildGitSchema = external_exports.object({
|
|
|
87875
87946
|
pullRequest: external_exports.number(),
|
|
87876
87947
|
commitHash: external_exports.string()
|
|
87877
87948
|
}).optional().meta({ id: "sdk-build-git" });
|
|
87878
|
-
var
|
|
87879
|
-
|
|
87949
|
+
var sdkBuildTargetSchema = external_exports.object({
|
|
87950
|
+
/** SDK language to generate */
|
|
87951
|
+
language: external_exports.enum(SdkLanguage),
|
|
87952
|
+
/** Per-target published slug the artifact lands under */
|
|
87953
|
+
slug: slugSchema,
|
|
87880
87954
|
/** Build status */
|
|
87881
87955
|
buildStatus: sdkBuildStatusSchema,
|
|
87882
|
-
/** Additional build message
|
|
87956
|
+
/** Additional build message */
|
|
87883
87957
|
buildMessage: external_exports.string().optional(),
|
|
87884
87958
|
/** Git sync status */
|
|
87885
87959
|
gitStatus: sdkGitStatusSchema.optional(),
|
|
87886
87960
|
/** Additional git message */
|
|
87887
87961
|
gitMessage: external_exports.string().optional(),
|
|
87888
|
-
/**
|
|
87889
|
-
|
|
87962
|
+
/** Linked git repository name */
|
|
87963
|
+
repository: external_exports.string().nullable().optional(),
|
|
87964
|
+
/** Git sync commit and PR */
|
|
87965
|
+
gitSync: sdkBuildGitSchema
|
|
87966
|
+
}).meta({ id: "sdk-build-target" });
|
|
87967
|
+
var sdkBuildSchema = entitySchema.extend({
|
|
87968
|
+
teamUid: nanoidSchema,
|
|
87890
87969
|
/** SDK metadata on generation */
|
|
87891
87970
|
sdk: sdkbuildSdkSchema,
|
|
87892
87971
|
/** Original API used to generate SDK */
|
|
87893
87972
|
api: sdkBuildApiSchema,
|
|
87894
87973
|
/** Custom SDK config */
|
|
87895
87974
|
config: external_exports.string(),
|
|
87896
|
-
/** Linked git repository name */
|
|
87897
|
-
repository: external_exports.string().nullable().optional(),
|
|
87898
|
-
/** Git sync commit and PR */
|
|
87899
|
-
gitSync: sdkBuildGitSchema,
|
|
87900
|
-
/** Extended generation logs */
|
|
87901
|
-
generationLog: external_exports.string().optional(),
|
|
87902
87975
|
/** Should auto set active sdk version */
|
|
87903
|
-
autoBump: external_exports.boolean().default(false)
|
|
87976
|
+
autoBump: external_exports.boolean().default(false),
|
|
87977
|
+
/** Per-language build targets */
|
|
87978
|
+
targets: sdkBuildTargetSchema.array().min(1)
|
|
87904
87979
|
}).meta({ id: "sdk-build" });
|
|
87980
|
+
var sdkBuildLogChunkSchema = entitySchema.extend({
|
|
87981
|
+
teamUid: nanoidSchema,
|
|
87982
|
+
buildUid: nanoidSchema,
|
|
87983
|
+
/** Monotonic order within a build. */
|
|
87984
|
+
sequence: external_exports.number().int(),
|
|
87985
|
+
chunk: external_exports.string()
|
|
87986
|
+
}).meta({ id: "sdk-build-log-chunk" });
|
|
87905
87987
|
var sdkCodeSampleSchema = external_exports.object({
|
|
87906
87988
|
lang: external_exports.string(),
|
|
87907
87989
|
label: external_exports.string(),
|
|
@@ -87942,11 +88024,19 @@ var sdkLanguageToScalarTarget = {
|
|
|
87942
88024
|
[SdkLanguage.Kotlin]: "kotlin",
|
|
87943
88025
|
[SdkLanguage.Swift]: "swift",
|
|
87944
88026
|
[SdkLanguage.Cpp]: "cpp",
|
|
87945
|
-
[SdkLanguage.Dart]: "dart"
|
|
88027
|
+
[SdkLanguage.Dart]: "dart",
|
|
88028
|
+
[SdkLanguage.Cli]: "cli"
|
|
87946
88029
|
};
|
|
88030
|
+
var scalarTargetDestinationsSchema = external_exports.object({
|
|
88031
|
+
production: external_exports.object({
|
|
88032
|
+
repo: external_exports.string(),
|
|
88033
|
+
branch: external_exports.string().optional()
|
|
88034
|
+
}).optional()
|
|
88035
|
+
}).meta({ id: "scalar-target-destinations" });
|
|
87947
88036
|
var scalarTargetEntrySchema = external_exports.looseObject({
|
|
87948
88037
|
packageName: external_exports.string().optional(),
|
|
87949
|
-
version: external_exports.string().optional()
|
|
88038
|
+
version: external_exports.string().optional(),
|
|
88039
|
+
destinations: scalarTargetDestinationsSchema.optional()
|
|
87950
88040
|
}).meta({ id: "scalar-target-entry" });
|
|
87951
88041
|
var scalarClientSettingsSchema = external_exports.looseObject({
|
|
87952
88042
|
opts: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
@@ -87967,59 +88057,10 @@ var scalarSdkConfigSchema = external_exports.looseObject({
|
|
|
87967
88057
|
codeSampleLanguages: scalarTargetLanguageSchema.array().optional(),
|
|
87968
88058
|
diagnostics: scalarDiagnosticsSchema.optional()
|
|
87969
88059
|
}).meta({ id: "scalar-sdk-config" });
|
|
87970
|
-
|
|
87971
|
-
|
|
87972
|
-
|
|
87973
|
-
|
|
87974
|
-
return `@${namespace}/${base}`;
|
|
87975
|
-
if (language === SdkLanguage.Cpp)
|
|
87976
|
-
return `${namespace}_${base}`;
|
|
87977
|
-
return `${namespace}-${base}`;
|
|
87978
|
-
}
|
|
87979
|
-
function makeScalarSdkConfig({ namespace, slug, version: version3, language, className }) {
|
|
87980
|
-
const primaryTarget = sdkLanguageToScalarTarget[language];
|
|
87981
|
-
const sdkClassName = className || slug;
|
|
87982
|
-
return scalarSdkConfigSchema.parse({
|
|
87983
|
-
version: version3,
|
|
87984
|
-
clientSettings: {
|
|
87985
|
-
defaultEnvPrefix: namespace.toUpperCase()
|
|
87986
|
-
},
|
|
87987
|
-
targets: {
|
|
87988
|
-
[primaryTarget]: {
|
|
87989
|
-
packageName: buildPackageName(language, namespace, slug),
|
|
87990
|
-
version: version3
|
|
87991
|
-
}
|
|
87992
|
-
},
|
|
87993
|
-
resources: {
|
|
87994
|
-
[sdkClassName]: {}
|
|
87995
|
-
}
|
|
87996
|
-
});
|
|
87997
|
-
}
|
|
87998
|
-
var scalarBuildInputSchema = external_exports.object({
|
|
87999
|
-
namespace: namespaceSchema,
|
|
88000
|
-
slug: slugSchema,
|
|
88001
|
-
version: docVersionSchema,
|
|
88002
|
-
language: external_exports.enum(SdkLanguage),
|
|
88003
|
-
customConfig: external_exports.string(),
|
|
88004
|
-
className: external_exports.string().optional()
|
|
88005
|
-
}).transform(({ namespace, slug, version: version3, language, customConfig, className }) => {
|
|
88006
|
-
const parsed = scalarSdkConfigSchema.parse(JSON.parse(customConfig));
|
|
88007
|
-
const merged = {
|
|
88008
|
-
...makeScalarSdkConfig({
|
|
88009
|
-
namespace,
|
|
88010
|
-
slug,
|
|
88011
|
-
version: version3,
|
|
88012
|
-
language,
|
|
88013
|
-
className
|
|
88014
|
-
}),
|
|
88015
|
-
...parsed,
|
|
88016
|
-
version: version3
|
|
88017
|
-
};
|
|
88018
|
-
return import_yaml.default.stringify(merged);
|
|
88019
|
-
}).meta({ id: "scalar-build-input" });
|
|
88020
|
-
|
|
88021
|
-
// ../../packages/entities/dist/sdk/helpers.js
|
|
88022
|
-
import semver3 from "semver";
|
|
88060
|
+
var scalarTargetToSdkLanguage = Object.fromEntries(Object.entries(sdkLanguageToScalarTarget).map(([language, target]) => [
|
|
88061
|
+
target,
|
|
88062
|
+
language
|
|
88063
|
+
]));
|
|
88023
88064
|
|
|
88024
88065
|
// ../../packages/entities/dist/team/access.js
|
|
88025
88066
|
var ExternalAccessMethod;
|
|
@@ -88130,7 +88171,8 @@ var billingInfoSchema = external_exports.preprocess((arg) => {
|
|
|
88130
88171
|
billingId: nanoidSchema.optional(),
|
|
88131
88172
|
email: emailSchema,
|
|
88132
88173
|
plan: billingPlanSchema,
|
|
88133
|
-
expires: external_exports.number().optional()
|
|
88174
|
+
expires: external_exports.number().optional(),
|
|
88175
|
+
sdkTrialReminderSentAt: external_exports.number().optional()
|
|
88134
88176
|
})).meta({ id: "billing-info" });
|
|
88135
88177
|
var invoiceStatusSchema = external_exports.enum(["open", "paid", "draft", "void", "uncollectible"]).meta({ id: "invoice-status" });
|
|
88136
88178
|
var billingInvoiceSchema = external_exports.object({
|
|
@@ -88659,6 +88701,7 @@ var BaseCollections = {
|
|
|
88659
88701
|
LoginPortals: (teamUid) => `team/${teamUid}/login-portals`,
|
|
88660
88702
|
Sdks: (teamUid) => `team/${teamUid}/sdks`,
|
|
88661
88703
|
SdkBuilds: (teamUid) => `team/${teamUid}/sdk-builds`,
|
|
88704
|
+
SdkBuildLogs: (teamUid) => `team/${teamUid}/sdk-build-logs`,
|
|
88662
88705
|
PersonalTokens: (userUid) => `user/${userUid}/personal-tokens`,
|
|
88663
88706
|
IdentityProviders: (teamUid) => `team/${teamUid}/identity-providers`,
|
|
88664
88707
|
Workspaces: (teamUid) => `team/${teamUid}/workspaces`,
|
|
@@ -89017,16 +89060,16 @@ function loginPortalsApiFactory(requestService) {
|
|
|
89017
89060
|
|
|
89018
89061
|
// ../../packages/service-api/dist/apis/managed-docs.js
|
|
89019
89062
|
function managedDocsApiFactory(requestService) {
|
|
89020
|
-
async function get(namespace, slug,
|
|
89063
|
+
async function get(namespace, slug, semver6) {
|
|
89021
89064
|
return await requestService.request({
|
|
89022
|
-
url: `core/managed-doc/${namespace}/${slug}/version/${
|
|
89065
|
+
url: `core/managed-doc/${namespace}/${slug}/version/${semver6}`,
|
|
89023
89066
|
method: "get",
|
|
89024
89067
|
schema: external_exports.string()
|
|
89025
89068
|
});
|
|
89026
89069
|
}
|
|
89027
|
-
async function getVersionMetadata(namespace, slug,
|
|
89070
|
+
async function getVersionMetadata(namespace, slug, semver6) {
|
|
89028
89071
|
return await requestService.request({
|
|
89029
|
-
url: `core/managed-doc/${namespace}/${slug}/version/${
|
|
89072
|
+
url: `core/managed-doc/${namespace}/${slug}/version/${semver6}/metadata`,
|
|
89030
89073
|
method: "get",
|
|
89031
89074
|
schema: managedDocVersionSchema
|
|
89032
89075
|
});
|
|
@@ -89113,9 +89156,9 @@ function managedDocsApiFactory(requestService) {
|
|
|
89113
89156
|
schema: managedDocVersionSchema
|
|
89114
89157
|
});
|
|
89115
89158
|
}
|
|
89116
|
-
async function updateVersion(namespace, slug,
|
|
89159
|
+
async function updateVersion(namespace, slug, semver6, data) {
|
|
89117
89160
|
return await requestService.request({
|
|
89118
|
-
url: `core/managed-doc/${namespace}/${slug}/version/${
|
|
89161
|
+
url: `core/managed-doc/${namespace}/${slug}/version/${semver6}`,
|
|
89119
89162
|
method: "patch",
|
|
89120
89163
|
data,
|
|
89121
89164
|
schema: external_exports.object({
|
|
@@ -89125,9 +89168,9 @@ function managedDocsApiFactory(requestService) {
|
|
|
89125
89168
|
})
|
|
89126
89169
|
});
|
|
89127
89170
|
}
|
|
89128
|
-
async function deleteVersion(namespace, slug,
|
|
89171
|
+
async function deleteVersion(namespace, slug, semver6) {
|
|
89129
89172
|
return await requestService.request({
|
|
89130
|
-
url: `core/managed-doc/${namespace}/${slug}/version/${
|
|
89173
|
+
url: `core/managed-doc/${namespace}/${slug}/version/${semver6}`,
|
|
89131
89174
|
method: "delete",
|
|
89132
89175
|
schema: external_exports.null()
|
|
89133
89176
|
});
|
|
@@ -89182,9 +89225,9 @@ function managedDocsApiFactory(requestService) {
|
|
|
89182
89225
|
})
|
|
89183
89226
|
});
|
|
89184
89227
|
}
|
|
89185
|
-
async function updateMcpTools({ namespace, slug, semver:
|
|
89228
|
+
async function updateMcpTools({ namespace, slug, semver: semver6, tools }) {
|
|
89186
89229
|
return await requestService.request({
|
|
89187
|
-
url: `core/managed-doc/${namespace}/${slug}/version/${
|
|
89230
|
+
url: `core/managed-doc/${namespace}/${slug}/version/${semver6}/tools`,
|
|
89188
89231
|
method: "post",
|
|
89189
89232
|
data: tools,
|
|
89190
89233
|
schema: external_exports.null()
|
|
@@ -89441,16 +89484,6 @@ function sdksApiFactory(requestService) {
|
|
|
89441
89484
|
schema: external_exports.string()
|
|
89442
89485
|
});
|
|
89443
89486
|
}
|
|
89444
|
-
async function bulkCreate(data) {
|
|
89445
|
-
return await requestService.request({
|
|
89446
|
-
url: "core/v1/sdks/bulk",
|
|
89447
|
-
method: "post",
|
|
89448
|
-
data,
|
|
89449
|
-
schema: external_exports.object({
|
|
89450
|
-
uids: nanoidSchema.array()
|
|
89451
|
-
})
|
|
89452
|
-
});
|
|
89453
|
-
}
|
|
89454
89487
|
async function update(uid, data) {
|
|
89455
89488
|
return await requestService.request({
|
|
89456
89489
|
url: `core/v1/sdks/${uid}`,
|
|
@@ -89475,6 +89508,16 @@ function sdksApiFactory(requestService) {
|
|
|
89475
89508
|
schema: external_exports.unknown()
|
|
89476
89509
|
});
|
|
89477
89510
|
}
|
|
89511
|
+
async function transformConfig(data) {
|
|
89512
|
+
return await requestService.request({
|
|
89513
|
+
url: "sdk-generator/transform-config",
|
|
89514
|
+
method: "post",
|
|
89515
|
+
data,
|
|
89516
|
+
schema: external_exports.object({
|
|
89517
|
+
config: external_exports.string().nullable()
|
|
89518
|
+
})
|
|
89519
|
+
});
|
|
89520
|
+
}
|
|
89478
89521
|
async function del(uid) {
|
|
89479
89522
|
return await requestService.request({
|
|
89480
89523
|
url: `core/v1/sdks/${uid}`,
|
|
@@ -89482,6 +89525,29 @@ function sdksApiFactory(requestService) {
|
|
|
89482
89525
|
schema: external_exports.null()
|
|
89483
89526
|
});
|
|
89484
89527
|
}
|
|
89528
|
+
async function discardDraft(uid) {
|
|
89529
|
+
return await requestService.request({
|
|
89530
|
+
url: `core/v1/sdks/${uid}/draft`,
|
|
89531
|
+
method: "delete",
|
|
89532
|
+
schema: external_exports.null()
|
|
89533
|
+
});
|
|
89534
|
+
}
|
|
89535
|
+
async function deleteVersion(data) {
|
|
89536
|
+
return await requestService.request({
|
|
89537
|
+
url: "core/v1/sdks/version",
|
|
89538
|
+
method: "delete",
|
|
89539
|
+
data,
|
|
89540
|
+
schema: external_exports.null()
|
|
89541
|
+
});
|
|
89542
|
+
}
|
|
89543
|
+
async function fromConfig(data) {
|
|
89544
|
+
return await requestService.request({
|
|
89545
|
+
url: "core/v1/sdks/from-config",
|
|
89546
|
+
method: "post",
|
|
89547
|
+
data,
|
|
89548
|
+
schema: external_exports.string()
|
|
89549
|
+
});
|
|
89550
|
+
}
|
|
89485
89551
|
async function available(data) {
|
|
89486
89552
|
return await requestService.request({
|
|
89487
89553
|
url: "core/v1/sdks/available",
|
|
@@ -89524,37 +89590,40 @@ function sdksApiFactory(requestService) {
|
|
|
89524
89590
|
schema: external_exports.null()
|
|
89525
89591
|
});
|
|
89526
89592
|
}
|
|
89527
|
-
async function unlinkRepo(
|
|
89593
|
+
async function unlinkRepo(data) {
|
|
89528
89594
|
return await requestService.request({
|
|
89529
89595
|
url: "core/v1/sdks/repository",
|
|
89530
89596
|
method: "delete",
|
|
89531
|
-
data
|
|
89597
|
+
data,
|
|
89532
89598
|
schema: external_exports.null()
|
|
89533
89599
|
});
|
|
89534
89600
|
}
|
|
89535
|
-
async function syncBuild(
|
|
89601
|
+
async function syncBuild(data) {
|
|
89536
89602
|
return await requestService.request({
|
|
89537
89603
|
url: "core/v1/sdks/sync",
|
|
89538
89604
|
method: "post",
|
|
89539
|
-
data
|
|
89605
|
+
data,
|
|
89540
89606
|
schema: external_exports.null()
|
|
89541
89607
|
});
|
|
89542
89608
|
}
|
|
89543
|
-
async function build(sdkUid, version3) {
|
|
89609
|
+
async function build(sdkUid, version3, languages) {
|
|
89544
89610
|
return await requestService.request({
|
|
89545
89611
|
url: "core/v1/sdks/build",
|
|
89546
89612
|
method: "post",
|
|
89547
|
-
data: { sdkUid, version: version3 },
|
|
89613
|
+
data: { sdkUid, version: version3, languages },
|
|
89548
89614
|
schema: external_exports.null()
|
|
89549
89615
|
});
|
|
89550
89616
|
}
|
|
89551
89617
|
return {
|
|
89552
89618
|
create,
|
|
89553
|
-
|
|
89619
|
+
fromConfig,
|
|
89554
89620
|
createVersion,
|
|
89555
89621
|
previewCodeSamples,
|
|
89622
|
+
transformConfig,
|
|
89556
89623
|
update,
|
|
89557
89624
|
delete: del,
|
|
89625
|
+
discardDraft,
|
|
89626
|
+
deleteVersion,
|
|
89558
89627
|
available,
|
|
89559
89628
|
addAccessGroup,
|
|
89560
89629
|
removeAccessGroup,
|
|
@@ -89749,12 +89818,13 @@ function formatApiResponse(data, status, headers) {
|
|
|
89749
89818
|
error: false
|
|
89750
89819
|
};
|
|
89751
89820
|
}
|
|
89752
|
-
function formatApiError(message, status, error48 = null) {
|
|
89821
|
+
function formatApiError(message, status, error48 = null, code) {
|
|
89753
89822
|
return {
|
|
89754
89823
|
status,
|
|
89755
89824
|
message,
|
|
89756
89825
|
error: true,
|
|
89757
|
-
originalError: error48
|
|
89826
|
+
originalError: error48,
|
|
89827
|
+
code
|
|
89758
89828
|
};
|
|
89759
89829
|
}
|
|
89760
89830
|
function requestServiceFactory(baseUrl, getAuthToken) {
|
|
@@ -89789,8 +89859,10 @@ function requestServiceFactory(baseUrl, getAuthToken) {
|
|
|
89789
89859
|
}).then(async (response) => {
|
|
89790
89860
|
const isJson = response.headers.get("content-type")?.includes("application/json");
|
|
89791
89861
|
if (!response.ok) {
|
|
89792
|
-
const
|
|
89793
|
-
|
|
89862
|
+
const body = isJson ? await response.json().catch(() => ({ message: "Invalid response" })) : { message: await response.text().catch(() => "Invalid response") };
|
|
89863
|
+
const message = String(body.message ?? "") || "Unknown Error";
|
|
89864
|
+
const code = typeof body.code === "string" ? body.code : void 0;
|
|
89865
|
+
return formatApiError(message, response.status, null, code);
|
|
89794
89866
|
}
|
|
89795
89867
|
if (stream2)
|
|
89796
89868
|
return response.body ?? new ReadableStream();
|
|
@@ -90687,13 +90759,14 @@ function publishApiFactory(requestService) {
|
|
|
90687
90759
|
})
|
|
90688
90760
|
});
|
|
90689
90761
|
}
|
|
90690
|
-
async function unpublish(projectUid, githubProjectUid) {
|
|
90762
|
+
async function unpublish(projectUid, githubProjectUid, unifiedProjectUid) {
|
|
90691
90763
|
return await requestService.request({
|
|
90692
90764
|
url: "core/unpublish",
|
|
90693
90765
|
method: "delete",
|
|
90694
90766
|
data: {
|
|
90695
90767
|
projectUid,
|
|
90696
|
-
githubProjectUid
|
|
90768
|
+
githubProjectUid,
|
|
90769
|
+
unifiedProjectUid
|
|
90697
90770
|
},
|
|
90698
90771
|
schema: external_exports.null()
|
|
90699
90772
|
});
|
|
@@ -91215,7 +91288,7 @@ var config2 = {
|
|
|
91215
91288
|
}
|
|
91216
91289
|
},
|
|
91217
91290
|
cdnUrl: process.env.CDN_URL ?? "https://cdn.scalar.com",
|
|
91218
|
-
ssgDocsIsolateVersion: process.env.SSG_DOCS_ISOLATE_VERSION ?? "1.4.
|
|
91291
|
+
ssgDocsIsolateVersion: process.env.SSG_DOCS_ISOLATE_VERSION ?? "1.4.5"
|
|
91219
91292
|
};
|
|
91220
91293
|
|
|
91221
91294
|
// src/domains/auth/login/helpers/personal-token-generate-access.ts
|
|
@@ -91847,71 +91920,9 @@ var DeleteSchemaCommand = () => {
|
|
|
91847
91920
|
return cmd2;
|
|
91848
91921
|
};
|
|
91849
91922
|
|
|
91850
|
-
// src/domains/schema/
|
|
91851
|
-
import
|
|
91923
|
+
// src/domains/schema/get.ts
|
|
91924
|
+
import fs3 from "node:fs/promises";
|
|
91852
91925
|
import { Command as Command2 } from "commander";
|
|
91853
|
-
var ListSchemaCommand = () => {
|
|
91854
|
-
const cmd2 = new Command2("list");
|
|
91855
|
-
cmd2.description("List all schemas for a team namespace");
|
|
91856
|
-
cmd2.option("--namespace <namespace>", "Team namespace");
|
|
91857
|
-
cmd2.action(async (args) => {
|
|
91858
|
-
const { error: error48, data } = external_exports.object({
|
|
91859
|
-
namespace: namespaceSchema.optional()
|
|
91860
|
-
}).safeParse({
|
|
91861
|
-
namespace: args.namespace
|
|
91862
|
-
});
|
|
91863
|
-
if (error48)
|
|
91864
|
-
return output.error().title("Invalid input").message(error48.issues[0].message).exit("error");
|
|
91865
|
-
const auth = await getAuthData();
|
|
91866
|
-
auth.addEventListener((state) => Object.assign(auth, state));
|
|
91867
|
-
const client = await getDatabaseClient();
|
|
91868
|
-
const team = await client.getOne({
|
|
91869
|
-
collectionPath: BaseCollections.Teams,
|
|
91870
|
-
query: {
|
|
91871
|
-
uid: auth.teamUid
|
|
91872
|
-
},
|
|
91873
|
-
schema: teamSchema
|
|
91874
|
-
});
|
|
91875
|
-
if (team.error)
|
|
91876
|
-
return output.error().title("An error occurred when fetching your team.").message(team.message).exit("error");
|
|
91877
|
-
const namespace = data.namespace || team.data.namespaces.at(0);
|
|
91878
|
-
if (!namespace) {
|
|
91879
|
-
return output.error().title("Missing namespace").message(
|
|
91880
|
-
"Could not find a valid namespace for your API. Please specify a namespace or contact support."
|
|
91881
|
-
).exit("error");
|
|
91882
|
-
}
|
|
91883
|
-
const apiClient = await apiService();
|
|
91884
|
-
const schemas = await apiClient.managedSchemas.getSchemas(namespace);
|
|
91885
|
-
if (schemas.error)
|
|
91886
|
-
return output.error().title(schemas.message).exit("error");
|
|
91887
|
-
output.info().table(
|
|
91888
|
-
[
|
|
91889
|
-
[
|
|
91890
|
-
as2.underline.bold("Slug"),
|
|
91891
|
-
as2.underline.bold("Title"),
|
|
91892
|
-
as2.underline.bold("Version")
|
|
91893
|
-
],
|
|
91894
|
-
...schemas.data.map((schema) => {
|
|
91895
|
-
return [
|
|
91896
|
-
as2.blue(schema.slug),
|
|
91897
|
-
as2.blue(schema.title),
|
|
91898
|
-
schema.isPrivate ? as2.green("Private") : as2.yellow("Public")
|
|
91899
|
-
];
|
|
91900
|
-
})
|
|
91901
|
-
],
|
|
91902
|
-
{ padding: 2 }
|
|
91903
|
-
).print();
|
|
91904
|
-
});
|
|
91905
|
-
return cmd2;
|
|
91906
|
-
};
|
|
91907
|
-
|
|
91908
|
-
// src/domains/schema/publish.ts
|
|
91909
|
-
import { text } from "@clack/prompts";
|
|
91910
|
-
import as6 from "ansis";
|
|
91911
|
-
import { Command as Command4 } from "commander";
|
|
91912
|
-
import { bundle as bundle2 } from "@scalar/json-magic/bundle";
|
|
91913
|
-
import { fetchUrls as fetchUrls2, readFiles as readFiles2 } from "@scalar/json-magic/bundle/plugins/node";
|
|
91914
|
-
import { parseJsonOrYaml } from "@scalar/oas-utils/helpers";
|
|
91915
91926
|
|
|
91916
91927
|
// ../../packages/urls/dist/publish/full.js
|
|
91917
91928
|
function getPublishUrl(domain2, subpath) {
|
|
@@ -91986,7 +91997,8 @@ function buildAsset(namespace, asset, slug) {
|
|
|
91986
91997
|
url: (opts) => {
|
|
91987
91998
|
const query = [
|
|
91988
91999
|
opts?.format ? `format=${registryFormat(opts.format)}` : "",
|
|
91989
|
-
opts?.variant === "processed" ? "variant=processed" : ""
|
|
92000
|
+
opts?.variant === "processed" ? "variant=processed" : "",
|
|
92001
|
+
opts?.lang ? `lang=${opts.lang}` : ""
|
|
91990
92002
|
].filter(Boolean).join("&");
|
|
91991
92003
|
return `@${namespace}/${asset}/${slug}@${versionFormat(opts?.version)}${query ? `?${query}` : ""}`;
|
|
91992
92004
|
}
|
|
@@ -92003,14 +92015,184 @@ function registry2(teamNamespace) {
|
|
|
92003
92015
|
};
|
|
92004
92016
|
}
|
|
92005
92017
|
|
|
92018
|
+
// src/domains/registry/helpers/links.ts
|
|
92019
|
+
function registryUrl(path13) {
|
|
92020
|
+
return `${config2.projects.registry}/${path13}`;
|
|
92021
|
+
}
|
|
92022
|
+
function dashboardUrl(asset, uid) {
|
|
92023
|
+
return `${config2.projects.dashboard}/registry/${asset}/${uid}`;
|
|
92024
|
+
}
|
|
92025
|
+
|
|
92026
|
+
// src/domains/registry/helpers/fetch.ts
|
|
92027
|
+
async function fetchFromRegistry(path13, accessToken) {
|
|
92028
|
+
let response;
|
|
92029
|
+
try {
|
|
92030
|
+
response = await fetch(registryUrl(path13), {
|
|
92031
|
+
headers: {
|
|
92032
|
+
"x-scalar-auth": accessToken
|
|
92033
|
+
},
|
|
92034
|
+
// Should always error on redirect
|
|
92035
|
+
redirect: "error"
|
|
92036
|
+
});
|
|
92037
|
+
} catch (error48) {
|
|
92038
|
+
return {
|
|
92039
|
+
error: true,
|
|
92040
|
+
message: error48 instanceof Error && error48.message.length > 0 ? error48.message : "Registry request failed before a response was received."
|
|
92041
|
+
};
|
|
92042
|
+
}
|
|
92043
|
+
if (!response.ok) {
|
|
92044
|
+
const message = await response.text();
|
|
92045
|
+
return {
|
|
92046
|
+
error: true,
|
|
92047
|
+
message: message.length ? message : `Registry request failed with status ${response.status}.`
|
|
92048
|
+
};
|
|
92049
|
+
}
|
|
92050
|
+
return {
|
|
92051
|
+
error: false,
|
|
92052
|
+
data: await response.text()
|
|
92053
|
+
};
|
|
92054
|
+
}
|
|
92055
|
+
|
|
92056
|
+
// src/domains/schema/get.ts
|
|
92057
|
+
var versionSchema3 = external_exports.union([docVersionSchema, external_exports.literal("latest")]);
|
|
92058
|
+
var GetSchemaCommand = () => {
|
|
92059
|
+
const cmd2 = new Command2("get");
|
|
92060
|
+
cmd2.description("Get a schema document version from the Scalar registry");
|
|
92061
|
+
cmd2.argument("[namespace]", "Team namespace");
|
|
92062
|
+
cmd2.argument("[slug]", "Schema slug");
|
|
92063
|
+
cmd2.option("--version <version>", "Schema version (defaults to latest)");
|
|
92064
|
+
cmd2.option("--format <format>", "Output format (json or yaml)", "json");
|
|
92065
|
+
cmd2.option("-o, --output <file>", "Output file (defaults to stdout)");
|
|
92066
|
+
cmd2.action(async (namespace, slug, args) => {
|
|
92067
|
+
if (!namespace) {
|
|
92068
|
+
output.error().title("Invalid input").message("Please provide namespace of the schema").exit("error");
|
|
92069
|
+
return;
|
|
92070
|
+
}
|
|
92071
|
+
if (!slug) {
|
|
92072
|
+
output.error().title("Invalid input").message("Please provide slug of the schema").exit("error");
|
|
92073
|
+
return;
|
|
92074
|
+
}
|
|
92075
|
+
const result = external_exports.object({
|
|
92076
|
+
version: versionSchema3,
|
|
92077
|
+
format: external_exports.enum(["json", "yaml"]),
|
|
92078
|
+
output: external_exports.string().min(1).optional()
|
|
92079
|
+
}).safeParse({
|
|
92080
|
+
version: args.version ?? "latest",
|
|
92081
|
+
format: args.format,
|
|
92082
|
+
output: args.output
|
|
92083
|
+
});
|
|
92084
|
+
if (result.error) {
|
|
92085
|
+
output.error().title("Invalid input").message(result.error.issues[0].message).exit("error");
|
|
92086
|
+
return;
|
|
92087
|
+
}
|
|
92088
|
+
const auth = await getAuthData();
|
|
92089
|
+
auth.addEventListener((state) => Object.assign(auth, state));
|
|
92090
|
+
const fetchResult = await fetchFromRegistry(
|
|
92091
|
+
registry2(namespace).schemas(slug).url({
|
|
92092
|
+
version: result.data.version,
|
|
92093
|
+
format: result.data.format
|
|
92094
|
+
}),
|
|
92095
|
+
auth.accessToken
|
|
92096
|
+
);
|
|
92097
|
+
if (fetchResult.error) {
|
|
92098
|
+
output.error().title("Unable to download schema").message(fetchResult.message).exit("error");
|
|
92099
|
+
return;
|
|
92100
|
+
}
|
|
92101
|
+
const document2 = fetchResult.data;
|
|
92102
|
+
const withTrailingNewline = document2.endsWith("\n") ? document2 : `${document2}
|
|
92103
|
+
`;
|
|
92104
|
+
if (result.data.output) {
|
|
92105
|
+
try {
|
|
92106
|
+
await fs3.writeFile(result.data.output, withTrailingNewline, "utf8");
|
|
92107
|
+
} catch (error48) {
|
|
92108
|
+
const message = error48 instanceof Error && error48.message.length > 0 ? error48.message : `Could not write to ${result.data.output}.`;
|
|
92109
|
+
output.error().title("Unable to write schema to file").message(message).exit("error");
|
|
92110
|
+
return;
|
|
92111
|
+
}
|
|
92112
|
+
output.info().line(
|
|
92113
|
+
`Downloaded ${namespace}/${slug}@${result.data.version} (${result.data.format})`
|
|
92114
|
+
).line(`Written to ${result.data.output}`).print();
|
|
92115
|
+
return;
|
|
92116
|
+
}
|
|
92117
|
+
process.stdout.write(withTrailingNewline);
|
|
92118
|
+
});
|
|
92119
|
+
return cmd2;
|
|
92120
|
+
};
|
|
92121
|
+
|
|
92122
|
+
// src/domains/schema/list.ts
|
|
92123
|
+
import as2 from "ansis";
|
|
92124
|
+
import { Command as Command3 } from "commander";
|
|
92125
|
+
var ListSchemaCommand = () => {
|
|
92126
|
+
const cmd2 = new Command3("list");
|
|
92127
|
+
cmd2.description("List all schemas for a team namespace");
|
|
92128
|
+
cmd2.option("--namespace <namespace>", "Team namespace");
|
|
92129
|
+
cmd2.action(async (args) => {
|
|
92130
|
+
const { error: error48, data } = external_exports.object({
|
|
92131
|
+
namespace: namespaceSchema.optional()
|
|
92132
|
+
}).safeParse({
|
|
92133
|
+
namespace: args.namespace
|
|
92134
|
+
});
|
|
92135
|
+
if (error48)
|
|
92136
|
+
return output.error().title("Invalid input").message(error48.issues[0].message).exit("error");
|
|
92137
|
+
const auth = await getAuthData();
|
|
92138
|
+
auth.addEventListener((state) => Object.assign(auth, state));
|
|
92139
|
+
const client = await getDatabaseClient();
|
|
92140
|
+
const team = await client.getOne({
|
|
92141
|
+
collectionPath: BaseCollections.Teams,
|
|
92142
|
+
query: {
|
|
92143
|
+
uid: auth.teamUid
|
|
92144
|
+
},
|
|
92145
|
+
schema: teamSchema
|
|
92146
|
+
});
|
|
92147
|
+
if (team.error)
|
|
92148
|
+
return output.error().title("An error occurred when fetching your team.").message(team.message).exit("error");
|
|
92149
|
+
const namespace = data.namespace || team.data.namespaces.at(0);
|
|
92150
|
+
if (!namespace) {
|
|
92151
|
+
return output.error().title("Missing namespace").message(
|
|
92152
|
+
"Could not find a valid namespace for your API. Please specify a namespace or contact support."
|
|
92153
|
+
).exit("error");
|
|
92154
|
+
}
|
|
92155
|
+
const apiClient = await apiService();
|
|
92156
|
+
const schemas = await apiClient.managedSchemas.getSchemas(namespace);
|
|
92157
|
+
if (schemas.error)
|
|
92158
|
+
return output.error().title(schemas.message).exit("error");
|
|
92159
|
+
output.info().table(
|
|
92160
|
+
[
|
|
92161
|
+
[
|
|
92162
|
+
as2.underline.bold("Slug"),
|
|
92163
|
+
as2.underline.bold("Title"),
|
|
92164
|
+
as2.underline.bold("Version")
|
|
92165
|
+
],
|
|
92166
|
+
...schemas.data.map((schema) => {
|
|
92167
|
+
return [
|
|
92168
|
+
as2.blue(schema.slug),
|
|
92169
|
+
as2.blue(schema.title),
|
|
92170
|
+
schema.isPrivate ? as2.green("Private") : as2.yellow("Public")
|
|
92171
|
+
];
|
|
92172
|
+
})
|
|
92173
|
+
],
|
|
92174
|
+
{ padding: 2 }
|
|
92175
|
+
).print();
|
|
92176
|
+
});
|
|
92177
|
+
return cmd2;
|
|
92178
|
+
};
|
|
92179
|
+
|
|
92180
|
+
// src/domains/schema/publish.ts
|
|
92181
|
+
import { text } from "@clack/prompts";
|
|
92182
|
+
import as6 from "ansis";
|
|
92183
|
+
import { Command as Command5 } from "commander";
|
|
92184
|
+
import { bundle as bundle2 } from "@scalar/json-magic/bundle";
|
|
92185
|
+
import { fetchUrls as fetchUrls2, readFiles as readFiles2 } from "@scalar/json-magic/bundle/plugins/node";
|
|
92186
|
+
import { parseJsonOrYaml } from "@scalar/oas-utils/helpers";
|
|
92187
|
+
|
|
92006
92188
|
// src/domains/document/bundle/index.ts
|
|
92007
92189
|
var import_yaml2 = __toESM(require_dist(), 1);
|
|
92008
|
-
import
|
|
92190
|
+
import fs5 from "node:fs/promises";
|
|
92009
92191
|
import path3 from "node:path";
|
|
92010
92192
|
import { cwd } from "node:process";
|
|
92011
92193
|
import { confirm } from "@clack/prompts";
|
|
92012
92194
|
import as5 from "ansis";
|
|
92013
|
-
import { Command as
|
|
92195
|
+
import { Command as Command4 } from "commander";
|
|
92014
92196
|
import { bundle } from "@scalar/json-magic/bundle";
|
|
92015
92197
|
import { fetchUrls, readFiles } from "@scalar/json-magic/bundle/plugins/node";
|
|
92016
92198
|
|
|
@@ -92032,7 +92214,7 @@ var printSpecificationBanner = (result) => {
|
|
|
92032
92214
|
};
|
|
92033
92215
|
|
|
92034
92216
|
// src/domains/document/helpers/imports.ts
|
|
92035
|
-
import
|
|
92217
|
+
import fs4 from "node:fs";
|
|
92036
92218
|
import as4 from "ansis";
|
|
92037
92219
|
import { load, validate } from "@scalar/openapi-parser";
|
|
92038
92220
|
var getFileOrUrl = async (input) => {
|
|
@@ -92043,10 +92225,10 @@ var getFileOrUrl = async (input) => {
|
|
|
92043
92225
|
}
|
|
92044
92226
|
return await response.text();
|
|
92045
92227
|
}
|
|
92046
|
-
if (!
|
|
92228
|
+
if (!fs4.existsSync(input)) {
|
|
92047
92229
|
return output.error().title("Could not read file.").exit("error");
|
|
92048
92230
|
}
|
|
92049
|
-
return
|
|
92231
|
+
return fs4.readFileSync(input, "utf-8");
|
|
92050
92232
|
};
|
|
92051
92233
|
var loadOpenApiFile = async (input) => {
|
|
92052
92234
|
const specification = await getFileOrUrl(input);
|
|
@@ -92093,7 +92275,7 @@ async function measureTime(fn) {
|
|
|
92093
92275
|
// src/domains/document/bundle/index.ts
|
|
92094
92276
|
var DEFAULT_FETCH_CONCURRENCY = 5;
|
|
92095
92277
|
function BundleCommand() {
|
|
92096
|
-
const cmd2 = new
|
|
92278
|
+
const cmd2 = new Command4("bundle");
|
|
92097
92279
|
cmd2.description(
|
|
92098
92280
|
"Bundle an OpenAPI specification by resolving all references and external dependencies"
|
|
92099
92281
|
);
|
|
@@ -92148,7 +92330,7 @@ function BundleCommand() {
|
|
|
92148
92330
|
urlMap: !!urlMap
|
|
92149
92331
|
})
|
|
92150
92332
|
);
|
|
92151
|
-
await
|
|
92333
|
+
await fs5.writeFile(
|
|
92152
92334
|
outputFilePath ?? input,
|
|
92153
92335
|
isYaml ? import_yaml2.default.stringify(result) : JSON.stringify(result),
|
|
92154
92336
|
"utf8"
|
|
@@ -92161,19 +92343,9 @@ function BundleCommand() {
|
|
|
92161
92343
|
return cmd2;
|
|
92162
92344
|
}
|
|
92163
92345
|
|
|
92164
|
-
// src/domains/registry/helpers/links.ts
|
|
92165
|
-
function registryUrl(path13) {
|
|
92166
|
-
return `${config2.projects.registry}/${path13}`;
|
|
92167
|
-
}
|
|
92168
|
-
|
|
92169
|
-
// src/domains/schema/helpers/links.ts
|
|
92170
|
-
function schemaDashboardUrl(uid) {
|
|
92171
|
-
return `${config2.projects.dashboard}/schemas/${uid}`;
|
|
92172
|
-
}
|
|
92173
|
-
|
|
92174
92346
|
// src/domains/schema/publish.ts
|
|
92175
92347
|
var PublishSchemaCommand = () => {
|
|
92176
|
-
const cmd2 = new
|
|
92348
|
+
const cmd2 = new Command5("publish");
|
|
92177
92349
|
cmd2.description("Publish a shared schema to the Scalar registry");
|
|
92178
92350
|
cmd2.argument("[file]", "OpenAPI file to upload");
|
|
92179
92351
|
cmd2.option(
|
|
@@ -92264,7 +92436,9 @@ var PublishSchemaCommand = () => {
|
|
|
92264
92436
|
const matchingSchema = namespaceSchemaRes.data.find(
|
|
92265
92437
|
(schema2) => schema2.slug === slug
|
|
92266
92438
|
);
|
|
92267
|
-
const
|
|
92439
|
+
const documentTitle = result?.info?.title;
|
|
92440
|
+
const providedTitle = data.title ?? documentTitle;
|
|
92441
|
+
const title = matchingSchema || providedTitle ? providedTitle : (await text({
|
|
92268
92442
|
message: "Please provide a title for your schema",
|
|
92269
92443
|
validate(value) {
|
|
92270
92444
|
if (value.length === 0) return "Title is required.";
|
|
@@ -92306,21 +92480,22 @@ var PublishSchemaCommand = () => {
|
|
|
92306
92480
|
if (publishRes.error)
|
|
92307
92481
|
return output.error().title(publishRes.message).exit("error");
|
|
92308
92482
|
const schema = registry2(namespace).schemas(slug);
|
|
92309
|
-
const
|
|
92483
|
+
const schemaUrl = dashboardUrl(
|
|
92484
|
+
RegistryAsset2.Schemas,
|
|
92310
92485
|
matchingSchema?.uid ?? publishRes.data.uid
|
|
92311
92486
|
);
|
|
92312
92487
|
logger.update("loader", 0, {
|
|
92313
92488
|
content: `Successfully published v${version3} for ${slug}.`
|
|
92314
|
-
}).line().line(`${as6.green("\u279C")} ${as6.white.bold("View in dashboard:")}`).line(as6.cyan(
|
|
92489
|
+
}).line().line(`${as6.green("\u279C")} ${as6.white.bold("View in dashboard:")}`).line(as6.cyan(schemaUrl)).line().line(`${as6.green("\u279C")} ${as6.white.bold("Registry Preview:")}`).line(as6.cyan(registryUrl(schema.url({ version: version3 })))).line().line(`${as6.green("\u279C")} ${as6.white.bold("Registry YAML:")}`).line(as6.cyan(registryUrl(schema.url({ version: version3, format: "yaml" })))).line().line(`${as6.green("\u279C")} ${as6.white.bold("Registry JSON:")}`).line(as6.cyan(registryUrl(schema.url({ version: version3, format: "json" })))).print();
|
|
92315
92490
|
});
|
|
92316
92491
|
return cmd2;
|
|
92317
92492
|
};
|
|
92318
92493
|
|
|
92319
92494
|
// src/domains/schema/update.ts
|
|
92320
92495
|
import { select as select2 } from "@clack/prompts";
|
|
92321
|
-
import { Command as
|
|
92496
|
+
import { Command as Command6 } from "commander";
|
|
92322
92497
|
var UpdateSchemaCommand = () => {
|
|
92323
|
-
const cmd2 = new
|
|
92498
|
+
const cmd2 = new Command6("update");
|
|
92324
92499
|
cmd2.description("Update schema metadata.");
|
|
92325
92500
|
cmd2.option("-s, --slug <slug>", "Schema slug");
|
|
92326
92501
|
cmd2.option("-n, --namespace <namespace>", "Team namespace");
|
|
@@ -92388,21 +92563,22 @@ var schemaCommands = [
|
|
|
92388
92563
|
DeleteSchemaCommand,
|
|
92389
92564
|
UpdateSchemaCommand,
|
|
92390
92565
|
ListSchemaCommand,
|
|
92566
|
+
GetSchemaCommand,
|
|
92391
92567
|
PublishSchemaCommand
|
|
92392
92568
|
];
|
|
92393
|
-
var schemaDomain = new
|
|
92569
|
+
var schemaDomain = new Command7("schema");
|
|
92394
92570
|
schemaDomain.description("Manage your Scalar schemas");
|
|
92395
|
-
schemaCommands.forEach((command) => schemaDomain.addCommand(command()));
|
|
92571
|
+
schemaCommands.forEach((command) => void schemaDomain.addCommand(command()));
|
|
92396
92572
|
var schema_default = schemaDomain;
|
|
92397
92573
|
|
|
92398
92574
|
// src/domains/sdk/index.ts
|
|
92399
|
-
import { Command as
|
|
92575
|
+
import { Command as Command13 } from "commander";
|
|
92400
92576
|
|
|
92401
92577
|
// src/domains/sdk/build.ts
|
|
92402
92578
|
import { select as select3 } from "@clack/prompts";
|
|
92403
|
-
import { Command as
|
|
92579
|
+
import { Command as Command8 } from "commander";
|
|
92404
92580
|
var BuildSdkCommand = () => {
|
|
92405
|
-
const cmd2 = new
|
|
92581
|
+
const cmd2 = new Command8("build");
|
|
92406
92582
|
cmd2.description("Create an SDK build.");
|
|
92407
92583
|
cmd2.option("-s, --slug <slug>", "SDK slug");
|
|
92408
92584
|
cmd2.option("-n, --namespace <namespace>", "Team namespace");
|
|
@@ -92475,9 +92651,9 @@ var BuildSdkCommand = () => {
|
|
|
92475
92651
|
// src/domains/sdk/create.ts
|
|
92476
92652
|
import { select as select4, text as text2 } from "@clack/prompts";
|
|
92477
92653
|
import as7 from "ansis";
|
|
92478
|
-
import { Command as
|
|
92654
|
+
import { Command as Command9, Option } from "commander";
|
|
92479
92655
|
var CreateSdkCommand = () => {
|
|
92480
|
-
const cmd2 = new
|
|
92656
|
+
const cmd2 = new Command9("create");
|
|
92481
92657
|
cmd2.description("Create a new SDK.");
|
|
92482
92658
|
cmd2.option("-a, --api <api>", "Registry API slug");
|
|
92483
92659
|
cmd2.option("-n, --namespace <namespace>", "Team namespace");
|
|
@@ -92537,15 +92713,15 @@ var CreateSdkCommand = () => {
|
|
|
92537
92713
|
const logger = output.info().loader("Creating the SDK");
|
|
92538
92714
|
const response = await client.sdks.create({
|
|
92539
92715
|
apiUid,
|
|
92540
|
-
language
|
|
92716
|
+
languages: [language]
|
|
92541
92717
|
});
|
|
92542
92718
|
if (response.error) {
|
|
92543
92719
|
return output.error().title("Something went wrong").message(response.message).exit("error");
|
|
92544
92720
|
}
|
|
92545
92721
|
logger.update("loader", 0, { content: "SDK created successfully!" });
|
|
92546
|
-
const
|
|
92722
|
+
const dashboardUrl2 = `${config2.projects.dashboard}/sdk/${response.data}`;
|
|
92547
92723
|
logger.message(
|
|
92548
|
-
`View your SDK in the Scalar dashboard: ${as7.cyan(
|
|
92724
|
+
`View your SDK in the Scalar dashboard: ${as7.cyan(dashboardUrl2)}`
|
|
92549
92725
|
).exit("success");
|
|
92550
92726
|
});
|
|
92551
92727
|
return cmd2;
|
|
@@ -92553,9 +92729,9 @@ var CreateSdkCommand = () => {
|
|
|
92553
92729
|
|
|
92554
92730
|
// src/domains/sdk/delete.ts
|
|
92555
92731
|
import { select as select5 } from "@clack/prompts";
|
|
92556
|
-
import { Command as
|
|
92732
|
+
import { Command as Command10 } from "commander";
|
|
92557
92733
|
var DeleteSdkCommand = () => {
|
|
92558
|
-
const cmd2 = new
|
|
92734
|
+
const cmd2 = new Command10("delete");
|
|
92559
92735
|
cmd2.description("Delete an SDK.");
|
|
92560
92736
|
cmd2.option("-s, --slug <slug>", "SDK slug");
|
|
92561
92737
|
cmd2.option("-n, --namespace <namespace>", "Team namespace");
|
|
@@ -92615,9 +92791,9 @@ var DeleteSdkCommand = () => {
|
|
|
92615
92791
|
|
|
92616
92792
|
// src/domains/sdk/update.ts
|
|
92617
92793
|
import { select as select6 } from "@clack/prompts";
|
|
92618
|
-
import { Command as
|
|
92794
|
+
import { Command as Command11 } from "commander";
|
|
92619
92795
|
var UpdateSdkCommand = () => {
|
|
92620
|
-
const cmd2 = new
|
|
92796
|
+
const cmd2 = new Command11("update");
|
|
92621
92797
|
cmd2.description("Update SDK metadata.");
|
|
92622
92798
|
cmd2.option("-s, --slug <slug>", "SDK slug");
|
|
92623
92799
|
cmd2.option("-n, --namespace <namespace>", "Team namespace");
|
|
@@ -92684,9 +92860,9 @@ var UpdateSdkCommand = () => {
|
|
|
92684
92860
|
|
|
92685
92861
|
// src/domains/sdk/list.ts
|
|
92686
92862
|
import as8 from "ansis";
|
|
92687
|
-
import { Command as
|
|
92863
|
+
import { Command as Command12 } from "commander";
|
|
92688
92864
|
var ListSdkCommand = () => {
|
|
92689
|
-
const cmd2 = new
|
|
92865
|
+
const cmd2 = new Command12("list");
|
|
92690
92866
|
cmd2.description("List all SDKs for a team namespace");
|
|
92691
92867
|
cmd2.option("--namespace <namespace>", "Team namespace");
|
|
92692
92868
|
cmd2.action(async (args) => {
|
|
@@ -92754,17 +92930,17 @@ var sdkCommands = [
|
|
|
92754
92930
|
DeleteSdkCommand,
|
|
92755
92931
|
BuildSdkCommand
|
|
92756
92932
|
];
|
|
92757
|
-
var sdkDomain = new
|
|
92933
|
+
var sdkDomain = new Command13("sdk");
|
|
92758
92934
|
sdkDomain.description("Manage your Scalar SDKs (Enterprise Only)");
|
|
92759
92935
|
sdkCommands.forEach((command) => sdkDomain.addCommand(command()));
|
|
92760
92936
|
var sdk_default = sdkDomain;
|
|
92761
92937
|
|
|
92762
92938
|
// src/domains/auth/index.ts
|
|
92763
|
-
import { Command as
|
|
92939
|
+
import { Command as Command17 } from "commander";
|
|
92764
92940
|
|
|
92765
92941
|
// src/domains/auth/login/index.ts
|
|
92766
92942
|
import as10 from "ansis";
|
|
92767
|
-
import { Command as
|
|
92943
|
+
import { Command as Command14 } from "commander";
|
|
92768
92944
|
|
|
92769
92945
|
// ../../packages/mongobase-client/dist/auth/node/exchange-callback-server.js
|
|
92770
92946
|
import getPort from "get-port";
|
|
@@ -92908,7 +93084,7 @@ var emailPasswordAuth = async ({
|
|
|
92908
93084
|
|
|
92909
93085
|
// src/domains/auth/login/index.ts
|
|
92910
93086
|
var LoginCommand = () => {
|
|
92911
|
-
const cmd2 = new
|
|
93087
|
+
const cmd2 = new Command14("login");
|
|
92912
93088
|
cmd2.description("Login to scalar");
|
|
92913
93089
|
cmd2.option("--email <email>", "Email");
|
|
92914
93090
|
cmd2.option("--password <password>", "Password");
|
|
@@ -92969,9 +93145,9 @@ var LoginCommand = () => {
|
|
|
92969
93145
|
};
|
|
92970
93146
|
|
|
92971
93147
|
// src/domains/auth/logout/index.ts
|
|
92972
|
-
import { Command as
|
|
93148
|
+
import { Command as Command15 } from "commander";
|
|
92973
93149
|
var LogoutCommand = () => {
|
|
92974
|
-
const cmd2 = new
|
|
93150
|
+
const cmd2 = new Command15("logout");
|
|
92975
93151
|
cmd2.description("Logout from scalar");
|
|
92976
93152
|
cmd2.action(async () => {
|
|
92977
93153
|
await clearAuthData();
|
|
@@ -92982,9 +93158,9 @@ var LogoutCommand = () => {
|
|
|
92982
93158
|
|
|
92983
93159
|
// src/domains/auth/whoami/index.ts
|
|
92984
93160
|
import as11 from "ansis";
|
|
92985
|
-
import { Command as
|
|
93161
|
+
import { Command as Command16 } from "commander";
|
|
92986
93162
|
var WhoAmICommand = () => {
|
|
92987
|
-
const cmd2 = new
|
|
93163
|
+
const cmd2 = new Command16("whoami");
|
|
92988
93164
|
cmd2.description("Display the current user");
|
|
92989
93165
|
cmd2.action(async () => {
|
|
92990
93166
|
const auth = await getAuthData({ skipRefresh: true });
|
|
@@ -92997,19 +93173,19 @@ var WhoAmICommand = () => {
|
|
|
92997
93173
|
|
|
92998
93174
|
// src/domains/auth/index.ts
|
|
92999
93175
|
var authCommands = [LoginCommand, WhoAmICommand, LogoutCommand];
|
|
93000
|
-
var authDomain = new
|
|
93176
|
+
var authDomain = new Command17("auth");
|
|
93001
93177
|
authDomain.description("Manage authorization on scalar platform");
|
|
93002
93178
|
authCommands.forEach((command) => authDomain.addCommand(command()));
|
|
93003
93179
|
var auth_default = authDomain;
|
|
93004
93180
|
|
|
93005
93181
|
// src/domains/document/index.ts
|
|
93006
|
-
import { Command as
|
|
93182
|
+
import { Command as Command30 } from "commander";
|
|
93007
93183
|
|
|
93008
93184
|
// src/domains/document/join/index.ts
|
|
93009
93185
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
93010
|
-
import
|
|
93186
|
+
import fs6 from "node:fs/promises";
|
|
93011
93187
|
import as12 from "ansis";
|
|
93012
|
-
import { Command as
|
|
93188
|
+
import { Command as Command18 } from "commander";
|
|
93013
93189
|
import { join, normalize as normalize2 } from "@scalar/openapi-parser";
|
|
93014
93190
|
|
|
93015
93191
|
// src/domains/document/join/helpers.ts
|
|
@@ -93045,7 +93221,7 @@ var formatErrorMessage = (conflicts) => {
|
|
|
93045
93221
|
});
|
|
93046
93222
|
};
|
|
93047
93223
|
function JoinCommand() {
|
|
93048
|
-
const cmd2 = new
|
|
93224
|
+
const cmd2 = new Command18("join");
|
|
93049
93225
|
cmd2.description(
|
|
93050
93226
|
"Merge multiple OpenAPI documents into a single unified document"
|
|
93051
93227
|
);
|
|
@@ -93069,7 +93245,7 @@ function JoinCommand() {
|
|
|
93069
93245
|
optsError.issues.map((e) => `${e.message} property: '${e.path}'`).join("\n")
|
|
93070
93246
|
).line("").exit("error");
|
|
93071
93247
|
}
|
|
93072
|
-
const files = (await Promise.all(input.map((file2) =>
|
|
93248
|
+
const files = (await Promise.all(input.map((file2) => fs6.readFile(file2, "utf-8")))).map((it) => normalize2(it));
|
|
93073
93249
|
const prefixes = opts.prefixComponentsWithPathValue ? getPrefixes(files, opts.prefixComponentsWithPathValue) : [];
|
|
93074
93250
|
const { executionTimeMs, result } = await measureTime(
|
|
93075
93251
|
() => join(files, { prefixComponents: prefixes })
|
|
@@ -93079,7 +93255,7 @@ function JoinCommand() {
|
|
|
93079
93255
|
${formatErrorMessage(result.conflicts).join("\n")}`).line().exit("error");
|
|
93080
93256
|
}
|
|
93081
93257
|
const isYaml = isYamlFileName(opts.output);
|
|
93082
|
-
await
|
|
93258
|
+
await fs6.writeFile(
|
|
93083
93259
|
opts.output,
|
|
93084
93260
|
isYaml ? import_yaml3.default.stringify(result.document) : JSON.stringify(result.document, null, 2),
|
|
93085
93261
|
"utf8"
|
|
@@ -93092,18 +93268,18 @@ ${formatErrorMessage(result.conflicts).join("\n")}`).line().exit("error");
|
|
|
93092
93268
|
}
|
|
93093
93269
|
|
|
93094
93270
|
// src/domains/document/split/index.ts
|
|
93095
|
-
import
|
|
93271
|
+
import fs7 from "node:fs/promises";
|
|
93096
93272
|
import path4 from "node:path";
|
|
93097
93273
|
import { text as text3 } from "@clack/prompts";
|
|
93098
93274
|
import as13 from "ansis";
|
|
93099
|
-
import { Command as
|
|
93275
|
+
import { Command as Command19 } from "commander";
|
|
93100
93276
|
import { normalize as normalize3 } from "@scalar/openapi-parser";
|
|
93101
93277
|
import {
|
|
93102
93278
|
createServerWorkspaceStore,
|
|
93103
93279
|
WORKSPACE_FILE_NAME
|
|
93104
93280
|
} from "@scalar/workspace-store/server";
|
|
93105
93281
|
function SplitCommand() {
|
|
93106
|
-
const cmd2 = new
|
|
93282
|
+
const cmd2 = new Command19("split");
|
|
93107
93283
|
cmd2.description("Split your OpenAPI documents on small chunks");
|
|
93108
93284
|
cmd2.argument("[file|url]", "Path to OpenAPI file or URL to split");
|
|
93109
93285
|
cmd2.option("-o, --output <path>", "Path to save the chunks");
|
|
@@ -93143,13 +93319,13 @@ function SplitCommand() {
|
|
|
93143
93319
|
await store.generateWorkspaceChunks();
|
|
93144
93320
|
const workspaceFilePath = path4.join(outputPath, WORKSPACE_FILE_NAME);
|
|
93145
93321
|
const sparseDocument = JSON.parse(
|
|
93146
|
-
await
|
|
93322
|
+
await fs7.readFile(workspaceFilePath, { encoding: "utf-8" })
|
|
93147
93323
|
);
|
|
93148
|
-
await
|
|
93324
|
+
await fs7.writeFile(
|
|
93149
93325
|
path4.join(outputPath, "out.json"),
|
|
93150
93326
|
JSON.stringify(sparseDocument.documents[documentName])
|
|
93151
93327
|
);
|
|
93152
|
-
await
|
|
93328
|
+
await fs7.rm(workspaceFilePath);
|
|
93153
93329
|
});
|
|
93154
93330
|
output.info().line().title(as13.green("Document Split Successfully! \u{1F389}")).line().message(`\u2728 Chunks have been generated at: ${as13.blue(outputPath)}`).line(`\u23F1\uFE0F Split completed in ${as13.yellow(executionTimeMs.toFixed(2))}ms`).line("").print();
|
|
93155
93331
|
});
|
|
@@ -93157,12 +93333,12 @@ function SplitCommand() {
|
|
|
93157
93333
|
}
|
|
93158
93334
|
|
|
93159
93335
|
// src/domains/document/format/index.ts
|
|
93160
|
-
import
|
|
93336
|
+
import fs8 from "node:fs";
|
|
93161
93337
|
import as14 from "ansis";
|
|
93162
|
-
import { Command as
|
|
93338
|
+
import { Command as Command20 } from "commander";
|
|
93163
93339
|
import { normalize as normalize4, toJson, toYaml } from "@scalar/openapi-parser";
|
|
93164
93340
|
function FormatCommand() {
|
|
93165
|
-
const cmd2 = new
|
|
93341
|
+
const cmd2 = new Command20("format");
|
|
93166
93342
|
cmd2.description("Format an OpenAPI file");
|
|
93167
93343
|
cmd2.argument("[file|url]", "File or URL to format");
|
|
93168
93344
|
cmd2.option("-o, --output <file>", "Output file");
|
|
@@ -93175,9 +93351,9 @@ function FormatCommand() {
|
|
|
93175
93351
|
const specification = await getFileOrUrl(inputArgument);
|
|
93176
93352
|
const newContent = isYamlFileName(outputPath || inputArgument) ? toYaml(normalize4(specification)) : toJson(normalize4(specification));
|
|
93177
93353
|
if (outputPath) {
|
|
93178
|
-
|
|
93354
|
+
fs8.writeFileSync(outputPath, newContent, "utf8");
|
|
93179
93355
|
} else if (!isUrl(inputArgument)) {
|
|
93180
|
-
|
|
93356
|
+
fs8.writeFileSync(inputArgument, newContent, "utf8");
|
|
93181
93357
|
} else {
|
|
93182
93358
|
return output.error().title("Invalid argument").message().message(
|
|
93183
93359
|
"Output file is required for URLs. Try passing --output file flag."
|
|
@@ -93197,7 +93373,7 @@ function FormatCommand() {
|
|
|
93197
93373
|
// src/domains/document/lint/index.ts
|
|
93198
93374
|
import spectralCore from "@stoplight/spectral-core";
|
|
93199
93375
|
import as15 from "ansis";
|
|
93200
|
-
import { Command as
|
|
93376
|
+
import { Command as Command21 } from "commander";
|
|
93201
93377
|
|
|
93202
93378
|
// src/domains/document/lint/helpers.ts
|
|
93203
93379
|
import { bundleAndLoadRuleset } from "@stoplight/spectral-ruleset-bundler/with-loader";
|
|
@@ -93229,7 +93405,7 @@ var severityToLabel = (severity) => {
|
|
|
93229
93405
|
var { Spectral } = spectralCore;
|
|
93230
93406
|
var spectral = new Spectral();
|
|
93231
93407
|
function LintCommand() {
|
|
93232
|
-
const cmd2 = new
|
|
93408
|
+
const cmd2 = new Command21("lint");
|
|
93233
93409
|
cmd2.description("Lint your OpenAPI file using spectral rules");
|
|
93234
93410
|
cmd2.argument("[file|url]", "OpenAPI file path or url");
|
|
93235
93411
|
cmd2.option("-r, --rule <file|url>", "Rule path or url");
|
|
@@ -93265,12 +93441,12 @@ function LintCommand() {
|
|
|
93265
93441
|
}
|
|
93266
93442
|
|
|
93267
93443
|
// src/domains/document/markdown/index.ts
|
|
93268
|
-
import
|
|
93444
|
+
import fs9 from "node:fs";
|
|
93269
93445
|
import as16 from "ansis";
|
|
93270
|
-
import { Command as
|
|
93446
|
+
import { Command as Command22 } from "commander";
|
|
93271
93447
|
import { createMarkdownFromOpenApi } from "@scalar/openapi-to-markdown";
|
|
93272
93448
|
function MarkdownCommand() {
|
|
93273
|
-
const cmd2 = new
|
|
93449
|
+
const cmd2 = new Command22("markdown");
|
|
93274
93450
|
cmd2.description("Generate Markdown from an OpenAPI file");
|
|
93275
93451
|
cmd2.argument("[file|url]", "OpenAPI file path or URL to convert");
|
|
93276
93452
|
cmd2.option("-o, --output <file>", "Output file (defaults to stdout)");
|
|
@@ -93283,7 +93459,7 @@ function MarkdownCommand() {
|
|
|
93283
93459
|
const specification = await getFileOrUrl(inputArgument);
|
|
93284
93460
|
const markdown = await createMarkdownFromOpenApi(specification);
|
|
93285
93461
|
if (outputPath) {
|
|
93286
|
-
|
|
93462
|
+
fs9.writeFileSync(outputPath, markdown, "utf8");
|
|
93287
93463
|
const endTime = performance.now();
|
|
93288
93464
|
output.info().line(
|
|
93289
93465
|
`${as16.green("Markdown generated")} ${as16.grey(
|
|
@@ -93300,7 +93476,7 @@ function MarkdownCommand() {
|
|
|
93300
93476
|
|
|
93301
93477
|
// src/domains/document/mock/index.ts
|
|
93302
93478
|
import as18 from "ansis";
|
|
93303
|
-
import { Command as
|
|
93479
|
+
import { Command as Command23 } from "commander";
|
|
93304
93480
|
|
|
93305
93481
|
// src/domains/document/mock/helpers.ts
|
|
93306
93482
|
import { serve } from "@hono/node-server";
|
|
@@ -93370,7 +93546,7 @@ function getMethodColor(method) {
|
|
|
93370
93546
|
|
|
93371
93547
|
// src/domains/document/mock/index.ts
|
|
93372
93548
|
function MockCommand() {
|
|
93373
|
-
const cmd2 = new
|
|
93549
|
+
const cmd2 = new Command23("mock");
|
|
93374
93550
|
cmd2.description("Mock an API from an OpenAPI file");
|
|
93375
93551
|
cmd2.argument("[file|url]", "OpenAPI file or URL to mock the server for");
|
|
93376
93552
|
cmd2.option("-w, --watch", "watch the file for changes");
|
|
@@ -93430,12 +93606,12 @@ function MockCommand() {
|
|
|
93430
93606
|
|
|
93431
93607
|
// src/domains/document/postman/index.ts
|
|
93432
93608
|
var import_yaml4 = __toESM(require_dist(), 1);
|
|
93433
|
-
import
|
|
93609
|
+
import fs10 from "node:fs";
|
|
93434
93610
|
import as19 from "ansis";
|
|
93435
|
-
import { Command as
|
|
93611
|
+
import { Command as Command24 } from "commander";
|
|
93436
93612
|
import { convert } from "@scalar/postman-to-openapi";
|
|
93437
93613
|
function ConvertCommand() {
|
|
93438
|
-
const cmd2 = new
|
|
93614
|
+
const cmd2 = new Command24("convert");
|
|
93439
93615
|
cmd2.description("Convert a Postman collection to an OpenAPI document");
|
|
93440
93616
|
cmd2.argument("[file|url]", "Postman collection file path or URL to convert");
|
|
93441
93617
|
cmd2.option("-o, --output <file>", "Output file (defaults to stdout)");
|
|
@@ -93463,7 +93639,7 @@ function ConvertCommand() {
|
|
|
93463
93639
|
}
|
|
93464
93640
|
const openApiDocument = outputPath ? isYamlFileName(outputPath) ? import_yaml4.default.stringify(specification) : JSON.stringify(specification, null, 2) : JSON.stringify(specification, null, 2);
|
|
93465
93641
|
if (outputPath) {
|
|
93466
|
-
|
|
93642
|
+
fs10.writeFileSync(outputPath, openApiDocument, "utf8");
|
|
93467
93643
|
const endTime = performance.now();
|
|
93468
93644
|
output.info().line(
|
|
93469
93645
|
`${as19.green("OpenAPI document generated")} ${as19.grey(
|
|
@@ -93482,11 +93658,11 @@ function ConvertCommand() {
|
|
|
93482
93658
|
// src/domains/document/serve/index.ts
|
|
93483
93659
|
import { serve as serve2 } from "@hono/node-server";
|
|
93484
93660
|
import as20 from "ansis";
|
|
93485
|
-
import { Command as
|
|
93661
|
+
import { Command as Command25 } from "commander";
|
|
93486
93662
|
import { Hono } from "hono";
|
|
93487
93663
|
import { stream } from "hono/streaming";
|
|
93488
93664
|
function ServeCommand() {
|
|
93489
|
-
const cmd2 = new
|
|
93665
|
+
const cmd2 = new Command25("serve");
|
|
93490
93666
|
cmd2.description("Serve an API Reference from an OpenAPI file");
|
|
93491
93667
|
cmd2.argument("[file|url]", "OpenAPI file or URL to show the reference for");
|
|
93492
93668
|
cmd2.option("-w, --watch", "watch the file for changes");
|
|
@@ -93605,9 +93781,9 @@ var getHtmlDocument = (specification, watch = false) => {
|
|
|
93605
93781
|
|
|
93606
93782
|
// src/domains/document/share/index.ts
|
|
93607
93783
|
import as21 from "ansis";
|
|
93608
|
-
import { Command as
|
|
93784
|
+
import { Command as Command26 } from "commander";
|
|
93609
93785
|
function ShareCommand() {
|
|
93610
|
-
const cmd2 = new
|
|
93786
|
+
const cmd2 = new Command26("share");
|
|
93611
93787
|
cmd2.description("Share an OpenAPI file");
|
|
93612
93788
|
cmd2.argument("[file]", "file to share");
|
|
93613
93789
|
cmd2.option(
|
|
@@ -93666,13 +93842,13 @@ function ShareCommand() {
|
|
|
93666
93842
|
|
|
93667
93843
|
// src/domains/document/upgrade/index.ts
|
|
93668
93844
|
var import_yaml5 = __toESM(require_dist(), 1);
|
|
93669
|
-
import
|
|
93845
|
+
import fs11 from "node:fs/promises";
|
|
93670
93846
|
import { confirm as confirm2 } from "@clack/prompts";
|
|
93671
93847
|
import as22 from "ansis";
|
|
93672
|
-
import { Command as
|
|
93848
|
+
import { Command as Command27 } from "commander";
|
|
93673
93849
|
import { normalize as normalize5, upgrade } from "@scalar/openapi-parser";
|
|
93674
93850
|
function UpgradeCommand() {
|
|
93675
|
-
const cmd2 = new
|
|
93851
|
+
const cmd2 = new Command27("upgrade");
|
|
93676
93852
|
cmd2.description("Upgrade OpenAPI document to version 3.1");
|
|
93677
93853
|
cmd2.argument("[file|url]", "File or URL to validate");
|
|
93678
93854
|
cmd2.option("-o, --output <file>", "Path to save the upgraded output file");
|
|
@@ -93701,7 +93877,7 @@ function UpgradeCommand() {
|
|
|
93701
93877
|
() => upgrade(document2)
|
|
93702
93878
|
);
|
|
93703
93879
|
const isYaml = isYamlFileName(outputFileName);
|
|
93704
|
-
await
|
|
93880
|
+
await fs11.writeFile(
|
|
93705
93881
|
outputFileName,
|
|
93706
93882
|
isYaml ? import_yaml5.default.stringify(result.specification) : JSON.stringify(result.specification, null, 2)
|
|
93707
93883
|
);
|
|
@@ -93714,13 +93890,13 @@ function UpgradeCommand() {
|
|
|
93714
93890
|
|
|
93715
93891
|
// src/domains/document/validate/index.ts
|
|
93716
93892
|
import as23 from "ansis";
|
|
93717
|
-
import { Command as
|
|
93893
|
+
import { Command as Command28 } from "commander";
|
|
93718
93894
|
import prettyjson from "prettyjson";
|
|
93719
93895
|
import { bundle as bundle3 } from "@scalar/json-magic/bundle";
|
|
93720
93896
|
import { fetchUrls as fetchUrls3, readFiles as readFiles3 } from "@scalar/json-magic/bundle/plugins/node";
|
|
93721
93897
|
import { validate as validate2 } from "@scalar/openapi-parser";
|
|
93722
93898
|
function ValidateCommand() {
|
|
93723
|
-
const cmd2 = new
|
|
93899
|
+
const cmd2 = new Command28("validate");
|
|
93724
93900
|
cmd2.description("Validate an OpenAPI file");
|
|
93725
93901
|
cmd2.argument("[file|url]", "File or URL to validate");
|
|
93726
93902
|
cmd2.action(async (inputArgument) => {
|
|
@@ -93767,10 +93943,10 @@ function ValidateCommand() {
|
|
|
93767
93943
|
// src/domains/document/void/index.ts
|
|
93768
93944
|
import { serve as serve3 } from "@hono/node-server";
|
|
93769
93945
|
import as24 from "ansis";
|
|
93770
|
-
import { Command as
|
|
93946
|
+
import { Command as Command29 } from "commander";
|
|
93771
93947
|
import { createVoidServer } from "@scalar/void-server";
|
|
93772
93948
|
function VoidCommand() {
|
|
93773
|
-
const cmd2 = new
|
|
93949
|
+
const cmd2 = new Command29("void");
|
|
93774
93950
|
cmd2.description("Boot a server to mirror HTTP requests");
|
|
93775
93951
|
cmd2.option("-o, --once", "run the server only once and exit after that");
|
|
93776
93952
|
cmd2.option("-p, --port <port>", "set the HTTP port for the mock server");
|
|
@@ -93827,23 +94003,23 @@ var documentCommands = [
|
|
|
93827
94003
|
LintCommand,
|
|
93828
94004
|
UpgradeCommand
|
|
93829
94005
|
];
|
|
93830
|
-
var documentDomain = new
|
|
94006
|
+
var documentDomain = new Command30("document");
|
|
93831
94007
|
documentDomain.description("Manage local openapi file");
|
|
93832
94008
|
documentCommands.forEach((command) => documentDomain.addCommand(command()));
|
|
93833
94009
|
var document_default = documentDomain;
|
|
93834
94010
|
|
|
93835
94011
|
// src/domains/project/index.ts
|
|
93836
|
-
import { Command as
|
|
94012
|
+
import { Command as Command38 } from "commander";
|
|
93837
94013
|
|
|
93838
94014
|
// src/domains/project/preview/index.ts
|
|
93839
94015
|
import { text as text4 } from "@clack/prompts";
|
|
93840
94016
|
import as27 from "ansis";
|
|
93841
|
-
import { Command as
|
|
94017
|
+
import { Command as Command33 } from "commander";
|
|
93842
94018
|
|
|
93843
94019
|
// src/domains/project/check-config/index.ts
|
|
93844
|
-
import
|
|
94020
|
+
import fs13 from "node:fs";
|
|
93845
94021
|
import as25 from "ansis";
|
|
93846
|
-
import { Command as
|
|
94022
|
+
import { Command as Command31 } from "commander";
|
|
93847
94023
|
|
|
93848
94024
|
// ../../packages/helpers/dist/parse/parse.js
|
|
93849
94025
|
var import_json5 = __toESM(require_lib(), 1);
|
|
@@ -94323,6 +94499,7 @@ var pageFrontmatterSchema = external_exports.object({
|
|
|
94323
94499
|
tabs: external_exports.boolean().optional(),
|
|
94324
94500
|
pageTitle: external_exports.boolean().optional(),
|
|
94325
94501
|
pageActions: external_exports.boolean().optional(),
|
|
94502
|
+
fullWidth: external_exports.boolean().optional().describe("Expand the page content to the full page width instead of the default centered column."),
|
|
94326
94503
|
search: external_exports.object({
|
|
94327
94504
|
position: external_exports.enum(["header", "sidebar"]).optional().describe("The position of the search bar in this page"),
|
|
94328
94505
|
enabled: external_exports.boolean().optional().describe("Enable or disable search for this page")
|
|
@@ -94473,6 +94650,9 @@ var linkSchema2 = zod_default.object({
|
|
|
94473
94650
|
var headerSpacerSchema = zod_default.object({
|
|
94474
94651
|
type: zod_default.literal("spacer")
|
|
94475
94652
|
});
|
|
94653
|
+
var headerVersionSelectorSchema = zod_default.object({
|
|
94654
|
+
type: zod_default.literal("version-selector").describe("Renders the version selector dropdown at this position in the header")
|
|
94655
|
+
});
|
|
94476
94656
|
var headerItem = zod_default.discriminatedUnion("type", [
|
|
94477
94657
|
linkSchema2,
|
|
94478
94658
|
headerSpacerSchema
|
|
@@ -94485,7 +94665,8 @@ var headerGroupSchema = zod_default.object({
|
|
|
94485
94665
|
});
|
|
94486
94666
|
var headerItemSchema = zod_default.discriminatedUnion("type", [
|
|
94487
94667
|
headerItem,
|
|
94488
|
-
headerGroupSchema
|
|
94668
|
+
headerGroupSchema,
|
|
94669
|
+
headerVersionSelectorSchema
|
|
94489
94670
|
]);
|
|
94490
94671
|
|
|
94491
94672
|
// ../../packages/scalar-config/dist/schema/navigation/navigation.js
|
|
@@ -94552,6 +94733,21 @@ var llmPageSchema = zod_default.object({
|
|
|
94552
94733
|
filepath: zod_default.string()
|
|
94553
94734
|
});
|
|
94554
94735
|
|
|
94736
|
+
// ../../packages/scalar-config/dist/schema/sdks.js
|
|
94737
|
+
var sdkConfigSchema = external_exports.object({
|
|
94738
|
+
title: external_exports.string().optional().describe("Display name for the SDK."),
|
|
94739
|
+
description: external_exports.string().optional().describe("Description of the SDK."),
|
|
94740
|
+
slug: external_exports.string().optional().describe("Slug of the SDK in the team registry."),
|
|
94741
|
+
namespace: external_exports.string().optional().describe("Namespace of the SDK in the team registry."),
|
|
94742
|
+
api: external_exports.object({
|
|
94743
|
+
namespace: external_exports.string().optional().describe("Namespace of the source API in the registry."),
|
|
94744
|
+
slug: external_exports.string().describe("Slug of the source API. Matches an OpenAPI route in the project."),
|
|
94745
|
+
version: external_exports.string().optional().describe("Version of the source API.")
|
|
94746
|
+
}).describe("The project API this SDK is generated from."),
|
|
94747
|
+
config: scalarSdkConfigSchema.optional().describe("The SDK code generation config, inline as an object."),
|
|
94748
|
+
disableSync: external_exports.boolean().optional().describe("Skip auto-publishing this SDK config to the team registry on publish.")
|
|
94749
|
+
});
|
|
94750
|
+
|
|
94555
94751
|
// ../../packages/scalar-config/dist/schema/site-config.js
|
|
94556
94752
|
var redirectSchema = external_exports.object({
|
|
94557
94753
|
from: external_exports.string(),
|
|
@@ -94650,6 +94846,7 @@ var baseScalarConfigSchema = external_exports.object({
|
|
|
94650
94846
|
insertPageTitles: external_exports.boolean().optional().describe("Whether to insert an H1 with Title and Description at top of each guide page, or not. Deprecated. Write the title and description in the markdown instead."),
|
|
94651
94847
|
assetsDir: external_exports.string().optional().describe("Specify an assets folder to serve custom assets such as media files. These are served globally from the root path, e.g. /picture.png"),
|
|
94652
94848
|
ruleset: rulesetConfigSchema.optional().describe("Default Spectral ruleset and publish policy applied to every OpenAPI route. Per-route ruleset config overrides individual keys."),
|
|
94849
|
+
sdks: external_exports.record(external_exports.string(), sdkConfigSchema).optional().describe("SDKs generated from the project APIs, keyed by SDK slug, each declaring its language targets. Lets the editor resolve SDK info from project APIs offline."),
|
|
94653
94850
|
siteConfig: siteConfigSchema
|
|
94654
94851
|
});
|
|
94655
94852
|
var externalScalarConfigSchema = baseScalarConfigSchema.extend({
|
|
@@ -95102,7 +95299,7 @@ function generateGuideHeader({ header, guides, invalidRefs, references, isGroup
|
|
|
95102
95299
|
invalidRefs,
|
|
95103
95300
|
references,
|
|
95104
95301
|
isGroup: true
|
|
95105
|
-
}).filter((item2) => item2.type !== "group")
|
|
95302
|
+
}).filter((item2) => item2.type !== "group" && item2.type !== "version-selector")
|
|
95106
95303
|
});
|
|
95107
95304
|
}
|
|
95108
95305
|
if (item.type === "guide") {
|
|
@@ -95137,6 +95334,11 @@ function generateGuideHeader({ header, guides, invalidRefs, references, isGroup
|
|
|
95137
95334
|
type: "spacer"
|
|
95138
95335
|
});
|
|
95139
95336
|
}
|
|
95337
|
+
if (item.type === "version-selector") {
|
|
95338
|
+
headerItems.push({
|
|
95339
|
+
type: "version-selector"
|
|
95340
|
+
});
|
|
95341
|
+
}
|
|
95140
95342
|
});
|
|
95141
95343
|
if (!isGroup && !headerItems.some((item) => item.type === "spacer")) {
|
|
95142
95344
|
headerItems.push({
|
|
@@ -95381,7 +95583,7 @@ var wysiwygProjectToV2 = n.safeFn(({ project, invalidRefs, theme }) => {
|
|
|
95381
95583
|
}, (originalError) => createError("FAILED_TO_CONVERT_WYSIWYG_TO_V2", originalError));
|
|
95382
95584
|
|
|
95383
95585
|
// src/domains/project/helpers.ts
|
|
95384
|
-
import
|
|
95586
|
+
import fs12 from "node:fs";
|
|
95385
95587
|
import path5 from "node:path";
|
|
95386
95588
|
var DEFAULT_MARKDOWN_FILE_NAME = "docs-quickstart.md";
|
|
95387
95589
|
var DEFAULT_OPENAPI_FILE_NAME = "docs-openapi.json";
|
|
@@ -95393,7 +95595,7 @@ function findConfig(searchPath) {
|
|
|
95393
95595
|
return searchInDirectory(process.cwd());
|
|
95394
95596
|
}
|
|
95395
95597
|
const searchPathResolved = path5.resolve(searchPath);
|
|
95396
|
-
const stat =
|
|
95598
|
+
const stat = fs12.statSync(searchPathResolved, { throwIfNoEntry: false });
|
|
95397
95599
|
if (!stat) {
|
|
95398
95600
|
return null;
|
|
95399
95601
|
}
|
|
@@ -95410,7 +95612,7 @@ function getCurrentFolderName() {
|
|
|
95410
95612
|
}
|
|
95411
95613
|
function searchInDirectory(directory) {
|
|
95412
95614
|
try {
|
|
95413
|
-
const entries =
|
|
95615
|
+
const entries = fs12.readdirSync(directory);
|
|
95414
95616
|
for (const entry of entries) {
|
|
95415
95617
|
if (entry === CONFIG_FILE_NAME || entry.startsWith(`${CONFIG_FILE_NAME}.`)) {
|
|
95416
95618
|
return path5.join(directory, entry);
|
|
@@ -95436,7 +95638,7 @@ function readAndParseConfig(configPath) {
|
|
|
95436
95638
|
}
|
|
95437
95639
|
};
|
|
95438
95640
|
}
|
|
95439
|
-
const fileContent =
|
|
95641
|
+
const fileContent = fs13.readFileSync(file2, "utf-8");
|
|
95440
95642
|
const parseConfigResult = parseConfig(fileContent);
|
|
95441
95643
|
if (!parseConfigResult.success) {
|
|
95442
95644
|
return {
|
|
@@ -95456,7 +95658,7 @@ function readAndParseConfig(configPath) {
|
|
|
95456
95658
|
};
|
|
95457
95659
|
}
|
|
95458
95660
|
function CheckConfigCommand() {
|
|
95459
|
-
const cmd2 = new
|
|
95661
|
+
const cmd2 = new Command31("check-config");
|
|
95460
95662
|
cmd2.description("Check a Scalar Configuration file");
|
|
95461
95663
|
cmd2.argument("[file]", "File to check");
|
|
95462
95664
|
cmd2.action(async (inputArgument) => {
|
|
@@ -95502,12 +95704,12 @@ import path7 from "node:path";
|
|
|
95502
95704
|
|
|
95503
95705
|
// src/domains/project/download-isolate/index.ts
|
|
95504
95706
|
import { execFile } from "node:child_process";
|
|
95505
|
-
import
|
|
95707
|
+
import fs14 from "node:fs/promises";
|
|
95506
95708
|
import os2 from "node:os";
|
|
95507
95709
|
import path6 from "node:path";
|
|
95508
95710
|
import { Readable } from "node:stream";
|
|
95509
95711
|
import zlib from "node:zlib";
|
|
95510
|
-
import { Command as
|
|
95712
|
+
import { Command as Command32 } from "commander";
|
|
95511
95713
|
import tar from "tar-fs";
|
|
95512
95714
|
|
|
95513
95715
|
// src/helpers/run-command.ts
|
|
@@ -95531,7 +95733,7 @@ var ISOLATE_EXTRACTION_DIR = path6.join(os2.homedir(), ".scalar");
|
|
|
95531
95733
|
var ISOLATE_DIR = path6.join(ISOLATE_EXTRACTION_DIR, "isolate");
|
|
95532
95734
|
async function getExistingIsolateVersion() {
|
|
95533
95735
|
try {
|
|
95534
|
-
const packageJsonString = await
|
|
95736
|
+
const packageJsonString = await fs14.readFile(
|
|
95535
95737
|
path6.join(ISOLATE_DIR, "package.json"),
|
|
95536
95738
|
"utf8"
|
|
95537
95739
|
);
|
|
@@ -95586,7 +95788,7 @@ Remove-Item $tempFile
|
|
|
95586
95788
|
async function downloadIsolate() {
|
|
95587
95789
|
const existingIsolateVersion = await getExistingIsolateVersion();
|
|
95588
95790
|
if (config2.ssgDocsIsolateVersion === existingIsolateVersion) return;
|
|
95589
|
-
await
|
|
95791
|
+
await fs14.rm(ISOLATE_EXTRACTION_DIR, { force: true, recursive: true });
|
|
95590
95792
|
const logger = output.info({ animate: true }).loader("Downloading docs isolate. This may take a minute...");
|
|
95591
95793
|
const ISOLATE_URL = `${config2.cdnUrl}/isolates/${config2.ssgDocsIsolateVersion}-isolate.tar.gz`;
|
|
95592
95794
|
if (process.platform === "win32") {
|
|
@@ -95603,7 +95805,7 @@ async function downloadIsolate() {
|
|
|
95603
95805
|
logger.finish();
|
|
95604
95806
|
}
|
|
95605
95807
|
var DownloadIsolateCommand = () => {
|
|
95606
|
-
const cmd2 = new
|
|
95808
|
+
const cmd2 = new Command32("download-isolate");
|
|
95607
95809
|
cmd2.description("Download the docs isolate");
|
|
95608
95810
|
cmd2.action(async () => {
|
|
95609
95811
|
await downloadIsolate();
|
|
@@ -95661,7 +95863,7 @@ async function previewV2Project({
|
|
|
95661
95863
|
|
|
95662
95864
|
// src/domains/project/preview/index.ts
|
|
95663
95865
|
var PreviewCommand = () => {
|
|
95664
|
-
const cmd2 = new
|
|
95866
|
+
const cmd2 = new Command33("preview");
|
|
95665
95867
|
cmd2.description("Preview scalar guides");
|
|
95666
95868
|
cmd2.argument(
|
|
95667
95869
|
"[config]",
|
|
@@ -95754,9 +95956,9 @@ var PreviewCommand = () => {
|
|
|
95754
95956
|
// src/domains/project/create/index.ts
|
|
95755
95957
|
import { text as text5 } from "@clack/prompts";
|
|
95756
95958
|
import as28 from "ansis";
|
|
95757
|
-
import { Command as
|
|
95959
|
+
import { Command as Command34 } from "commander";
|
|
95758
95960
|
var CreateCommand = () => {
|
|
95759
|
-
const cmd2 = new
|
|
95961
|
+
const cmd2 = new Command34("create");
|
|
95760
95962
|
cmd2.description(
|
|
95761
95963
|
"Create a new project that is not linked to a github project."
|
|
95762
95964
|
);
|
|
@@ -95801,19 +96003,19 @@ Project slug: ${as28.cyan(response.data.slug)}`
|
|
|
95801
96003
|
};
|
|
95802
96004
|
|
|
95803
96005
|
// src/domains/project/init/index.ts
|
|
95804
|
-
import
|
|
96006
|
+
import fs15 from "node:fs/promises";
|
|
95805
96007
|
import path8 from "node:path";
|
|
95806
96008
|
import { cancel, confirm as confirm3, isCancel, text as text6 } from "@clack/prompts";
|
|
95807
96009
|
import as29 from "ansis";
|
|
95808
|
-
import { Command as
|
|
96010
|
+
import { Command as Command35 } from "commander";
|
|
95809
96011
|
|
|
95810
|
-
// ../../node_modules/.pnpm/@scalar+galaxy@0.6.
|
|
96012
|
+
// ../../node_modules/.pnpm/@scalar+galaxy@0.6.7/node_modules/@scalar/galaxy/dist/3.1.json
|
|
95811
96013
|
var __default = {
|
|
95812
96014
|
openapi: "3.1.1",
|
|
95813
96015
|
info: {
|
|
95814
96016
|
title: "Scalar Galaxy",
|
|
95815
96017
|
description: "The Scalar Galaxy is an example OpenAPI document to test OpenAPI tools and libraries. It's a fictional universe with fictional planets and fictional data.\n\n## Resources\n\n* https://github.com/scalar/scalar\n* https://github.com/OAI/OpenAPI-Specification\n* https://scalar.com\n\n## Markdown Support\n\nAll descriptions *can* contain ~~tons of text~~ **Markdown**. [If GitHub supports the syntax](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax), chances are we're supporting it, too.\n\n<details>\n <summary>Examples</summary>\n\n **Blockquotes**\n\n > I love OpenAPI. <3\n\n **Tables**\n\n | Feature | Availability |\n | ---------------- | ------------ |\n | Markdown Support | \u2713 |\n\n **Accordion**\n\n ```html\n <details>\n <summary>Using Details Tags</summary>\n <p>HTML Example</p>\n </details>\n ```\n\n **Images**\n\n Yes, there's support for images, too!\n\n \n\n **Alerts**\n\n > [!tip]\n > You can use Markdown alerts in your descriptions.\n\n</details>\n",
|
|
95816
|
-
version: "0.6.
|
|
96018
|
+
version: "0.6.7",
|
|
95817
96019
|
contact: {
|
|
95818
96020
|
name: "Scalar Support",
|
|
95819
96021
|
url: "https://scalar.com",
|
|
@@ -96301,6 +96503,7 @@ var __default = {
|
|
|
96301
96503
|
"Celestial Bodies"
|
|
96302
96504
|
],
|
|
96303
96505
|
summary: "Create a celestial body",
|
|
96506
|
+
description: "Stars, moons, comets, the occasional rogue asteroid \u2014 if it glows or drifts through the void, you can add it here.",
|
|
96304
96507
|
operationId: "createCelestialBody",
|
|
96305
96508
|
requestBody: {
|
|
96306
96509
|
description: "Celestial body to create",
|
|
@@ -97762,14 +97965,14 @@ We're here to help:
|
|
|
97762
97965
|
// src/domains/project/init/index.ts
|
|
97763
97966
|
async function fileExists2(path13) {
|
|
97764
97967
|
try {
|
|
97765
|
-
await
|
|
97968
|
+
await fs15.access(path13, fs15.constants.F_OK);
|
|
97766
97969
|
return true;
|
|
97767
97970
|
} catch {
|
|
97768
97971
|
return false;
|
|
97769
97972
|
}
|
|
97770
97973
|
}
|
|
97771
97974
|
var InitCommand = () => {
|
|
97772
|
-
const cmd2 = new
|
|
97975
|
+
const cmd2 = new Command35("init");
|
|
97773
97976
|
cmd2.description("Create a new Scalar Docs project.");
|
|
97774
97977
|
cmd2.option("-s, --subdomain [url]", "subdomain to publish on");
|
|
97775
97978
|
cmd2.option("--force", "override existing configuration");
|
|
@@ -97858,12 +98061,12 @@ var InitCommand = () => {
|
|
|
97858
98061
|
}
|
|
97859
98062
|
configuration.siteConfig.subdomain = subdomain.trim();
|
|
97860
98063
|
const content = JSON.stringify(configuration, null, 2);
|
|
97861
|
-
await
|
|
97862
|
-
await
|
|
98064
|
+
await fs15.writeFile(configFile, content);
|
|
98065
|
+
await fs15.writeFile(
|
|
97863
98066
|
path8.join(currentDir, DEFAULT_MARKDOWN_FILE_NAME),
|
|
97864
98067
|
quickstartMarkdown
|
|
97865
98068
|
);
|
|
97866
|
-
await
|
|
98069
|
+
await fs15.writeFile(
|
|
97867
98070
|
path8.join(currentDir, DEFAULT_OPENAPI_FILE_NAME),
|
|
97868
98071
|
JSON.stringify(__default, null, 2)
|
|
97869
98072
|
);
|
|
@@ -97880,12 +98083,12 @@ var InitCommand = () => {
|
|
|
97880
98083
|
};
|
|
97881
98084
|
|
|
97882
98085
|
// src/domains/project/publish/index.ts
|
|
97883
|
-
import
|
|
98086
|
+
import fs17 from "node:fs";
|
|
97884
98087
|
import { dirname } from "node:path";
|
|
97885
|
-
import { Command as
|
|
98088
|
+
import { Command as Command36 } from "commander";
|
|
97886
98089
|
|
|
97887
98090
|
// src/domains/project/publish/publish.ts
|
|
97888
|
-
import
|
|
98091
|
+
import fs16 from "node:fs";
|
|
97889
98092
|
import path9 from "node:path";
|
|
97890
98093
|
import { Readable as Readable2 } from "node:stream";
|
|
97891
98094
|
import ignore from "ignore";
|
|
@@ -97896,7 +98099,7 @@ function isErrnoException(error48) {
|
|
|
97896
98099
|
}
|
|
97897
98100
|
async function readGitIgnore(configDir) {
|
|
97898
98101
|
try {
|
|
97899
|
-
const gitignore = await
|
|
98102
|
+
const gitignore = await fs16.promises.readFile(
|
|
97900
98103
|
path9.resolve(configDir, ".gitignore"),
|
|
97901
98104
|
"utf8"
|
|
97902
98105
|
);
|
|
@@ -98008,7 +98211,7 @@ var sleep = (ms) => {
|
|
|
98008
98211
|
|
|
98009
98212
|
// src/domains/project/publish/index.ts
|
|
98010
98213
|
var PublishCommand = () => {
|
|
98011
|
-
const cmd2 = new
|
|
98214
|
+
const cmd2 = new Command36("publish");
|
|
98012
98215
|
cmd2.description(
|
|
98013
98216
|
"Publish new build for a github sync project that is not linked."
|
|
98014
98217
|
);
|
|
@@ -98089,10 +98292,10 @@ var PublishCommand = () => {
|
|
|
98089
98292
|
});
|
|
98090
98293
|
}
|
|
98091
98294
|
const configPath = configPathOption ?? findConfig();
|
|
98092
|
-
if (!configPath || !
|
|
98295
|
+
if (!configPath || !fs17.existsSync(configPath)) {
|
|
98093
98296
|
return output.error().title("Invalid configuration file").message("Could not find the Scalar Configuration file:").message(configPath ?? "").exit("error");
|
|
98094
98297
|
}
|
|
98095
|
-
const rawConfig =
|
|
98298
|
+
const rawConfig = fs17.readFileSync(configPath, "utf-8");
|
|
98096
98299
|
const configParseResult = parseConfig(rawConfig);
|
|
98097
98300
|
if (!configParseResult.success) {
|
|
98098
98301
|
return output.error().title("Invalid configuration file").line(
|
|
@@ -98176,11 +98379,11 @@ async function getDeployStatus({
|
|
|
98176
98379
|
}
|
|
98177
98380
|
|
|
98178
98381
|
// src/domains/project/upgrade/index.ts
|
|
98179
|
-
import
|
|
98382
|
+
import fs18 from "node:fs/promises";
|
|
98180
98383
|
import path10 from "node:path";
|
|
98181
98384
|
import { text as text7 } from "@clack/prompts";
|
|
98182
98385
|
import as30 from "ansis";
|
|
98183
|
-
import { Command as
|
|
98386
|
+
import { Command as Command37 } from "commander";
|
|
98184
98387
|
import { n as n2 } from "neverpanic";
|
|
98185
98388
|
|
|
98186
98389
|
// src/errors.ts
|
|
@@ -98209,7 +98412,7 @@ function displayError(error48, fallback = "Unknown error occurred. Please contac
|
|
|
98209
98412
|
|
|
98210
98413
|
// src/domains/project/upgrade/index.ts
|
|
98211
98414
|
var UpgradeCommand2 = () => {
|
|
98212
|
-
const cmd2 = new
|
|
98415
|
+
const cmd2 = new Command37("upgrade");
|
|
98213
98416
|
cmd2.description("Upgrade scalar project");
|
|
98214
98417
|
cmd2.argument(
|
|
98215
98418
|
"[config]",
|
|
@@ -98265,7 +98468,7 @@ var UpgradeCommand2 = () => {
|
|
|
98265
98468
|
const { upgradedConfig, legacyTheme, legacyFooter, legacyScript } = upgradedConfigResult.data;
|
|
98266
98469
|
if (legacyTheme) {
|
|
98267
98470
|
const writeUpgradedThemeResult = await n2.fromUnsafe(
|
|
98268
|
-
() =>
|
|
98471
|
+
() => fs18.writeFile(
|
|
98269
98472
|
path10.resolve(
|
|
98270
98473
|
path10.dirname(parseConfigResult.filePath),
|
|
98271
98474
|
config3.root ?? "./",
|
|
@@ -98281,7 +98484,7 @@ var UpgradeCommand2 = () => {
|
|
|
98281
98484
|
}
|
|
98282
98485
|
if (legacyFooter) {
|
|
98283
98486
|
const writeUpgradedFooterResult = await n2.fromUnsafe(
|
|
98284
|
-
() =>
|
|
98487
|
+
() => fs18.writeFile(
|
|
98285
98488
|
path10.resolve(
|
|
98286
98489
|
path10.dirname(parseConfigResult.filePath),
|
|
98287
98490
|
config3.root ?? "./",
|
|
@@ -98297,7 +98500,7 @@ var UpgradeCommand2 = () => {
|
|
|
98297
98500
|
}
|
|
98298
98501
|
if (legacyScript) {
|
|
98299
98502
|
const writeUpgradedScriptResult = await n2.fromUnsafe(
|
|
98300
|
-
() =>
|
|
98503
|
+
() => fs18.writeFile(
|
|
98301
98504
|
path10.resolve(
|
|
98302
98505
|
path10.dirname(parseConfigResult.filePath),
|
|
98303
98506
|
config3.root ?? "./",
|
|
@@ -98312,7 +98515,7 @@ var UpgradeCommand2 = () => {
|
|
|
98312
98515
|
}
|
|
98313
98516
|
}
|
|
98314
98517
|
const writeUpgradedConfigResult = await n2.fromUnsafe(
|
|
98315
|
-
() =>
|
|
98518
|
+
() => fs18.writeFile(
|
|
98316
98519
|
parseConfigResult.filePath,
|
|
98317
98520
|
JSON.stringify(upgradedConfig, null, 2)
|
|
98318
98521
|
),
|
|
@@ -98335,22 +98538,22 @@ var projectCommands = [
|
|
|
98335
98538
|
PublishCommand,
|
|
98336
98539
|
UpgradeCommand2
|
|
98337
98540
|
];
|
|
98338
|
-
var projectDomain = new
|
|
98541
|
+
var projectDomain = new Command38("project");
|
|
98339
98542
|
projectDomain.description("Manage scalar project");
|
|
98340
98543
|
projectCommands.forEach((command) => projectDomain.addCommand(command()));
|
|
98341
98544
|
projectDomain.addCommand(DownloadIsolateCommand(), { hidden: true });
|
|
98342
98545
|
var project_default = projectDomain;
|
|
98343
98546
|
|
|
98344
98547
|
// src/domains/readme/index.ts
|
|
98345
|
-
import { Command as
|
|
98548
|
+
import { Command as Command40 } from "commander";
|
|
98346
98549
|
|
|
98347
98550
|
// src/domains/readme/generate.ts
|
|
98348
98551
|
import { text as text8 } from "@clack/prompts";
|
|
98349
98552
|
import as31 from "ansis";
|
|
98350
|
-
import { Command as
|
|
98553
|
+
import { Command as Command39 } from "commander";
|
|
98351
98554
|
|
|
98352
98555
|
// src/helpers/documentation/index.ts
|
|
98353
|
-
import
|
|
98556
|
+
import fs19 from "node:fs/promises";
|
|
98354
98557
|
import path11 from "node:path";
|
|
98355
98558
|
var generateDocs = (command, depth = 0) => {
|
|
98356
98559
|
if (command._hidden) return [];
|
|
@@ -98380,13 +98583,13 @@ ${docs.content}${codeBlock}`);
|
|
|
98380
98583
|
};
|
|
98381
98584
|
var generateDocumentationFile = async (outputPath) => {
|
|
98382
98585
|
const commandDocumentation = generateCommandDocumentation(getProgram());
|
|
98383
|
-
const template = await
|
|
98586
|
+
const template = await fs19.readFile(
|
|
98384
98587
|
path11.join(import.meta.dirname, "template.md"),
|
|
98385
98588
|
{
|
|
98386
98589
|
encoding: "utf-8"
|
|
98387
98590
|
}
|
|
98388
98591
|
);
|
|
98389
|
-
await
|
|
98592
|
+
await fs19.writeFile(
|
|
98390
98593
|
outputPath,
|
|
98391
98594
|
template.replace("<COMMANDS>", commandDocumentation)
|
|
98392
98595
|
);
|
|
@@ -98394,7 +98597,7 @@ var generateDocumentationFile = async (outputPath) => {
|
|
|
98394
98597
|
|
|
98395
98598
|
// src/domains/readme/generate.ts
|
|
98396
98599
|
function GenerateReadmeCommand() {
|
|
98397
|
-
const cmd2 = new
|
|
98600
|
+
const cmd2 = new Command39("generate");
|
|
98398
98601
|
cmd2.description("Self generate documentation for the cli");
|
|
98399
98602
|
cmd2.option(
|
|
98400
98603
|
"-o, --output [file]",
|
|
@@ -98427,12 +98630,12 @@ function GenerateReadmeCommand() {
|
|
|
98427
98630
|
}
|
|
98428
98631
|
|
|
98429
98632
|
// src/domains/readme/serve.ts
|
|
98430
|
-
import
|
|
98633
|
+
import fs20 from "node:fs/promises";
|
|
98431
98634
|
import path12 from "node:path";
|
|
98432
98635
|
import as32 from "ansis";
|
|
98433
98636
|
var fileExists3 = async (filePath) => {
|
|
98434
98637
|
try {
|
|
98435
|
-
await
|
|
98638
|
+
await fs20.access(filePath);
|
|
98436
98639
|
return true;
|
|
98437
98640
|
} catch {
|
|
98438
98641
|
return false;
|
|
@@ -98457,30 +98660,23 @@ function ServeReadmeCommand(cmd2) {
|
|
|
98457
98660
|
}
|
|
98458
98661
|
|
|
98459
98662
|
// src/domains/readme/index.ts
|
|
98460
|
-
var readmeDomain = new
|
|
98663
|
+
var readmeDomain = new Command40("readme");
|
|
98461
98664
|
readmeDomain.addCommand(GenerateReadmeCommand());
|
|
98462
98665
|
ServeReadmeCommand(readmeDomain);
|
|
98463
98666
|
var readme_default = readmeDomain;
|
|
98464
98667
|
|
|
98465
98668
|
// src/domains/registry/index.ts
|
|
98466
|
-
import { Command as
|
|
98669
|
+
import { Command as Command46 } from "commander";
|
|
98467
98670
|
|
|
98468
98671
|
// src/domains/registry/publish/index.ts
|
|
98469
98672
|
import { text as text9 } from "@clack/prompts";
|
|
98470
98673
|
import as33 from "ansis";
|
|
98471
|
-
import { Command as
|
|
98674
|
+
import { Command as Command41 } from "commander";
|
|
98472
98675
|
import { bundle as bundle4 } from "@scalar/json-magic/bundle";
|
|
98473
98676
|
import { fetchUrls as fetchUrls4, readFiles as readFiles4 } from "@scalar/json-magic/bundle/plugins/node";
|
|
98474
98677
|
import { parseJsonOrYaml as parseJsonOrYaml2 } from "@scalar/oas-utils/helpers";
|
|
98475
|
-
|
|
98476
|
-
// src/domains/registry/publish/helpers/links.ts
|
|
98477
|
-
function apiDashboardUrl(uid) {
|
|
98478
|
-
return `${config2.projects.dashboard}/registry/apis/${uid}`;
|
|
98479
|
-
}
|
|
98480
|
-
|
|
98481
|
-
// src/domains/registry/publish/index.ts
|
|
98482
98678
|
var PublishCommand2 = () => {
|
|
98483
|
-
const cmd2 = new
|
|
98679
|
+
const cmd2 = new Command41("publish");
|
|
98484
98680
|
cmd2.description("Publish an OpenAPI document to the Scalar registry");
|
|
98485
98681
|
cmd2.argument("[file]", "OpenAPI file to upload");
|
|
98486
98682
|
cmd2.option(
|
|
@@ -98613,18 +98809,19 @@ var PublishCommand2 = () => {
|
|
|
98613
98809
|
content: `Successfully published v${version3} for ${apiSlug}.`
|
|
98614
98810
|
}).line().print();
|
|
98615
98811
|
const api = registry2(namespace).apis(apiSlug);
|
|
98616
|
-
const
|
|
98812
|
+
const apiUrl = dashboardUrl(
|
|
98813
|
+
RegistryAsset2.Apis,
|
|
98617
98814
|
matchingApi?.uid ?? publishRes.data.uid
|
|
98618
98815
|
);
|
|
98619
|
-
output.info().line(`${as33.green("\u279C")} ${as33.white.bold("View in dashboard:")}`).line(as33.cyan(
|
|
98816
|
+
output.info().line(`${as33.green("\u279C")} ${as33.white.bold("View in dashboard:")}`).line(as33.cyan(apiUrl)).line().line(`${as33.green("\u279C")} ${as33.white.bold("Registry Preview:")}`).line(as33.cyan(registryUrl(api.url({ version: version3 })))).line().line(`${as33.green("\u279C")} ${as33.white.bold("Registry YAML:")}`).line(as33.cyan(registryUrl(api.url({ version: version3, format: "yaml" })))).line().line(`${as33.green("\u279C")} ${as33.white.bold("Registry JSON:")}`).line(as33.cyan(registryUrl(api.url({ version: version3, format: "json" })))).print();
|
|
98620
98817
|
});
|
|
98621
98818
|
return cmd2;
|
|
98622
98819
|
};
|
|
98623
98820
|
|
|
98624
98821
|
// src/domains/registry/delete/index.ts
|
|
98625
|
-
import { Command as
|
|
98822
|
+
import { Command as Command42 } from "commander";
|
|
98626
98823
|
var DeleteCommand = () => {
|
|
98627
|
-
const cmd2 = new
|
|
98824
|
+
const cmd2 = new Command42("delete");
|
|
98628
98825
|
cmd2.description("Delete a document from scalar registry");
|
|
98629
98826
|
cmd2.argument("[namespace]", "Team namespace");
|
|
98630
98827
|
cmd2.argument("[slug]", "Managed doc slug");
|
|
@@ -98641,11 +98838,11 @@ var DeleteCommand = () => {
|
|
|
98641
98838
|
};
|
|
98642
98839
|
|
|
98643
98840
|
// src/domains/registry/get/index.ts
|
|
98644
|
-
import
|
|
98645
|
-
import { Command as
|
|
98646
|
-
var
|
|
98841
|
+
import fs21 from "node:fs/promises";
|
|
98842
|
+
import { Command as Command43 } from "commander";
|
|
98843
|
+
var versionSchema4 = external_exports.union([docVersionSchema, external_exports.literal("latest")]);
|
|
98647
98844
|
var GetCommand = () => {
|
|
98648
|
-
const cmd2 = new
|
|
98845
|
+
const cmd2 = new Command43("get");
|
|
98649
98846
|
cmd2.description("Get a document version from scalar registry");
|
|
98650
98847
|
cmd2.argument("[namespace]", "Team namespace");
|
|
98651
98848
|
cmd2.argument("[slug]", "Managed doc slug");
|
|
@@ -98662,7 +98859,7 @@ var GetCommand = () => {
|
|
|
98662
98859
|
return;
|
|
98663
98860
|
}
|
|
98664
98861
|
const result = external_exports.object({
|
|
98665
|
-
version:
|
|
98862
|
+
version: versionSchema4,
|
|
98666
98863
|
format: external_exports.enum(["json", "yaml"]),
|
|
98667
98864
|
output: external_exports.string().min(1).optional()
|
|
98668
98865
|
}).safeParse({
|
|
@@ -98676,38 +98873,28 @@ var GetCommand = () => {
|
|
|
98676
98873
|
}
|
|
98677
98874
|
const auth = await getAuthData();
|
|
98678
98875
|
auth.addEventListener((state) => Object.assign(auth, state));
|
|
98679
|
-
const
|
|
98876
|
+
const fetchResult = await fetchFromRegistry(
|
|
98680
98877
|
registry2(namespace).apis(slug).url({
|
|
98681
98878
|
version: result.data.version,
|
|
98682
98879
|
format: result.data.format
|
|
98683
|
-
})
|
|
98880
|
+
}),
|
|
98881
|
+
auth.accessToken
|
|
98684
98882
|
);
|
|
98685
|
-
|
|
98686
|
-
|
|
98687
|
-
getDocument = await fetch(registryDocumentUrl, {
|
|
98688
|
-
headers: {
|
|
98689
|
-
"x-scalar-auth": auth.accessToken
|
|
98690
|
-
},
|
|
98691
|
-
// Should always error on redirect
|
|
98692
|
-
redirect: "error"
|
|
98693
|
-
});
|
|
98694
|
-
} catch (error48) {
|
|
98695
|
-
const message = error48 instanceof Error && error48.message.length > 0 ? error48.message : "Registry request failed before a response was received.";
|
|
98696
|
-
output.error().title("Unable to download document").message(message).exit("error");
|
|
98883
|
+
if (fetchResult.error) {
|
|
98884
|
+
output.error().title("Unable to download document").message(fetchResult.message).exit("error");
|
|
98697
98885
|
return;
|
|
98698
98886
|
}
|
|
98699
|
-
|
|
98700
|
-
const message = await getDocument.text();
|
|
98701
|
-
output.error().title("Unable to download document").message(
|
|
98702
|
-
message.length ? message : `Registry request failed with status ${getDocument.status}.`
|
|
98703
|
-
).exit("error");
|
|
98704
|
-
return;
|
|
98705
|
-
}
|
|
98706
|
-
const document2 = await getDocument.text();
|
|
98887
|
+
const document2 = fetchResult.data;
|
|
98707
98888
|
const withTrailingNewline = document2.endsWith("\n") ? document2 : `${document2}
|
|
98708
98889
|
`;
|
|
98709
98890
|
if (result.data.output) {
|
|
98710
|
-
|
|
98891
|
+
try {
|
|
98892
|
+
await fs21.writeFile(result.data.output, withTrailingNewline, "utf8");
|
|
98893
|
+
} catch (error48) {
|
|
98894
|
+
const message = error48 instanceof Error && error48.message.length > 0 ? error48.message : `Could not write to ${result.data.output}.`;
|
|
98895
|
+
output.error().title("Unable to write document to file").message(message).exit("error");
|
|
98896
|
+
return;
|
|
98897
|
+
}
|
|
98711
98898
|
output.info().line(
|
|
98712
98899
|
`Downloaded ${namespace}/${slug}@${result.data.version} (${result.data.format})`
|
|
98713
98900
|
).line(`Written to ${result.data.output}`).print();
|
|
@@ -98720,9 +98907,9 @@ var GetCommand = () => {
|
|
|
98720
98907
|
|
|
98721
98908
|
// src/domains/registry/list/index.ts
|
|
98722
98909
|
import as34 from "ansis";
|
|
98723
|
-
import { Command as
|
|
98910
|
+
import { Command as Command44 } from "commander";
|
|
98724
98911
|
var ListCommand = () => {
|
|
98725
|
-
const cmd2 = new
|
|
98912
|
+
const cmd2 = new Command44("list");
|
|
98726
98913
|
cmd2.description("List all registry APIs for a team namespace");
|
|
98727
98914
|
cmd2.option("--namespace <namespace>", "Team namespace");
|
|
98728
98915
|
cmd2.action(async (args) => {
|
|
@@ -98781,9 +98968,9 @@ var ListCommand = () => {
|
|
|
98781
98968
|
// src/domains/registry/update/index.ts
|
|
98782
98969
|
import { text as text10 } from "@clack/prompts";
|
|
98783
98970
|
import as35 from "ansis";
|
|
98784
|
-
import { Command as
|
|
98971
|
+
import { Command as Command45 } from "commander";
|
|
98785
98972
|
var UpdateCommand = () => {
|
|
98786
|
-
const cmd2 = new
|
|
98973
|
+
const cmd2 = new Command45("update");
|
|
98787
98974
|
cmd2.description("Update document metadata on scalar registry");
|
|
98788
98975
|
cmd2.argument("[namespace]", "namespace of document you want to update");
|
|
98789
98976
|
cmd2.argument("[slug]", "slug of document you want to update");
|
|
@@ -98837,17 +99024,17 @@ var registryCommands = [
|
|
|
98837
99024
|
ListCommand,
|
|
98838
99025
|
GetCommand
|
|
98839
99026
|
];
|
|
98840
|
-
var registryDomain = new
|
|
99027
|
+
var registryDomain = new Command46("registry");
|
|
98841
99028
|
registryDomain.description("Manage your scalar registry");
|
|
98842
99029
|
registryCommands.forEach((command) => registryDomain.addCommand(command()));
|
|
98843
99030
|
var registry_default = registryDomain;
|
|
98844
99031
|
|
|
98845
99032
|
// src/domains/team/index.ts
|
|
98846
|
-
import { Command as
|
|
99033
|
+
import { Command as Command49 } from "commander";
|
|
98847
99034
|
|
|
98848
99035
|
// src/domains/team/list/index.ts
|
|
98849
99036
|
import as36 from "ansis";
|
|
98850
|
-
import { Command as
|
|
99037
|
+
import { Command as Command47 } from "commander";
|
|
98851
99038
|
|
|
98852
99039
|
// src/domains/team/helpers.ts
|
|
98853
99040
|
var getUserTeams = async (client, email3) => {
|
|
@@ -98862,7 +99049,7 @@ var getUserTeams = async (client, email3) => {
|
|
|
98862
99049
|
|
|
98863
99050
|
// src/domains/team/list/index.ts
|
|
98864
99051
|
var ListCommand2 = () => {
|
|
98865
|
-
const cmd2 = new
|
|
99052
|
+
const cmd2 = new Command47("list");
|
|
98866
99053
|
cmd2.description("List all teams current user is part of");
|
|
98867
99054
|
cmd2.action(async () => {
|
|
98868
99055
|
const auth = await getAuthData();
|
|
@@ -98888,9 +99075,9 @@ var ListCommand2 = () => {
|
|
|
98888
99075
|
// src/domains/team/set/index.ts
|
|
98889
99076
|
import { select as select7 } from "@clack/prompts";
|
|
98890
99077
|
import as37 from "ansis";
|
|
98891
|
-
import { Command as
|
|
99078
|
+
import { Command as Command48 } from "commander";
|
|
98892
99079
|
var SetCommand = () => {
|
|
98893
|
-
const cmd2 = new
|
|
99080
|
+
const cmd2 = new Command48("set");
|
|
98894
99081
|
cmd2.description("Set current active team for the user");
|
|
98895
99082
|
cmd2.option("--team <team>", "Team uid");
|
|
98896
99083
|
cmd2.action(async ({ team }) => {
|
|
@@ -98930,7 +99117,7 @@ var SetCommand = () => {
|
|
|
98930
99117
|
|
|
98931
99118
|
// src/domains/team/index.ts
|
|
98932
99119
|
var teamCommands = [ListCommand2, SetCommand];
|
|
98933
|
-
var teamDomain = new
|
|
99120
|
+
var teamDomain = new Command49("team");
|
|
98934
99121
|
teamDomain.description("Manage user teams");
|
|
98935
99122
|
teamCommands.forEach((command) => teamDomain.addCommand(command()));
|
|
98936
99123
|
var team_default = teamDomain;
|
|
@@ -98938,11 +99125,11 @@ var team_default = teamDomain;
|
|
|
98938
99125
|
// src/domains/upgrade/index.ts
|
|
98939
99126
|
import { execSync } from "node:child_process";
|
|
98940
99127
|
import as39 from "ansis";
|
|
98941
|
-
import { Command as
|
|
99128
|
+
import { Command as Command50 } from "commander";
|
|
98942
99129
|
|
|
98943
99130
|
// src/helpers/upgrade.ts
|
|
98944
99131
|
import as38 from "ansis";
|
|
98945
|
-
import
|
|
99132
|
+
import semver5 from "semver";
|
|
98946
99133
|
var packageJsonSchema = external_exports.object({
|
|
98947
99134
|
version: external_exports.string()
|
|
98948
99135
|
});
|
|
@@ -98955,7 +99142,7 @@ async function getRemotePackageJson(packageName, version3 = "latest") {
|
|
|
98955
99142
|
}
|
|
98956
99143
|
async function getUpgradeInformation() {
|
|
98957
99144
|
const { version: latestVersion } = await getRemotePackageJson(name);
|
|
98958
|
-
if (
|
|
99145
|
+
if (semver5.gte(version, latestVersion)) {
|
|
98959
99146
|
return {
|
|
98960
99147
|
upgrade: false
|
|
98961
99148
|
};
|
|
@@ -98988,13 +99175,13 @@ async function checkUpgrade() {
|
|
|
98988
99175
|
}
|
|
98989
99176
|
}).catch();
|
|
98990
99177
|
}
|
|
98991
|
-
if (
|
|
99178
|
+
if (semver5.lt(version, lastKnownVersion)) {
|
|
98992
99179
|
emitOutput();
|
|
98993
99180
|
}
|
|
98994
99181
|
}
|
|
98995
99182
|
|
|
98996
99183
|
// src/domains/upgrade/index.ts
|
|
98997
|
-
var cmd = new
|
|
99184
|
+
var cmd = new Command50("upgrade");
|
|
98998
99185
|
cmd.description("Upgrade current version of your cli");
|
|
98999
99186
|
cmd.action(async () => {
|
|
99000
99187
|
const upgradeStatus = await getUpgradeInformation();
|
|
@@ -99032,7 +99219,7 @@ var domains_default = domains;
|
|
|
99032
99219
|
|
|
99033
99220
|
// src/program.ts
|
|
99034
99221
|
var getProgram = () => {
|
|
99035
|
-
const program2 = new
|
|
99222
|
+
const program2 = new Command51();
|
|
99036
99223
|
program2.enablePositionalOptions().name(Object.keys(bin)[0]).description("CLI to work with your OpenAPI files").version(version, "-v, --version");
|
|
99037
99224
|
program2.showHelpAfterError();
|
|
99038
99225
|
domains_default.forEach((domain2) => program2.addCommand(domain2));
|