@lukoweb/apitogo 0.2.22 → 0.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cli.js +248 -215
- package/package.json +1 -1
package/dist/cli/cli.js
CHANGED
|
@@ -836,7 +836,7 @@ import { stat as stat4 } from "node:fs/promises";
|
|
|
836
836
|
var fileExists;
|
|
837
837
|
var init_file_exists = __esm({
|
|
838
838
|
"src/config/file-exists.ts"() {
|
|
839
|
-
fileExists = (
|
|
839
|
+
fileExists = (path104) => stat4(path104).then(() => true).catch(() => false);
|
|
840
840
|
}
|
|
841
841
|
});
|
|
842
842
|
|
|
@@ -6189,8 +6189,8 @@ var ConfigV2Schema = z.strictObject({
|
|
|
6189
6189
|
var REMOVED_KEYS = {
|
|
6190
6190
|
"plans.provider": "plans.provider was removed. Only plans.billing.provider (stripe or none) is selectable."
|
|
6191
6191
|
};
|
|
6192
|
-
function pathToString(
|
|
6193
|
-
return
|
|
6192
|
+
function pathToString(path104) {
|
|
6193
|
+
return path104.reduce(
|
|
6194
6194
|
(acc, segment) => typeof segment === "number" ? `${acc}[${segment}]` : acc === "" ? String(segment) : `${acc}.${String(segment)}`,
|
|
6195
6195
|
""
|
|
6196
6196
|
);
|
|
@@ -6210,9 +6210,9 @@ function step(schema2, segment) {
|
|
|
6210
6210
|
}
|
|
6211
6211
|
return void 0;
|
|
6212
6212
|
}
|
|
6213
|
-
function knownKeysAt(
|
|
6213
|
+
function knownKeysAt(path104) {
|
|
6214
6214
|
let current = ConfigV2Schema;
|
|
6215
|
-
for (const segment of
|
|
6215
|
+
for (const segment of path104) {
|
|
6216
6216
|
if (!current) return [];
|
|
6217
6217
|
current = step(current, segment);
|
|
6218
6218
|
}
|
|
@@ -6248,7 +6248,7 @@ function unknownKeyHint(fullPath, key, known) {
|
|
|
6248
6248
|
return known.length > 0 ? `Allowed keys: ${known.join(", ")}.` : void 0;
|
|
6249
6249
|
}
|
|
6250
6250
|
function mapIssue(issue4) {
|
|
6251
|
-
const
|
|
6251
|
+
const path104 = pathToString(issue4.path);
|
|
6252
6252
|
switch (issue4.code) {
|
|
6253
6253
|
case "unrecognized_keys":
|
|
6254
6254
|
return issue4.keys.map((key) => {
|
|
@@ -6264,20 +6264,20 @@ function mapIssue(issue4) {
|
|
|
6264
6264
|
return [
|
|
6265
6265
|
{
|
|
6266
6266
|
code: "CONFIG_INVALID_VALUE",
|
|
6267
|
-
path:
|
|
6267
|
+
path: path104,
|
|
6268
6268
|
message: `must be one of: ${issue4.values.map((v) => JSON.stringify(v)).join(", ")}.`
|
|
6269
6269
|
}
|
|
6270
6270
|
];
|
|
6271
6271
|
case "custom": {
|
|
6272
6272
|
const code = typeof issue4.params?.code === "string" ? issue4.params.code : "CONFIG_INVALID_VALUE";
|
|
6273
|
-
return [{ code, path:
|
|
6273
|
+
return [{ code, path: path104, message: issue4.message ?? "is invalid." }];
|
|
6274
6274
|
}
|
|
6275
6275
|
case "invalid_type":
|
|
6276
6276
|
return [
|
|
6277
|
-
/received undefined/.test(issue4.message) ? { code: "CONFIG_MISSING_FIELD", path:
|
|
6277
|
+
/received undefined/.test(issue4.message) ? { code: "CONFIG_MISSING_FIELD", path: path104, message: "is required." } : { code: "CONFIG_INVALID_VALUE", path: path104, message: issue4.message }
|
|
6278
6278
|
];
|
|
6279
6279
|
default:
|
|
6280
|
-
return [{ code: "CONFIG_INVALID_VALUE", path:
|
|
6280
|
+
return [{ code: "CONFIG_INVALID_VALUE", path: path104, message: issue4.message }];
|
|
6281
6281
|
}
|
|
6282
6282
|
}
|
|
6283
6283
|
function isRecord(value) {
|
|
@@ -7301,7 +7301,7 @@ var ServiceManifestSchema = z3.looseObject({
|
|
|
7301
7301
|
}).optional()
|
|
7302
7302
|
}).default({})
|
|
7303
7303
|
});
|
|
7304
|
-
var issue = (code,
|
|
7304
|
+
var issue = (code, path104, message, hint) => ({ code, path: path104, message, hint });
|
|
7305
7305
|
function parseManifest(raw, file = "services.json") {
|
|
7306
7306
|
const version = typeof raw === "object" && raw !== null && "schemaVersion" in raw ? raw.schemaVersion : void 0;
|
|
7307
7307
|
if (typeof version === "number" && version > SUPPORTED_MANIFEST_SCHEMA) {
|
|
@@ -7555,8 +7555,8 @@ var METHODS = [
|
|
|
7555
7555
|
"trace"
|
|
7556
7556
|
];
|
|
7557
7557
|
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7558
|
-
function actionKey(method,
|
|
7559
|
-
const trimmed =
|
|
7558
|
+
function actionKey(method, path104) {
|
|
7559
|
+
const trimmed = path104.trim();
|
|
7560
7560
|
const withSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
7561
7561
|
const normalized = withSlash.length > 1 ? withSlash.replace(/\/+$/, "") || "/" : withSlash;
|
|
7562
7562
|
return `${method.trim().toLowerCase()}:${normalized}`;
|
|
@@ -7566,8 +7566,8 @@ function configActionKey(entry) {
|
|
|
7566
7566
|
return match?.[1] && match[2] ? actionKey(match[1], match[2]) : void 0;
|
|
7567
7567
|
}
|
|
7568
7568
|
function referenceOptions(gateway, gatewayBaseUrl, keyHeaderName) {
|
|
7569
|
-
const
|
|
7570
|
-
const jwt =
|
|
7569
|
+
const access17 = gateway.policies.access;
|
|
7570
|
+
const jwt = access17?.jwt ?? gateway.auth !== void 0;
|
|
7571
7571
|
const keys = (list2) => new Set(
|
|
7572
7572
|
(list2 ?? []).flatMap((entry) => {
|
|
7573
7573
|
const key = configActionKey(entry);
|
|
@@ -7579,8 +7579,8 @@ function referenceOptions(gateway, gatewayBaseUrl, keyHeaderName) {
|
|
|
7579
7579
|
originUrl: gateway.origin.url,
|
|
7580
7580
|
jwtRequired: jwt && gateway.auth !== void 0,
|
|
7581
7581
|
oidcMetadataUrl: jwt ? gateway.auth?.metadataUrl : void 0,
|
|
7582
|
-
apiKeyRequired:
|
|
7583
|
-
apiKeyHeader: keyHeaderName ??
|
|
7582
|
+
apiKeyRequired: access17?.apiKey ?? true,
|
|
7583
|
+
apiKeyHeader: keyHeaderName ?? access17?.apiKeyHeader ?? DEFAULT_KEY_HEADER,
|
|
7584
7584
|
publicOperations: keys(gateway.policies.operations?.public),
|
|
7585
7585
|
deniedOperations: keys(gateway.policies.operations?.deny)
|
|
7586
7586
|
};
|
|
@@ -7593,8 +7593,8 @@ var ReferenceSpecError = class extends Error {
|
|
|
7593
7593
|
};
|
|
7594
7594
|
function operationsOf(paths) {
|
|
7595
7595
|
return Object.entries(paths).flatMap(
|
|
7596
|
-
([
|
|
7597
|
-
(method) => [
|
|
7596
|
+
([path104, item]) => isObject(item) ? METHODS.filter((method) => isObject(item[method])).map(
|
|
7597
|
+
(method) => [path104, item, method]
|
|
7598
7598
|
) : []
|
|
7599
7599
|
);
|
|
7600
7600
|
}
|
|
@@ -7609,14 +7609,14 @@ function buildReferenceSpec(specText, options) {
|
|
|
7609
7609
|
throw new ReferenceSpecError("The OpenAPI file could not be read.");
|
|
7610
7610
|
const doc = structuredClone(root);
|
|
7611
7611
|
const paths = isObject(doc.paths) ? doc.paths : {};
|
|
7612
|
-
for (const [
|
|
7613
|
-
if (options.deniedOperations.has(actionKey(method,
|
|
7612
|
+
for (const [path104, item, method] of operationsOf(paths))
|
|
7613
|
+
if (options.deniedOperations.has(actionKey(method, path104)))
|
|
7614
7614
|
delete item[method];
|
|
7615
|
-
for (const [
|
|
7615
|
+
for (const [path104, item] of Object.entries(paths))
|
|
7616
7616
|
if (!isObject(item) || !METHODS.some((method) => method in item))
|
|
7617
|
-
delete paths[
|
|
7618
|
-
for (const [
|
|
7619
|
-
if (options.publicOperations.has(actionKey(method,
|
|
7617
|
+
delete paths[path104];
|
|
7618
|
+
for (const [path104, item, method] of operationsOf(paths))
|
|
7619
|
+
if (options.publicOperations.has(actionKey(method, path104)))
|
|
7620
7620
|
item[method].security = [];
|
|
7621
7621
|
doc.servers = [{ url: options.gatewayBaseUrl.replace(/\/+$/, "") }];
|
|
7622
7622
|
for (const item of Object.values(paths)) {
|
|
@@ -9003,8 +9003,8 @@ var PlatformApiClient = class {
|
|
|
9003
9003
|
constructor(config2) {
|
|
9004
9004
|
this.config = config2;
|
|
9005
9005
|
}
|
|
9006
|
-
url(
|
|
9007
|
-
return `${this.config.apiUrl}${
|
|
9006
|
+
url(path104) {
|
|
9007
|
+
return `${this.config.apiUrl}${path104.startsWith("/") ? path104 : `/${path104}`}`;
|
|
9008
9008
|
}
|
|
9009
9009
|
headers(extra) {
|
|
9010
9010
|
return {
|
|
@@ -9014,9 +9014,9 @@ var PlatformApiClient = class {
|
|
|
9014
9014
|
...extra
|
|
9015
9015
|
};
|
|
9016
9016
|
}
|
|
9017
|
-
async request(method,
|
|
9017
|
+
async request(method, path104, init4) {
|
|
9018
9018
|
const response = await fetchWithRetry(
|
|
9019
|
-
this.url(
|
|
9019
|
+
this.url(path104),
|
|
9020
9020
|
{
|
|
9021
9021
|
method,
|
|
9022
9022
|
...init4,
|
|
@@ -9425,15 +9425,15 @@ var PlatformApiClient = class {
|
|
|
9425
9425
|
}
|
|
9426
9426
|
);
|
|
9427
9427
|
}
|
|
9428
|
-
deleteDevPortalPage(projectId,
|
|
9429
|
-
const query = new URLSearchParams({ path:
|
|
9428
|
+
deleteDevPortalPage(projectId, path104) {
|
|
9429
|
+
const query = new URLSearchParams({ path: path104 });
|
|
9430
9430
|
return this.request(
|
|
9431
9431
|
"DELETE",
|
|
9432
9432
|
`/api/v1/projects/${projectId}/dev-portal/pages/files?${query.toString()}`
|
|
9433
9433
|
);
|
|
9434
9434
|
}
|
|
9435
|
-
renameDevPortalPage(projectId,
|
|
9436
|
-
const query = new URLSearchParams({ path:
|
|
9435
|
+
renameDevPortalPage(projectId, path104, newName) {
|
|
9436
|
+
const query = new URLSearchParams({ path: path104 });
|
|
9437
9437
|
return this.request(
|
|
9438
9438
|
"POST",
|
|
9439
9439
|
`/api/v1/projects/${projectId}/dev-portal/pages/files/rename?${query.toString()}`,
|
|
@@ -9549,8 +9549,8 @@ var PlatformApiClient = class {
|
|
|
9549
9549
|
* the project-less endpoint is used; `planTier` overrides the tier used for paid-plan checks.
|
|
9550
9550
|
*/
|
|
9551
9551
|
validateGatewayPlans(plans, options = {}) {
|
|
9552
|
-
const
|
|
9553
|
-
return this.request("POST",
|
|
9552
|
+
const path104 = options.projectId ? `/api/v1/projects/${options.projectId}/gateway/plans/validate` : "/api/v1/gateway/plans/validate";
|
|
9553
|
+
return this.request("POST", path104, {
|
|
9554
9554
|
headers: { "Content-Type": "application/json" },
|
|
9555
9555
|
body: JSON.stringify({ plans, planTier: options.planTier })
|
|
9556
9556
|
});
|
|
@@ -9754,7 +9754,6 @@ import {
|
|
|
9754
9754
|
rm as rm8,
|
|
9755
9755
|
writeFile as writeFile14
|
|
9756
9756
|
} from "node:fs/promises";
|
|
9757
|
-
import { createRequire as createRequire2 } from "node:module";
|
|
9758
9757
|
import path48 from "node:path";
|
|
9759
9758
|
|
|
9760
9759
|
// src/vite/build.ts
|
|
@@ -9906,7 +9905,7 @@ import {
|
|
|
9906
9905
|
// package.json
|
|
9907
9906
|
var package_default = {
|
|
9908
9907
|
name: "@lukoweb/apitogo",
|
|
9909
|
-
version: "0.2.
|
|
9908
|
+
version: "0.2.23",
|
|
9910
9909
|
type: "module",
|
|
9911
9910
|
sideEffects: [
|
|
9912
9911
|
"**/*.css",
|
|
@@ -10688,14 +10687,14 @@ var flattenAllOf = (schema2) => {
|
|
|
10688
10687
|
};
|
|
10689
10688
|
|
|
10690
10689
|
// src/lib/util/traverse.ts
|
|
10691
|
-
var traverse = (specification, transform,
|
|
10692
|
-
const transformed = transform(specification,
|
|
10690
|
+
var traverse = (specification, transform, path104 = []) => {
|
|
10691
|
+
const transformed = transform(specification, path104);
|
|
10693
10692
|
if (typeof transformed !== "object" || transformed === null) {
|
|
10694
10693
|
return transformed;
|
|
10695
10694
|
}
|
|
10696
10695
|
const result = Array.isArray(transformed) ? [] : {};
|
|
10697
10696
|
for (const [key, value] of Object.entries(transformed)) {
|
|
10698
|
-
const currentPath = [...
|
|
10697
|
+
const currentPath = [...path104, key];
|
|
10699
10698
|
if (Array.isArray(value)) {
|
|
10700
10699
|
result[key] = value.map(
|
|
10701
10700
|
(item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
|
|
@@ -10723,9 +10722,9 @@ var resolveLocalRef = (schema2, ref) => {
|
|
|
10723
10722
|
if (schemaCache?.has(ref)) {
|
|
10724
10723
|
return schemaCache.get(ref);
|
|
10725
10724
|
}
|
|
10726
|
-
const
|
|
10725
|
+
const path104 = ref.split("/").slice(1);
|
|
10727
10726
|
let current = schema2;
|
|
10728
|
-
for (const segment of
|
|
10727
|
+
for (const segment of path104) {
|
|
10729
10728
|
if (!current || typeof current !== "object") {
|
|
10730
10729
|
current = null;
|
|
10731
10730
|
}
|
|
@@ -10744,7 +10743,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10744
10743
|
}
|
|
10745
10744
|
const cloned = structuredClone(schema2);
|
|
10746
10745
|
const visited = /* @__PURE__ */ new Set();
|
|
10747
|
-
const resolve = async (current,
|
|
10746
|
+
const resolve = async (current, path104) => {
|
|
10748
10747
|
if (isIndexableObject(current)) {
|
|
10749
10748
|
if (visited.has(current)) {
|
|
10750
10749
|
return CIRCULAR_REF;
|
|
@@ -10752,7 +10751,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10752
10751
|
visited.add(current);
|
|
10753
10752
|
if (Array.isArray(current)) {
|
|
10754
10753
|
for (let index = 0; index < current.length; index++) {
|
|
10755
|
-
current[index] = await resolve(current[index], `${
|
|
10754
|
+
current[index] = await resolve(current[index], `${path104}/${index}`);
|
|
10756
10755
|
}
|
|
10757
10756
|
} else {
|
|
10758
10757
|
if ("$ref" in current && typeof current.$ref === "string") {
|
|
@@ -10763,13 +10762,13 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10763
10762
|
for (const resolver of resolvers) {
|
|
10764
10763
|
const resolved = await resolver($ref);
|
|
10765
10764
|
if (resolved) {
|
|
10766
|
-
result2 = await resolve(resolved,
|
|
10765
|
+
result2 = await resolve(resolved, path104);
|
|
10767
10766
|
break;
|
|
10768
10767
|
}
|
|
10769
10768
|
}
|
|
10770
10769
|
if (result2 === void 0) {
|
|
10771
10770
|
const resolved = await resolveLocalRef(cloned, $ref);
|
|
10772
|
-
result2 = await resolve(resolved,
|
|
10771
|
+
result2 = await resolve(resolved, path104);
|
|
10773
10772
|
}
|
|
10774
10773
|
if (hasSiblings) {
|
|
10775
10774
|
if (result2 === CIRCULAR_REF) {
|
|
@@ -10782,7 +10781,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10782
10781
|
return result2;
|
|
10783
10782
|
}
|
|
10784
10783
|
for (const key in current) {
|
|
10785
|
-
current[key] = await resolve(current[key], `${
|
|
10784
|
+
current[key] = await resolve(current[key], `${path104}/${key}`);
|
|
10786
10785
|
}
|
|
10787
10786
|
}
|
|
10788
10787
|
visited.delete(current);
|
|
@@ -10821,9 +10820,9 @@ var upgradeSchema = (schema2) => {
|
|
|
10821
10820
|
}
|
|
10822
10821
|
return sub;
|
|
10823
10822
|
});
|
|
10824
|
-
schema2 = traverse(schema2, (sub,
|
|
10823
|
+
schema2 = traverse(schema2, (sub, path104) => {
|
|
10825
10824
|
if (sub.example !== void 0) {
|
|
10826
|
-
if (isSchemaPath(
|
|
10825
|
+
if (isSchemaPath(path104 ?? [])) {
|
|
10827
10826
|
sub.examples = [sub.example];
|
|
10828
10827
|
} else {
|
|
10829
10828
|
sub.examples = {
|
|
@@ -10836,11 +10835,11 @@ var upgradeSchema = (schema2) => {
|
|
|
10836
10835
|
}
|
|
10837
10836
|
return sub;
|
|
10838
10837
|
});
|
|
10839
|
-
schema2 = traverse(schema2, (schema3,
|
|
10838
|
+
schema2 = traverse(schema2, (schema3, path104) => {
|
|
10840
10839
|
if (schema3.type === "object" && schema3.properties !== void 0) {
|
|
10841
|
-
const parentPath =
|
|
10840
|
+
const parentPath = path104?.slice(0, -1);
|
|
10842
10841
|
const isMultipart = parentPath?.some((segment, index) => {
|
|
10843
|
-
return segment === "content" &&
|
|
10842
|
+
return segment === "content" && path104?.[index + 1] === "multipart/form-data";
|
|
10844
10843
|
});
|
|
10845
10844
|
if (isMultipart) {
|
|
10846
10845
|
const entries = Object.entries(schema3.properties);
|
|
@@ -10854,8 +10853,8 @@ var upgradeSchema = (schema2) => {
|
|
|
10854
10853
|
}
|
|
10855
10854
|
return schema3;
|
|
10856
10855
|
});
|
|
10857
|
-
schema2 = traverse(schema2, (schema3,
|
|
10858
|
-
if (
|
|
10856
|
+
schema2 = traverse(schema2, (schema3, path104) => {
|
|
10857
|
+
if (path104?.includes("content") && path104.includes("application/octet-stream")) {
|
|
10859
10858
|
return {};
|
|
10860
10859
|
}
|
|
10861
10860
|
if (schema3.type === "string" && schema3.format === "binary") {
|
|
@@ -10881,11 +10880,11 @@ var upgradeSchema = (schema2) => {
|
|
|
10881
10880
|
}
|
|
10882
10881
|
return sub;
|
|
10883
10882
|
});
|
|
10884
|
-
schema2 = traverse(schema2, (schema3,
|
|
10883
|
+
schema2 = traverse(schema2, (schema3, path104) => {
|
|
10885
10884
|
if (schema3.type === "string" && schema3.format === "byte") {
|
|
10886
|
-
const parentPath =
|
|
10885
|
+
const parentPath = path104?.slice(0, -1);
|
|
10887
10886
|
const contentMediaType = parentPath?.find(
|
|
10888
|
-
(_, index) =>
|
|
10887
|
+
(_, index) => path104?.[index - 1] === "content"
|
|
10889
10888
|
);
|
|
10890
10889
|
return {
|
|
10891
10890
|
type: "string",
|
|
@@ -10897,7 +10896,7 @@ var upgradeSchema = (schema2) => {
|
|
|
10897
10896
|
});
|
|
10898
10897
|
return schema2;
|
|
10899
10898
|
};
|
|
10900
|
-
function isSchemaPath(
|
|
10899
|
+
function isSchemaPath(path104) {
|
|
10901
10900
|
const schemaLocations = [
|
|
10902
10901
|
["components", "schemas"],
|
|
10903
10902
|
"properties",
|
|
@@ -10910,10 +10909,10 @@ function isSchemaPath(path103) {
|
|
|
10910
10909
|
];
|
|
10911
10910
|
return schemaLocations.some((location) => {
|
|
10912
10911
|
if (Array.isArray(location)) {
|
|
10913
|
-
return location.every((segment, index) =>
|
|
10912
|
+
return location.every((segment, index) => path104[index] === segment);
|
|
10914
10913
|
}
|
|
10915
|
-
return
|
|
10916
|
-
}) ||
|
|
10914
|
+
return path104.includes(location);
|
|
10915
|
+
}) || path104.includes("schema") || path104.some((segment) => segment.endsWith("Schema"));
|
|
10917
10916
|
}
|
|
10918
10917
|
|
|
10919
10918
|
// src/lib/oas/parser/index.ts
|
|
@@ -10995,13 +10994,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
|
|
|
10995
10994
|
"anyOf",
|
|
10996
10995
|
"oneOf"
|
|
10997
10996
|
]);
|
|
10998
|
-
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(),
|
|
10997
|
+
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path104 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
|
|
10999
10998
|
if (obj === null || typeof obj !== "object") return obj;
|
|
11000
10999
|
const refPath = obj.__$ref;
|
|
11001
11000
|
const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
|
|
11002
11001
|
if (isCircular) {
|
|
11003
11002
|
if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
|
|
11004
|
-
const circularProp =
|
|
11003
|
+
const circularProp = path104.find((p) => !OPENAPI_PROPS.has(p)) || path104[0];
|
|
11005
11004
|
return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
|
|
11006
11005
|
}
|
|
11007
11006
|
if (refs.has(obj)) return refs.get(obj);
|
|
@@ -11011,7 +11010,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
|
|
|
11011
11010
|
value,
|
|
11012
11011
|
currentPath,
|
|
11013
11012
|
refs,
|
|
11014
|
-
[...
|
|
11013
|
+
[...path104, key],
|
|
11015
11014
|
currentRefPaths
|
|
11016
11015
|
);
|
|
11017
11016
|
const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
|
|
@@ -11046,7 +11045,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
|
|
|
11046
11045
|
var getAllTags = (schema2) => {
|
|
11047
11046
|
const rootTags = schema2.tags ?? [];
|
|
11048
11047
|
const operations = Object.values(schema2.paths ?? {}).flatMap(
|
|
11049
|
-
(
|
|
11048
|
+
(path104) => HttpMethods.map((k) => path104?.[k]).filter((op) => op != null)
|
|
11050
11049
|
);
|
|
11051
11050
|
const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
|
|
11052
11051
|
const hasUntaggedOperations = operations.some(
|
|
@@ -11101,7 +11100,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
|
|
|
11101
11100
|
var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
|
|
11102
11101
|
var getAllOperations = (paths) => {
|
|
11103
11102
|
const operations = Object.entries(paths ?? {}).flatMap(
|
|
11104
|
-
([
|
|
11103
|
+
([path104, value]) => HttpMethods.flatMap((method) => {
|
|
11105
11104
|
if (!value?.[method]) return [];
|
|
11106
11105
|
const operation = value[method];
|
|
11107
11106
|
const pathParameters = value.parameters ?? [];
|
|
@@ -11121,7 +11120,7 @@ var getAllOperations = (paths) => {
|
|
|
11121
11120
|
return {
|
|
11122
11121
|
...operation,
|
|
11123
11122
|
method,
|
|
11124
|
-
path:
|
|
11123
|
+
path: path104,
|
|
11125
11124
|
parameters,
|
|
11126
11125
|
servers,
|
|
11127
11126
|
tags: operation.tags ?? []
|
|
@@ -11479,8 +11478,8 @@ var Schema = builder.objectRef("Schema").implement({
|
|
|
11479
11478
|
}),
|
|
11480
11479
|
paths: t.field({
|
|
11481
11480
|
type: [PathItem],
|
|
11482
|
-
resolve: (root) => Object.entries(root.paths ?? {}).map(([
|
|
11483
|
-
path:
|
|
11481
|
+
resolve: (root) => Object.entries(root.paths ?? {}).map(([path104, value]) => ({
|
|
11482
|
+
path: path104,
|
|
11484
11483
|
// biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
|
|
11485
11484
|
methods: Object.keys(value)
|
|
11486
11485
|
}))
|
|
@@ -11645,7 +11644,7 @@ init_joinUrl();
|
|
|
11645
11644
|
|
|
11646
11645
|
// src/vite/api/schema-codegen.ts
|
|
11647
11646
|
var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
11648
|
-
var getSegmentsFromPath = (
|
|
11647
|
+
var getSegmentsFromPath = (path104) => path104.split("/").slice(1).map(unescapeJsonPointer);
|
|
11649
11648
|
var createLocalRefMap = (obj) => {
|
|
11650
11649
|
const refMap = /* @__PURE__ */ new Map();
|
|
11651
11650
|
const siblingsMap = /* @__PURE__ */ new Map();
|
|
@@ -11676,16 +11675,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
|
|
|
11676
11675
|
/"__refMap\+Siblings:(.*?)"/g,
|
|
11677
11676
|
(_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
|
|
11678
11677
|
);
|
|
11679
|
-
var lookup = (schema2,
|
|
11680
|
-
const parts = getSegmentsFromPath(
|
|
11678
|
+
var lookup = (schema2, path104, filePath) => {
|
|
11679
|
+
const parts = getSegmentsFromPath(path104);
|
|
11681
11680
|
let val = schema2;
|
|
11682
11681
|
for (const part of parts) {
|
|
11683
11682
|
while (val.$ref?.startsWith("#/")) {
|
|
11684
|
-
val = val.$ref ===
|
|
11683
|
+
val = val.$ref === path104 ? val : lookup(schema2, val.$ref, filePath);
|
|
11685
11684
|
}
|
|
11686
11685
|
if (val[part] === void 0) {
|
|
11687
11686
|
throw new Error(
|
|
11688
|
-
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${
|
|
11687
|
+
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path104}`
|
|
11689
11688
|
);
|
|
11690
11689
|
}
|
|
11691
11690
|
val = val[part];
|
|
@@ -11930,8 +11929,8 @@ var SchemaManager = class {
|
|
|
11930
11929
|
}
|
|
11931
11930
|
}
|
|
11932
11931
|
};
|
|
11933
|
-
getLatestSchema = (
|
|
11934
|
-
getSchemasForPath = (
|
|
11932
|
+
getLatestSchema = (path104) => this.processedSchemas[path104]?.at(0);
|
|
11933
|
+
getSchemasForPath = (path104) => this.processedSchemas[path104];
|
|
11935
11934
|
getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
|
|
11936
11935
|
getUrlToFilePathMap = () => {
|
|
11937
11936
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -14385,14 +14384,14 @@ async function generateSitemap({
|
|
|
14385
14384
|
|
|
14386
14385
|
// src/vite/prerender/utils.ts
|
|
14387
14386
|
init_joinUrl();
|
|
14388
|
-
var resolveRoutePath = (
|
|
14389
|
-
const segments =
|
|
14387
|
+
var resolveRoutePath = (path104) => {
|
|
14388
|
+
const segments = path104.split("/");
|
|
14390
14389
|
if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
|
|
14391
14390
|
return void 0;
|
|
14392
14391
|
}
|
|
14393
14392
|
return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
|
|
14394
14393
|
};
|
|
14395
|
-
var isSkipped = (
|
|
14394
|
+
var isSkipped = (path104) => path104.includes("*") || /^\d+$/.test(path104);
|
|
14396
14395
|
var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
|
|
14397
14396
|
if (route.path && isSkipped(route.path)) return [];
|
|
14398
14397
|
const routePath = route.path ? resolveRoutePath(route.path) : void 0;
|
|
@@ -14801,15 +14800,9 @@ var missingCorePackages = (dir) => CORE_PACKAGES.filter((name) => !isPackageInst
|
|
|
14801
14800
|
|
|
14802
14801
|
// src/cli/portal/v2.ts
|
|
14803
14802
|
function assertPackagesInstalled(resolved, prepared) {
|
|
14804
|
-
const
|
|
14805
|
-
|
|
14806
|
-
|
|
14807
|
-
require2.resolve(name);
|
|
14808
|
-
return false;
|
|
14809
|
-
} catch {
|
|
14810
|
-
return true;
|
|
14811
|
-
}
|
|
14812
|
-
});
|
|
14803
|
+
const missing = requiredPackages(prepared.plan).filter(
|
|
14804
|
+
(name) => !isPackageInstalled(resolved.configDir, name)
|
|
14805
|
+
);
|
|
14813
14806
|
const missingCore = missingCorePackages(resolved.configDir);
|
|
14814
14807
|
if (missing.length === 0 && missingCore.length === 0) return;
|
|
14815
14808
|
throw new ConfigError(resolved.configPath, [
|
|
@@ -14902,15 +14895,15 @@ async function buildV2(options) {
|
|
|
14902
14895
|
// src/cli/check/gateway-online.ts
|
|
14903
14896
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
14904
14897
|
var SPEC_SEND_LIMIT = 5 * 1024 * 1024 + 64 * 1024;
|
|
14905
|
-
var issue2 = (code,
|
|
14898
|
+
var issue2 = (code, path104, message, hint) => ({ code, path: path104, message, hint });
|
|
14906
14899
|
function capabilityIssues(gateway, answer) {
|
|
14907
14900
|
const can = answer.capabilities;
|
|
14908
14901
|
const plan2 = `your ${answer.tier} plan`;
|
|
14909
14902
|
const found = [];
|
|
14910
|
-
const unsupported = (
|
|
14903
|
+
const unsupported = (path104, what, hint) => found.push(
|
|
14911
14904
|
issue2(
|
|
14912
14905
|
"GATEWAY_CAPABILITY_UNSUPPORTED",
|
|
14913
|
-
|
|
14906
|
+
path104,
|
|
14914
14907
|
`${what} is not available on ${plan2}.`,
|
|
14915
14908
|
hint
|
|
14916
14909
|
)
|
|
@@ -15106,9 +15099,9 @@ function toPlatformPlans(plans) {
|
|
|
15106
15099
|
}
|
|
15107
15100
|
|
|
15108
15101
|
// src/cli/check/services-online.ts
|
|
15109
|
-
var issue3 = (code,
|
|
15102
|
+
var issue3 = (code, path104, message, hint) => ({
|
|
15110
15103
|
code,
|
|
15111
|
-
path:
|
|
15104
|
+
path: path104,
|
|
15112
15105
|
message,
|
|
15113
15106
|
hint
|
|
15114
15107
|
});
|
|
@@ -15187,9 +15180,10 @@ async function onlinePlansRules(resolved, projectId, api) {
|
|
|
15187
15180
|
try {
|
|
15188
15181
|
const answer = await api.validate(
|
|
15189
15182
|
projectId,
|
|
15190
|
-
|
|
15183
|
+
// The platform's check needs the list even when it is empty: the actions are only known after the gateway deploy.
|
|
15184
|
+
wanted.map((plan2) => ({
|
|
15191
15185
|
...plan2,
|
|
15192
|
-
|
|
15186
|
+
includedActionKeys: plan2.includedActionKeys ?? []
|
|
15193
15187
|
}))
|
|
15194
15188
|
);
|
|
15195
15189
|
const convert = (item) => issue3(
|
|
@@ -18084,11 +18078,11 @@ var SECRETS_COLLECTION_INSTRUCTION = "For go-live, plans must already be in apit
|
|
|
18084
18078
|
// src/cli/platform/helpers/dev-portal-site-validation.ts
|
|
18085
18079
|
init_gateway_limits();
|
|
18086
18080
|
import { readFile as readFile19 } from "node:fs/promises";
|
|
18087
|
-
import { createRequire as
|
|
18081
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
18088
18082
|
import path59 from "node:path";
|
|
18089
18083
|
var cachedFallbackTs;
|
|
18090
18084
|
async function loadTypeScriptForSite(sourceDirectory) {
|
|
18091
|
-
const require2 =
|
|
18085
|
+
const require2 = createRequire2(
|
|
18092
18086
|
path59.join(path59.resolve(sourceDirectory), "package.json")
|
|
18093
18087
|
);
|
|
18094
18088
|
try {
|
|
@@ -21571,7 +21565,7 @@ var config_default = {
|
|
|
21571
21565
|
};
|
|
21572
21566
|
|
|
21573
21567
|
// src/cli/cmds/deploy.ts
|
|
21574
|
-
import
|
|
21568
|
+
import path86 from "node:path";
|
|
21575
21569
|
|
|
21576
21570
|
// src/cli/apply/handler.ts
|
|
21577
21571
|
import path82 from "node:path";
|
|
@@ -22103,8 +22097,8 @@ function normalizeActionKey(actionKey2) {
|
|
|
22103
22097
|
const trimmed = actionKey2.trim();
|
|
22104
22098
|
if (trimmed.includes(":")) {
|
|
22105
22099
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
22106
|
-
const
|
|
22107
|
-
return `${method2?.toLowerCase()}:${
|
|
22100
|
+
const path105 = pathParts.join(":").trim();
|
|
22101
|
+
return `${method2?.toLowerCase()}:${path105.startsWith("/") ? path105 : `/${path105}`}`;
|
|
22108
22102
|
}
|
|
22109
22103
|
const spaceIndex = trimmed.indexOf(" ");
|
|
22110
22104
|
if (spaceIndex <= 0) {
|
|
@@ -22113,8 +22107,8 @@ function normalizeActionKey(actionKey2) {
|
|
|
22113
22107
|
);
|
|
22114
22108
|
}
|
|
22115
22109
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
22116
|
-
const
|
|
22117
|
-
return `${method}:${
|
|
22110
|
+
const path104 = trimmed.slice(spaceIndex + 1).trim();
|
|
22111
|
+
return `${method}:${path104.startsWith("/") ? path104 : `/${path104}`}`;
|
|
22118
22112
|
}
|
|
22119
22113
|
async function applyGatewayPublicRoutes(client, projectId, routes, options) {
|
|
22120
22114
|
const applied = [];
|
|
@@ -22735,8 +22729,8 @@ function normalizeActionKeyFormat(actionKey2) {
|
|
|
22735
22729
|
const trimmed = actionKey2.trim();
|
|
22736
22730
|
if (trimmed.includes(":")) {
|
|
22737
22731
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
22738
|
-
const
|
|
22739
|
-
return `${method2.toLowerCase()}:${
|
|
22732
|
+
const path105 = pathParts.join(":").trim();
|
|
22733
|
+
return `${method2.toLowerCase()}:${path105.startsWith("/") ? path105 : `/${path105}`}`;
|
|
22740
22734
|
}
|
|
22741
22735
|
const spaceIndex = trimmed.indexOf(" ");
|
|
22742
22736
|
if (spaceIndex <= 0) {
|
|
@@ -22745,8 +22739,8 @@ function normalizeActionKeyFormat(actionKey2) {
|
|
|
22745
22739
|
);
|
|
22746
22740
|
}
|
|
22747
22741
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
22748
|
-
const
|
|
22749
|
-
return `${method}:${
|
|
22742
|
+
const path104 = trimmed.slice(spaceIndex + 1).trim();
|
|
22743
|
+
return `${method}:${path104.startsWith("/") ? path104 : `/${path104}`}`;
|
|
22750
22744
|
}
|
|
22751
22745
|
function normalizePublicRoute(route) {
|
|
22752
22746
|
const trimmed = route.trim();
|
|
@@ -27230,7 +27224,7 @@ async function apply(argv) {
|
|
|
27230
27224
|
|
|
27231
27225
|
// src/cli/deploy/command.ts
|
|
27232
27226
|
init_invariant();
|
|
27233
|
-
import
|
|
27227
|
+
import path85 from "node:path";
|
|
27234
27228
|
|
|
27235
27229
|
// src/cli/deploy/v2.ts
|
|
27236
27230
|
import { rm as rm12 } from "node:fs/promises";
|
|
@@ -27495,14 +27489,18 @@ function identityNotDeployableReason(resolved) {
|
|
|
27495
27489
|
return 'identity.provider "oidc" needs issuer and clientId';
|
|
27496
27490
|
return void 0;
|
|
27497
27491
|
}
|
|
27498
|
-
function
|
|
27492
|
+
function identityBodyForRedirect(resolved, redirectUri) {
|
|
27499
27493
|
return {
|
|
27500
|
-
portalRedirectUris: [
|
|
27501
|
-
`${portalUrl.replace(/\/+$/, "")}${PORTAL_CALLBACK_PATH}`
|
|
27502
|
-
],
|
|
27494
|
+
portalRedirectUris: [redirectUri],
|
|
27503
27495
|
nativeSignup: resolved.identity?.native ?? true
|
|
27504
27496
|
};
|
|
27505
27497
|
}
|
|
27498
|
+
function identityRequestBody(resolved, portalUrl) {
|
|
27499
|
+
return identityBodyForRedirect(
|
|
27500
|
+
resolved,
|
|
27501
|
+
`${portalUrl.replace(/\/+$/, "")}${PORTAL_CALLBACK_PATH}`
|
|
27502
|
+
);
|
|
27503
|
+
}
|
|
27506
27504
|
function identityInputsHash(projectId, body) {
|
|
27507
27505
|
return stableJson({ projectId, body });
|
|
27508
27506
|
}
|
|
@@ -27580,7 +27578,10 @@ async function deployIdentity(resolved, projectId, deps, options = {}) {
|
|
|
27580
27578
|
run: async () => {
|
|
27581
27579
|
try {
|
|
27582
27580
|
const answer = await client.putProjectIdentity(projectId, body);
|
|
27583
|
-
return {
|
|
27581
|
+
return {
|
|
27582
|
+
status: answer.status,
|
|
27583
|
+
redirectUri: body.portalRedirectUris[0] ?? ""
|
|
27584
|
+
};
|
|
27584
27585
|
} catch (error) {
|
|
27585
27586
|
return rejected2(error);
|
|
27586
27587
|
}
|
|
@@ -27925,12 +27926,13 @@ async function planIdentityService(resolved, ledger, manifest) {
|
|
|
27925
27926
|
}
|
|
27926
27927
|
const projectId = resolved.project.id;
|
|
27927
27928
|
const portalUrl = manifest?.services.portal?.url;
|
|
27928
|
-
const
|
|
27929
|
+
const recorded = stepOf(ledger, "identity", "request")?.output?.redirectUri;
|
|
27930
|
+
const body = portalUrl ? identityRequestBody(resolved, portalUrl) : recorded ? identityBodyForRedirect(resolved, recorded) : void 0;
|
|
27929
27931
|
const hash2 = projectId && body ? identityInputsHash(projectId, body) : void 0;
|
|
27930
27932
|
const details = [
|
|
27931
27933
|
"provider: apitogo (one issuer for this project)",
|
|
27932
27934
|
`sign-up with email and password: ${identity.native ? "on" : "off"}`,
|
|
27933
|
-
portalUrl ? `sign-in redirect: ${portalUrl.replace(/\/+$/, "")}${PORTAL_CALLBACK_PATH}` : "sign-in redirect: the portal address is not known locally; deploy takes it from the project",
|
|
27935
|
+
portalUrl ? `sign-in redirect: ${portalUrl.replace(/\/+$/, "")}${PORTAL_CALLBACK_PATH}` : recorded ? `sign-in redirect: ${recorded} (sent by the last deploy)` : "sign-in redirect: the portal address is not known locally; deploy takes it from the project",
|
|
27934
27936
|
...known?.issuer ? [`issuer: ${known.issuer}`] : [],
|
|
27935
27937
|
...IDENTITY_STEPS.map(
|
|
27936
27938
|
(name) => `step ${name}: ${stepState(stepOf(ledger, "identity", name), hash2)}`
|
|
@@ -28532,6 +28534,36 @@ function formatStatus(output4) {
|
|
|
28532
28534
|
];
|
|
28533
28535
|
}
|
|
28534
28536
|
|
|
28537
|
+
// src/cli/deploy/static-web-config.ts
|
|
28538
|
+
import { access as access14, writeFile as writeFile25 } from "node:fs/promises";
|
|
28539
|
+
import path84 from "node:path";
|
|
28540
|
+
var STATIC_WEB_CONFIG_FILE = "staticwebapp.config.json";
|
|
28541
|
+
var STATIC_WEB_CONFIG_VERSION = 1;
|
|
28542
|
+
var DEFAULT_STATIC_WEB_CONFIG = {
|
|
28543
|
+
navigationFallback: {
|
|
28544
|
+
rewrite: "/index.html",
|
|
28545
|
+
exclude: [
|
|
28546
|
+
"/assets/*",
|
|
28547
|
+
"/*.{png,jpg,jpeg,gif,svg,ico,css,js,mjs,json,txt,xml,webmanifest,woff,woff2,map}"
|
|
28548
|
+
]
|
|
28549
|
+
}
|
|
28550
|
+
};
|
|
28551
|
+
async function ensureStaticWebConfig(buildDir) {
|
|
28552
|
+
const file = path84.join(buildDir, STATIC_WEB_CONFIG_FILE);
|
|
28553
|
+
try {
|
|
28554
|
+
await access14(file);
|
|
28555
|
+
return false;
|
|
28556
|
+
} catch {
|
|
28557
|
+
await writeFile25(
|
|
28558
|
+
file,
|
|
28559
|
+
`${JSON.stringify(DEFAULT_STATIC_WEB_CONFIG, null, 2)}
|
|
28560
|
+
`,
|
|
28561
|
+
"utf8"
|
|
28562
|
+
);
|
|
28563
|
+
return true;
|
|
28564
|
+
}
|
|
28565
|
+
}
|
|
28566
|
+
|
|
28535
28567
|
// src/cli/deploy/v2.ts
|
|
28536
28568
|
var DeployError = class extends ApitogoError {
|
|
28537
28569
|
constructor(code, message, developerHint) {
|
|
@@ -28556,8 +28588,9 @@ function parseDeployOnly(value) {
|
|
|
28556
28588
|
function publishStep(deps, options) {
|
|
28557
28589
|
return {
|
|
28558
28590
|
name: "publish",
|
|
28559
|
-
hash: () => `${options.buildHash}|${options.projectId}|${options.env ?? ""}`,
|
|
28591
|
+
hash: () => `${options.buildHash}|${options.projectId}|${options.env ?? ""}|host-config-${STATIC_WEB_CONFIG_VERSION}`,
|
|
28560
28592
|
run: async () => {
|
|
28593
|
+
await ensureStaticWebConfig(options.buildDir);
|
|
28561
28594
|
const pack = deps.pack ?? packageDirectoryAsTarGz;
|
|
28562
28595
|
const archive = await pack(options.buildDir, { archiveRoot: "dist" });
|
|
28563
28596
|
try {
|
|
@@ -28803,7 +28836,7 @@ async function deployProject(argv) {
|
|
|
28803
28836
|
const config2 = loadConfig();
|
|
28804
28837
|
const output4 = await deployV2(
|
|
28805
28838
|
{
|
|
28806
|
-
dir:
|
|
28839
|
+
dir: path85.resolve(process.cwd(), argv.dir),
|
|
28807
28840
|
only: Array.isArray(argv.only) ? argv.only.join(",") : argv.only,
|
|
28808
28841
|
projectId: argv.projectId,
|
|
28809
28842
|
env: argv.env,
|
|
@@ -28884,7 +28917,7 @@ var deploy_default = {
|
|
|
28884
28917
|
}),
|
|
28885
28918
|
handler: async (argv) => {
|
|
28886
28919
|
await captureEvent({ argv, event: "apitogo deploy" });
|
|
28887
|
-
if (await isConfigV2(
|
|
28920
|
+
if (await isConfigV2(path86.resolve(process.cwd(), argv.dir))) {
|
|
28888
28921
|
await deployProject(argv);
|
|
28889
28922
|
return;
|
|
28890
28923
|
}
|
|
@@ -28893,8 +28926,8 @@ var deploy_default = {
|
|
|
28893
28926
|
};
|
|
28894
28927
|
|
|
28895
28928
|
// src/cli/export/handler.ts
|
|
28896
|
-
import { mkdir as mkdir20, writeFile as
|
|
28897
|
-
import
|
|
28929
|
+
import { mkdir as mkdir20, writeFile as writeFile26 } from "node:fs/promises";
|
|
28930
|
+
import path87 from "node:path";
|
|
28898
28931
|
init_invariant();
|
|
28899
28932
|
var ExportError = class extends ApitogoError {
|
|
28900
28933
|
constructor(message, developerHint) {
|
|
@@ -28908,7 +28941,7 @@ async function exportOpenApi(args, deps) {
|
|
|
28908
28941
|
`Cannot export "${args.target}".`,
|
|
28909
28942
|
"Only `apitogo export openapi` exists."
|
|
28910
28943
|
);
|
|
28911
|
-
const dir =
|
|
28944
|
+
const dir = path87.resolve(process.cwd(), args.dir ?? ".");
|
|
28912
28945
|
if (!await isConfigV2(dir))
|
|
28913
28946
|
throw new ExportError(
|
|
28914
28947
|
"This command needs a config version 2 project.",
|
|
@@ -28933,9 +28966,9 @@ async function exportOpenApi(args, deps) {
|
|
|
28933
28966
|
throw error;
|
|
28934
28967
|
}
|
|
28935
28968
|
if (!args.out) return { text };
|
|
28936
|
-
const file =
|
|
28937
|
-
await mkdir20(
|
|
28938
|
-
await
|
|
28969
|
+
const file = path87.resolve(process.cwd(), args.out);
|
|
28970
|
+
await mkdir20(path87.dirname(file), { recursive: true });
|
|
28971
|
+
await writeFile26(file, text);
|
|
28939
28972
|
return { text, file };
|
|
28940
28973
|
}
|
|
28941
28974
|
async function exportCommand(args) {
|
|
@@ -28985,15 +29018,15 @@ var export_default = {
|
|
|
28985
29018
|
};
|
|
28986
29019
|
|
|
28987
29020
|
// src/cli/init/handler.ts
|
|
28988
|
-
import
|
|
29021
|
+
import path91 from "node:path";
|
|
28989
29022
|
|
|
28990
29023
|
// src/cli/scaffold/run-scaffold-discovery.ts
|
|
28991
|
-
import { access as
|
|
28992
|
-
import
|
|
29024
|
+
import { access as access16, readFile as readFile31, writeFile as writeFile28 } from "node:fs/promises";
|
|
29025
|
+
import path90 from "node:path";
|
|
28993
29026
|
|
|
28994
29027
|
// src/cli/scaffold/detect-backend.ts
|
|
28995
29028
|
import { readdir as readdir4, readFile as readFile29 } from "node:fs/promises";
|
|
28996
|
-
import
|
|
29029
|
+
import path88 from "node:path";
|
|
28997
29030
|
var DEFAULT_RUNTIME_VERSION = {
|
|
28998
29031
|
dotnet: "DOTNET_10",
|
|
28999
29032
|
nodejs: "NODE_22_LTS",
|
|
@@ -29039,15 +29072,15 @@ function isRunnableNodePackage(pkg) {
|
|
|
29039
29072
|
return typeof scripts.start === "string" || typeof pkg.main === "string";
|
|
29040
29073
|
}
|
|
29041
29074
|
async function detectParentBackend(siteDirectory) {
|
|
29042
|
-
const site =
|
|
29043
|
-
const directory =
|
|
29075
|
+
const site = path88.resolve(siteDirectory);
|
|
29076
|
+
const directory = path88.dirname(site);
|
|
29044
29077
|
if (directory === site) {
|
|
29045
29078
|
return void 0;
|
|
29046
29079
|
}
|
|
29047
29080
|
const files = await listFiles(directory);
|
|
29048
29081
|
const toResult = (runtime, runtimeVersion, marker) => ({
|
|
29049
29082
|
directory,
|
|
29050
|
-
sourceDirectory:
|
|
29083
|
+
sourceDirectory: path88.relative(site, directory).split(path88.sep).join("/") || ".",
|
|
29051
29084
|
runtime,
|
|
29052
29085
|
runtimeVersion,
|
|
29053
29086
|
marker
|
|
@@ -29055,7 +29088,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
29055
29088
|
const csproj = files.find((f) => f.endsWith(".csproj"));
|
|
29056
29089
|
const solution = files.find((f) => /\.slnx?$/.test(f));
|
|
29057
29090
|
if (csproj || solution) {
|
|
29058
|
-
const content = csproj ? await readText(
|
|
29091
|
+
const content = csproj ? await readText(path88.join(directory, csproj)) : void 0;
|
|
29059
29092
|
return toResult(
|
|
29060
29093
|
"dotnet",
|
|
29061
29094
|
dotnetVersionFromCsproj(content),
|
|
@@ -29063,7 +29096,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
29063
29096
|
);
|
|
29064
29097
|
}
|
|
29065
29098
|
if (files.includes("package.json")) {
|
|
29066
|
-
const raw = await readText(
|
|
29099
|
+
const raw = await readText(path88.join(directory, "package.json"));
|
|
29067
29100
|
try {
|
|
29068
29101
|
const pkg = JSON.parse(raw ?? "");
|
|
29069
29102
|
if (isRunnableNodePackage(pkg)) {
|
|
@@ -29078,7 +29111,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
29078
29111
|
}
|
|
29079
29112
|
const pythonMarker = PYTHON_MARKERS.find((m) => files.includes(m));
|
|
29080
29113
|
if (pythonMarker) {
|
|
29081
|
-
const versionSource = await readText(
|
|
29114
|
+
const versionSource = await readText(path88.join(directory, ".python-version")) ?? (pythonMarker === "pyproject.toml" ? (await readText(path88.join(directory, pythonMarker)))?.match(
|
|
29082
29115
|
/requires-python\s*=\s*"([^"]+)"/
|
|
29083
29116
|
)?.[1] : void 0);
|
|
29084
29117
|
return toResult(
|
|
@@ -29092,16 +29125,16 @@ async function detectParentBackend(siteDirectory) {
|
|
|
29092
29125
|
|
|
29093
29126
|
// src/cli/scaffold/wire-docs.ts
|
|
29094
29127
|
import {
|
|
29095
|
-
access as
|
|
29128
|
+
access as access15,
|
|
29096
29129
|
lstat as lstat2,
|
|
29097
29130
|
mkdir as mkdir21,
|
|
29098
29131
|
readdir as readdir5,
|
|
29099
29132
|
readFile as readFile30,
|
|
29100
29133
|
readlink,
|
|
29101
29134
|
symlink as symlink2,
|
|
29102
|
-
writeFile as
|
|
29135
|
+
writeFile as writeFile27
|
|
29103
29136
|
} from "node:fs/promises";
|
|
29104
|
-
import
|
|
29137
|
+
import path89 from "node:path";
|
|
29105
29138
|
var DOCS_DIR_WHITELIST = [
|
|
29106
29139
|
"docs",
|
|
29107
29140
|
"documents",
|
|
@@ -29123,7 +29156,7 @@ var PAGES_DIR = "pages";
|
|
|
29123
29156
|
var CONFIG_FILENAME = "apitogo.config.json";
|
|
29124
29157
|
async function pathExists5(filePath) {
|
|
29125
29158
|
try {
|
|
29126
|
-
await
|
|
29159
|
+
await access15(filePath);
|
|
29127
29160
|
return true;
|
|
29128
29161
|
} catch {
|
|
29129
29162
|
return false;
|
|
@@ -29138,14 +29171,14 @@ async function isDirectory2(filePath) {
|
|
|
29138
29171
|
}
|
|
29139
29172
|
}
|
|
29140
29173
|
function toPosix3(value) {
|
|
29141
|
-
return value.split(
|
|
29174
|
+
return value.split(path89.sep).join(path89.posix.sep);
|
|
29142
29175
|
}
|
|
29143
29176
|
function isWhitelistedDirName(name) {
|
|
29144
29177
|
return DOCS_DIR_WHITELIST.includes(name.toLowerCase());
|
|
29145
29178
|
}
|
|
29146
29179
|
function isInside2(parent, child) {
|
|
29147
|
-
const relative =
|
|
29148
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
29180
|
+
const relative = path89.relative(parent, child);
|
|
29181
|
+
return relative === "" || !relative.startsWith("..") && !path89.isAbsolute(relative);
|
|
29149
29182
|
}
|
|
29150
29183
|
async function collectMarkdownFiles(dir, excludeDir) {
|
|
29151
29184
|
const files = [];
|
|
@@ -29159,9 +29192,9 @@ async function collectMarkdownFiles(dir, excludeDir) {
|
|
|
29159
29192
|
if (entry.name.startsWith(".")) {
|
|
29160
29193
|
continue;
|
|
29161
29194
|
}
|
|
29162
|
-
const full =
|
|
29195
|
+
const full = path89.join(dir, entry.name);
|
|
29163
29196
|
if (entry.isDirectory()) {
|
|
29164
|
-
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir &&
|
|
29197
|
+
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir && path89.resolve(full) === excludeDir) {
|
|
29165
29198
|
continue;
|
|
29166
29199
|
}
|
|
29167
29200
|
files.push(...await collectMarkdownFiles(full, excludeDir));
|
|
@@ -29174,11 +29207,11 @@ async function collectMarkdownFiles(dir, excludeDir) {
|
|
|
29174
29207
|
return files;
|
|
29175
29208
|
}
|
|
29176
29209
|
async function collectSearchRoots(siteDirectory) {
|
|
29177
|
-
const site =
|
|
29178
|
-
const parent =
|
|
29210
|
+
const site = path89.resolve(siteDirectory);
|
|
29211
|
+
const parent = path89.dirname(site);
|
|
29179
29212
|
const roots = [];
|
|
29180
29213
|
const add = (dir) => {
|
|
29181
|
-
const resolved =
|
|
29214
|
+
const resolved = path89.resolve(dir);
|
|
29182
29215
|
if (!roots.includes(resolved)) {
|
|
29183
29216
|
roots.push(resolved);
|
|
29184
29217
|
}
|
|
@@ -29191,7 +29224,7 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
29191
29224
|
if (!entry.isDirectory() || SKIP_SEARCH_DIRS.has(entry.name)) {
|
|
29192
29225
|
continue;
|
|
29193
29226
|
}
|
|
29194
|
-
add(
|
|
29227
|
+
add(path89.join(parent, entry.name));
|
|
29195
29228
|
}
|
|
29196
29229
|
} catch {
|
|
29197
29230
|
}
|
|
@@ -29200,13 +29233,13 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
29200
29233
|
return roots;
|
|
29201
29234
|
}
|
|
29202
29235
|
async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
29203
|
-
const site =
|
|
29204
|
-
const sitePages =
|
|
29236
|
+
const site = path89.resolve(siteDirectory);
|
|
29237
|
+
const sitePages = path89.join(site, PAGES_DIR);
|
|
29205
29238
|
const searchedDirectories = await collectSearchRoots(site);
|
|
29206
29239
|
const directories = [];
|
|
29207
29240
|
const seen = /* @__PURE__ */ new Set();
|
|
29208
29241
|
const consider = async (dir) => {
|
|
29209
|
-
const resolved =
|
|
29242
|
+
const resolved = path89.resolve(dir);
|
|
29210
29243
|
if (resolved === site || seen.has(resolved) || isInside2(sitePages, resolved)) {
|
|
29211
29244
|
return;
|
|
29212
29245
|
}
|
|
@@ -29223,7 +29256,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
29223
29256
|
directories.push({ sourceDirectory: resolved, files });
|
|
29224
29257
|
};
|
|
29225
29258
|
for (const root of searchedDirectories) {
|
|
29226
|
-
if (isWhitelistedDirName(
|
|
29259
|
+
if (isWhitelistedDirName(path89.basename(root))) {
|
|
29227
29260
|
await consider(root);
|
|
29228
29261
|
}
|
|
29229
29262
|
try {
|
|
@@ -29235,7 +29268,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
29235
29268
|
if (!isWhitelistedDirName(entry.name)) {
|
|
29236
29269
|
continue;
|
|
29237
29270
|
}
|
|
29238
|
-
await consider(
|
|
29271
|
+
await consider(path89.join(root, entry.name));
|
|
29239
29272
|
}
|
|
29240
29273
|
} catch {
|
|
29241
29274
|
}
|
|
@@ -29254,8 +29287,8 @@ function slugifyDirName(name) {
|
|
|
29254
29287
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "docs";
|
|
29255
29288
|
}
|
|
29256
29289
|
async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
29257
|
-
const base = slugifyDirName(
|
|
29258
|
-
const parent = slugifyDirName(
|
|
29290
|
+
const base = slugifyDirName(path89.basename(sourceDirectory));
|
|
29291
|
+
const parent = slugifyDirName(path89.basename(path89.dirname(sourceDirectory)));
|
|
29259
29292
|
const candidates = [base, `${parent}-${base}`];
|
|
29260
29293
|
let index = 2;
|
|
29261
29294
|
while (true) {
|
|
@@ -29263,7 +29296,7 @@ async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
|
29263
29296
|
if (used.has(name)) {
|
|
29264
29297
|
continue;
|
|
29265
29298
|
}
|
|
29266
|
-
const target =
|
|
29299
|
+
const target = path89.join(pagesDir, name);
|
|
29267
29300
|
if (await pathExists5(target)) {
|
|
29268
29301
|
const stat7 = await lstat2(target);
|
|
29269
29302
|
if (!stat7.isDirectory() || !await isManagedLinkDir(target)) {
|
|
@@ -29294,8 +29327,8 @@ async function alreadyLinked(linkPath, sourcePath) {
|
|
|
29294
29327
|
return false;
|
|
29295
29328
|
}
|
|
29296
29329
|
const current = await readlink(linkPath);
|
|
29297
|
-
const resolved =
|
|
29298
|
-
return resolved ===
|
|
29330
|
+
const resolved = path89.resolve(path89.dirname(linkPath), current);
|
|
29331
|
+
return resolved === path89.resolve(sourcePath);
|
|
29299
29332
|
} catch {
|
|
29300
29333
|
return false;
|
|
29301
29334
|
}
|
|
@@ -29307,8 +29340,8 @@ async function linkMarkdownFile(sourcePath, linkPath) {
|
|
|
29307
29340
|
if (await pathExists5(linkPath)) {
|
|
29308
29341
|
return "skipped";
|
|
29309
29342
|
}
|
|
29310
|
-
await mkdir21(
|
|
29311
|
-
const relativeTarget =
|
|
29343
|
+
await mkdir21(path89.dirname(linkPath), { recursive: true });
|
|
29344
|
+
const relativeTarget = path89.relative(path89.dirname(linkPath), sourcePath);
|
|
29312
29345
|
await symlink2(
|
|
29313
29346
|
relativeTarget,
|
|
29314
29347
|
linkPath,
|
|
@@ -29323,7 +29356,7 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
29323
29356
|
if (routes.length === 0) {
|
|
29324
29357
|
return;
|
|
29325
29358
|
}
|
|
29326
|
-
const configPath =
|
|
29359
|
+
const configPath = path89.join(siteDirectory, CONFIG_FILENAME);
|
|
29327
29360
|
if (!await pathExists5(configPath)) {
|
|
29328
29361
|
return;
|
|
29329
29362
|
}
|
|
@@ -29336,12 +29369,12 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
29336
29369
|
force: false
|
|
29337
29370
|
});
|
|
29338
29371
|
const updated = ensureHeaderDocsNavigation(parsed, routes);
|
|
29339
|
-
await
|
|
29372
|
+
await writeFile27(configPath, `${JSON.stringify(updated, null, 2)}
|
|
29340
29373
|
`, "utf8");
|
|
29341
29374
|
}
|
|
29342
29375
|
async function discoverAndWireDocs(siteDirectory) {
|
|
29343
|
-
const site =
|
|
29344
|
-
const pagesDir =
|
|
29376
|
+
const site = path89.resolve(siteDirectory);
|
|
29377
|
+
const pagesDir = path89.join(site, PAGES_DIR);
|
|
29345
29378
|
const { directories, searchedDirectories } = await discoverNearbyDocsDirectories(site);
|
|
29346
29379
|
if (directories.length === 0) {
|
|
29347
29380
|
return {
|
|
@@ -29363,15 +29396,15 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
29363
29396
|
directory.sourceDirectory,
|
|
29364
29397
|
usedNames
|
|
29365
29398
|
);
|
|
29366
|
-
const linkDirectory =
|
|
29399
|
+
const linkDirectory = path89.join(pagesDir, linkName);
|
|
29367
29400
|
const linked = [];
|
|
29368
29401
|
const skipped = [];
|
|
29369
29402
|
for (const sourcePath of directory.files) {
|
|
29370
29403
|
const relativeSource = toPosix3(
|
|
29371
|
-
|
|
29404
|
+
path89.relative(directory.sourceDirectory, sourcePath)
|
|
29372
29405
|
);
|
|
29373
|
-
const linkPath =
|
|
29374
|
-
const relativeLink = toPosix3(
|
|
29406
|
+
const linkPath = path89.join(linkDirectory, relativeSource);
|
|
29407
|
+
const relativeLink = toPosix3(path89.relative(site, linkPath));
|
|
29375
29408
|
const route = toRoutePath(relativeLink, PAGES_DIR);
|
|
29376
29409
|
if (routes.includes(route)) {
|
|
29377
29410
|
skipped.push({
|
|
@@ -29419,11 +29452,11 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
29419
29452
|
};
|
|
29420
29453
|
}
|
|
29421
29454
|
function siteRelative(siteDirectory, filePath) {
|
|
29422
|
-
const relative = toPosix3(
|
|
29455
|
+
const relative = toPosix3(path89.relative(siteDirectory, filePath));
|
|
29423
29456
|
if (!relative) {
|
|
29424
29457
|
return ".";
|
|
29425
29458
|
}
|
|
29426
|
-
if (
|
|
29459
|
+
if (path89.isAbsolute(relative)) {
|
|
29427
29460
|
return toPosix3(filePath);
|
|
29428
29461
|
}
|
|
29429
29462
|
if (relative.startsWith("..")) {
|
|
@@ -29503,7 +29536,7 @@ function formatInitDiscoveryReport(siteDirectory, openApiDiscovery, docsDiscover
|
|
|
29503
29536
|
// src/cli/scaffold/run-scaffold-discovery.ts
|
|
29504
29537
|
async function pathExists6(filePath) {
|
|
29505
29538
|
try {
|
|
29506
|
-
await
|
|
29539
|
+
await access16(filePath);
|
|
29507
29540
|
return true;
|
|
29508
29541
|
} catch {
|
|
29509
29542
|
return false;
|
|
@@ -29511,7 +29544,7 @@ async function pathExists6(filePath) {
|
|
|
29511
29544
|
}
|
|
29512
29545
|
async function wireOpenApiIntoJsonConfig(siteDirectory, openApiPath) {
|
|
29513
29546
|
const input5 = toSiteRelativeOpenApiInput(siteDirectory, openApiPath);
|
|
29514
|
-
const jsonConfigPath =
|
|
29547
|
+
const jsonConfigPath = path90.join(siteDirectory, "apitogo.config.json");
|
|
29515
29548
|
const raw = await readFile31(jsonConfigPath, "utf8");
|
|
29516
29549
|
const siteConfig = JSON.parse(raw);
|
|
29517
29550
|
const updated = applyOpenApiToSiteConfig(siteConfig, {
|
|
@@ -29520,7 +29553,7 @@ async function wireOpenApiIntoJsonConfig(siteDirectory, openApiPath) {
|
|
|
29520
29553
|
});
|
|
29521
29554
|
const backend = updated.backend && typeof updated.backend === "object" && !Array.isArray(updated.backend) ? { ...updated.backend } : {};
|
|
29522
29555
|
updated.backend = { ...backend, openApiPath: input5 };
|
|
29523
|
-
await
|
|
29556
|
+
await writeFile28(
|
|
29524
29557
|
jsonConfigPath,
|
|
29525
29558
|
`${JSON.stringify(updated, null, 2)}
|
|
29526
29559
|
`,
|
|
@@ -29563,7 +29596,7 @@ async function discoverAndWireOpenApiLite(siteDirectory, mode) {
|
|
|
29563
29596
|
wired: false
|
|
29564
29597
|
};
|
|
29565
29598
|
}
|
|
29566
|
-
const jsonConfigPath =
|
|
29599
|
+
const jsonConfigPath = path90.join(siteDirectory, "apitogo.config.json");
|
|
29567
29600
|
if (!await pathExists6(jsonConfigPath)) {
|
|
29568
29601
|
return {
|
|
29569
29602
|
openApiDiscovery: {
|
|
@@ -29613,7 +29646,7 @@ async function discoverAndWireBackend(siteDirectory, mode) {
|
|
|
29613
29646
|
if (mode !== "nearby") {
|
|
29614
29647
|
return { status: "skipped", mode };
|
|
29615
29648
|
}
|
|
29616
|
-
const jsonConfigPath =
|
|
29649
|
+
const jsonConfigPath = path90.join(siteDirectory, "apitogo.config.json");
|
|
29617
29650
|
if (!await pathExists6(jsonConfigPath)) {
|
|
29618
29651
|
return { status: "not_found" };
|
|
29619
29652
|
}
|
|
@@ -29640,7 +29673,7 @@ async function discoverAndWireBackend(siteDirectory, mode) {
|
|
|
29640
29673
|
runtime: detected.runtime,
|
|
29641
29674
|
runtimeVersion: detected.runtimeVersion
|
|
29642
29675
|
};
|
|
29643
|
-
await
|
|
29676
|
+
await writeFile28(
|
|
29644
29677
|
jsonConfigPath,
|
|
29645
29678
|
`${JSON.stringify(siteConfig, null, 2)}
|
|
29646
29679
|
`,
|
|
@@ -29680,8 +29713,8 @@ function slugifyName2(name) {
|
|
|
29680
29713
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "dev-portal-site";
|
|
29681
29714
|
}
|
|
29682
29715
|
function resolveInitOutputDirectory(dirArg, name) {
|
|
29683
|
-
const resolved =
|
|
29684
|
-
const base =
|
|
29716
|
+
const resolved = path91.resolve(process.cwd(), dirArg);
|
|
29717
|
+
const base = path91.basename(resolved);
|
|
29685
29718
|
const isDot = dirArg === "." || dirArg === "./" || base === "." || resolved === process.cwd();
|
|
29686
29719
|
if (isDot) {
|
|
29687
29720
|
const fromName = name?.trim();
|
|
@@ -29691,7 +29724,7 @@ function resolveInitOutputDirectory(dirArg, name) {
|
|
|
29691
29724
|
);
|
|
29692
29725
|
}
|
|
29693
29726
|
return {
|
|
29694
|
-
outputDirectory:
|
|
29727
|
+
outputDirectory: path91.resolve(process.cwd(), slugifyName2(fromName)),
|
|
29695
29728
|
siteName: fromName
|
|
29696
29729
|
};
|
|
29697
29730
|
}
|
|
@@ -29874,8 +29907,8 @@ import open2 from "open";
|
|
|
29874
29907
|
import colors14 from "picocolors";
|
|
29875
29908
|
|
|
29876
29909
|
// src/cli/platform/device-auth.ts
|
|
29877
|
-
function url(apiUrl,
|
|
29878
|
-
return `${apiUrl}${
|
|
29910
|
+
function url(apiUrl, path104) {
|
|
29911
|
+
return `${apiUrl}${path104.startsWith("/") ? path104 : `/${path104}`}`;
|
|
29879
29912
|
}
|
|
29880
29913
|
async function requestDeviceCode(apiUrl) {
|
|
29881
29914
|
const response = await fetchWithRetry(
|
|
@@ -30057,7 +30090,7 @@ var logout_default = {
|
|
|
30057
30090
|
};
|
|
30058
30091
|
|
|
30059
30092
|
// src/cli/portal/commands.ts
|
|
30060
|
-
import
|
|
30093
|
+
import path92 from "node:path";
|
|
30061
30094
|
init_invariant();
|
|
30062
30095
|
function parseOnly(value) {
|
|
30063
30096
|
if (value === void 0) return void 0;
|
|
@@ -30074,7 +30107,7 @@ function parseOnly(value) {
|
|
|
30074
30107
|
async function run2(command2, argv, compute, format) {
|
|
30075
30108
|
const json = argv.json === true;
|
|
30076
30109
|
try {
|
|
30077
|
-
const dir =
|
|
30110
|
+
const dir = path92.resolve(process.cwd(), argv.dir ?? ".");
|
|
30078
30111
|
if (!await isConfigV2(dir)) {
|
|
30079
30112
|
throw new ServiceEditError(
|
|
30080
30113
|
`${command2} works with a config version 2 project, and there is none in ${dir}.`,
|
|
@@ -30183,7 +30216,7 @@ var plan_default = {
|
|
|
30183
30216
|
|
|
30184
30217
|
// src/cli/project/create-handler.ts
|
|
30185
30218
|
init_invariant();
|
|
30186
|
-
import
|
|
30219
|
+
import path93 from "node:path";
|
|
30187
30220
|
|
|
30188
30221
|
// src/cli/project/v2.ts
|
|
30189
30222
|
init_invariant();
|
|
@@ -30328,7 +30361,7 @@ async function createLinkedProject(argv, dir) {
|
|
|
30328
30361
|
}
|
|
30329
30362
|
}
|
|
30330
30363
|
async function createProject(argv) {
|
|
30331
|
-
const dir =
|
|
30364
|
+
const dir = path93.resolve(process.cwd(), argv.dir ?? ".");
|
|
30332
30365
|
if (await isConfigV2(dir)) {
|
|
30333
30366
|
await createLinkedProject(argv, dir);
|
|
30334
30367
|
return;
|
|
@@ -30452,14 +30485,14 @@ var remove_default = {
|
|
|
30452
30485
|
|
|
30453
30486
|
// src/cli/dev/handler.ts
|
|
30454
30487
|
init_joinUrl();
|
|
30455
|
-
import
|
|
30488
|
+
import path96 from "node:path";
|
|
30456
30489
|
|
|
30457
30490
|
// src/vite/dev-server.ts
|
|
30458
30491
|
init_logger();
|
|
30459
30492
|
import fs12 from "node:fs/promises";
|
|
30460
30493
|
import http from "node:http";
|
|
30461
30494
|
import https from "node:https";
|
|
30462
|
-
import
|
|
30495
|
+
import path95 from "node:path";
|
|
30463
30496
|
import { createHttpTerminator } from "http-terminator";
|
|
30464
30497
|
import {
|
|
30465
30498
|
createServer as createViteServer,
|
|
@@ -30492,7 +30525,7 @@ init_loader();
|
|
|
30492
30525
|
// src/vite/pagefind-dev-index.ts
|
|
30493
30526
|
init_invariant();
|
|
30494
30527
|
init_joinUrl();
|
|
30495
|
-
import
|
|
30528
|
+
import path94 from "node:path";
|
|
30496
30529
|
import { createIndex as createIndex2 } from "pagefind";
|
|
30497
30530
|
import { isRunnableDevEnvironment } from "vite";
|
|
30498
30531
|
async function* buildPagefindDevIndex(vite, config2) {
|
|
@@ -30545,7 +30578,7 @@ async function* buildPagefindDevIndex(vite, config2) {
|
|
|
30545
30578
|
path: urlPath
|
|
30546
30579
|
};
|
|
30547
30580
|
}
|
|
30548
|
-
const outputPath =
|
|
30581
|
+
const outputPath = path94.join(vite.config.publicDir, "pagefind");
|
|
30549
30582
|
await pagefindIndex.writeFiles({ outputPath });
|
|
30550
30583
|
yield { type: "complete", success: true, indexed };
|
|
30551
30584
|
}
|
|
@@ -30564,9 +30597,9 @@ var DevServer = class {
|
|
|
30564
30597
|
this.protocol = "https";
|
|
30565
30598
|
const { dir } = this.options;
|
|
30566
30599
|
const [key, cert, ca] = await Promise.all([
|
|
30567
|
-
fs12.readFile(
|
|
30568
|
-
fs12.readFile(
|
|
30569
|
-
config2.https.ca ? fs12.readFile(
|
|
30600
|
+
fs12.readFile(path95.resolve(dir, config2.https.key)),
|
|
30601
|
+
fs12.readFile(path95.resolve(dir, config2.https.cert)),
|
|
30602
|
+
config2.https.ca ? fs12.readFile(path95.resolve(dir, config2.https.ca)) : void 0
|
|
30570
30603
|
]);
|
|
30571
30604
|
return https.createServer({ key, cert, ca });
|
|
30572
30605
|
}
|
|
@@ -30583,7 +30616,7 @@ var DevServer = class {
|
|
|
30583
30616
|
);
|
|
30584
30617
|
const server = await this.createNodeServer(config2);
|
|
30585
30618
|
if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
|
|
30586
|
-
const publicRoot =
|
|
30619
|
+
const publicRoot = path95.resolve(
|
|
30587
30620
|
this.options.dir,
|
|
30588
30621
|
typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
|
|
30589
30622
|
);
|
|
@@ -30600,7 +30633,7 @@ var DevServer = class {
|
|
|
30600
30633
|
// built-in transform middleware which would treat the path as a static asset.
|
|
30601
30634
|
name: "apitogo:entry-client",
|
|
30602
30635
|
configureServer(server2) {
|
|
30603
|
-
const entryPath =
|
|
30636
|
+
const entryPath = path95.posix.join(
|
|
30604
30637
|
server2.config.base,
|
|
30605
30638
|
"/__z/entry.client.tsx"
|
|
30606
30639
|
);
|
|
@@ -30765,7 +30798,7 @@ init_package_json();
|
|
|
30765
30798
|
async function dev(argv) {
|
|
30766
30799
|
const packageJson3 = getZudokuPackageJson();
|
|
30767
30800
|
process.env.NODE_ENV = "development";
|
|
30768
|
-
let dir =
|
|
30801
|
+
let dir = path96.resolve(process.cwd(), argv.dir);
|
|
30769
30802
|
if (await isConfigV2(dir)) {
|
|
30770
30803
|
const { root, prepared } = await preparePortalWorkspace(dir, "development");
|
|
30771
30804
|
dir = root;
|
|
@@ -30864,7 +30897,7 @@ var run_default = {
|
|
|
30864
30897
|
};
|
|
30865
30898
|
|
|
30866
30899
|
// src/cli/secrets/handler.ts
|
|
30867
|
-
import
|
|
30900
|
+
import path97 from "node:path";
|
|
30868
30901
|
init_invariant();
|
|
30869
30902
|
|
|
30870
30903
|
// src/cli/secrets/input.ts
|
|
@@ -30929,7 +30962,7 @@ var SecretsError = class extends ApitogoError {
|
|
|
30929
30962
|
async function resolveProjectId2(argv, deps) {
|
|
30930
30963
|
const explicit = argv.projectId?.trim();
|
|
30931
30964
|
if (explicit) return explicit;
|
|
30932
|
-
const dir =
|
|
30965
|
+
const dir = path97.resolve(process.cwd(), argv.dir ?? ".");
|
|
30933
30966
|
if (await isConfigV2(dir)) {
|
|
30934
30967
|
const id = loadConfigV2(dir).resolved.project.id;
|
|
30935
30968
|
if (id) return id;
|
|
@@ -31089,12 +31122,12 @@ var secrets_default = {
|
|
|
31089
31122
|
};
|
|
31090
31123
|
|
|
31091
31124
|
// src/cli/cmds/status.ts
|
|
31092
|
-
import
|
|
31125
|
+
import path99 from "node:path";
|
|
31093
31126
|
|
|
31094
31127
|
// src/cli/status/handler.ts
|
|
31095
|
-
import
|
|
31128
|
+
import path98 from "node:path";
|
|
31096
31129
|
async function status(argv) {
|
|
31097
|
-
const sourceDirectory =
|
|
31130
|
+
const sourceDirectory = path98.resolve(process.cwd(), argv.dir);
|
|
31098
31131
|
let config2;
|
|
31099
31132
|
try {
|
|
31100
31133
|
config2 = loadConfig();
|
|
@@ -31192,7 +31225,7 @@ var status_default = {
|
|
|
31192
31225
|
}),
|
|
31193
31226
|
handler: async (argv) => {
|
|
31194
31227
|
await captureEvent({ argv, event: "apitogo status" });
|
|
31195
|
-
if (await isConfigV2(
|
|
31228
|
+
if (await isConfigV2(path99.resolve(process.cwd(), argv.dir))) {
|
|
31196
31229
|
await statusOfProject(argv);
|
|
31197
31230
|
return;
|
|
31198
31231
|
}
|
|
@@ -31201,11 +31234,11 @@ var status_default = {
|
|
|
31201
31234
|
};
|
|
31202
31235
|
|
|
31203
31236
|
// src/cli/cmds/teardown.ts
|
|
31204
|
-
import
|
|
31237
|
+
import path102 from "node:path";
|
|
31205
31238
|
|
|
31206
31239
|
// src/cli/teardown/command.ts
|
|
31207
31240
|
init_invariant();
|
|
31208
|
-
import
|
|
31241
|
+
import path100 from "node:path";
|
|
31209
31242
|
import { createInterface as createInterface7 } from "node:readline/promises";
|
|
31210
31243
|
|
|
31211
31244
|
// src/cli/teardown/v2.ts
|
|
@@ -31566,7 +31599,7 @@ async function teardownProject(argv) {
|
|
|
31566
31599
|
const progress = createConsoleProgressReporter();
|
|
31567
31600
|
const result = await teardownV2(
|
|
31568
31601
|
{
|
|
31569
|
-
dir:
|
|
31602
|
+
dir: path100.resolve(process.cwd(), argv.dir),
|
|
31570
31603
|
projectId: argv.projectId,
|
|
31571
31604
|
only: Array.isArray(argv.only) ? argv.only.join(",") : argv.only,
|
|
31572
31605
|
yes: argv.yes === true,
|
|
@@ -31625,7 +31658,7 @@ async function teardownProject(argv) {
|
|
|
31625
31658
|
}
|
|
31626
31659
|
|
|
31627
31660
|
// src/cli/teardown/handler.ts
|
|
31628
|
-
import
|
|
31661
|
+
import path101 from "node:path";
|
|
31629
31662
|
function resultLooksFailed3(payload) {
|
|
31630
31663
|
try {
|
|
31631
31664
|
const parsed = JSON.parse(payload);
|
|
@@ -31641,7 +31674,7 @@ async function teardown(argv) {
|
|
|
31641
31674
|
);
|
|
31642
31675
|
return;
|
|
31643
31676
|
}
|
|
31644
|
-
const sourceDirectory =
|
|
31677
|
+
const sourceDirectory = path101.resolve(process.cwd(), argv.dir);
|
|
31645
31678
|
let config2;
|
|
31646
31679
|
try {
|
|
31647
31680
|
config2 = loadConfig();
|
|
@@ -31719,7 +31752,7 @@ var teardown_default = {
|
|
|
31719
31752
|
}),
|
|
31720
31753
|
handler: async (argv) => {
|
|
31721
31754
|
await captureEvent({ argv, event: "apitogo teardown" });
|
|
31722
|
-
if (await isConfigV2(
|
|
31755
|
+
if (await isConfigV2(path102.resolve(process.cwd(), argv.dir))) {
|
|
31723
31756
|
await teardownProject(argv);
|
|
31724
31757
|
return;
|
|
31725
31758
|
}
|
|
@@ -31797,36 +31830,36 @@ function createApitogoCli(argv) {
|
|
|
31797
31830
|
// src/cli/local-handoff.ts
|
|
31798
31831
|
import { spawn as spawn5 } from "node:child_process";
|
|
31799
31832
|
import { existsSync as existsSync9, realpathSync as realpathSync2 } from "node:fs";
|
|
31800
|
-
import
|
|
31833
|
+
import path103 from "node:path";
|
|
31801
31834
|
var LOCAL_HANDOFF_ENV = "APITOGO_LOCAL_CLI";
|
|
31802
31835
|
var PACKAGE_NAME = "@lukoweb/apitogo";
|
|
31803
31836
|
var resolveProjectDir = (argv, cwd) => {
|
|
31804
31837
|
for (let i = 0; i < argv.length; i++) {
|
|
31805
31838
|
const arg = argv[i];
|
|
31806
31839
|
const next = argv[i + 1];
|
|
31807
|
-
if (arg === "--dir" && next) return
|
|
31840
|
+
if (arg === "--dir" && next) return path103.resolve(cwd, next);
|
|
31808
31841
|
if (arg?.startsWith("--dir=")) {
|
|
31809
|
-
return
|
|
31842
|
+
return path103.resolve(cwd, arg.slice("--dir=".length));
|
|
31810
31843
|
}
|
|
31811
31844
|
}
|
|
31812
31845
|
return cwd;
|
|
31813
31846
|
};
|
|
31814
31847
|
var findLocalCli = (projectDir, runningRoot) => {
|
|
31815
|
-
let dir =
|
|
31848
|
+
let dir = path103.resolve(projectDir);
|
|
31816
31849
|
let localPackageRoot;
|
|
31817
31850
|
while (!localPackageRoot) {
|
|
31818
|
-
const candidate =
|
|
31819
|
-
if (existsSync9(
|
|
31851
|
+
const candidate = path103.join(dir, "node_modules", PACKAGE_NAME);
|
|
31852
|
+
if (existsSync9(path103.join(candidate, "package.json"))) {
|
|
31820
31853
|
localPackageRoot = candidate;
|
|
31821
|
-
} else if (dir ===
|
|
31854
|
+
} else if (dir === path103.dirname(dir)) {
|
|
31822
31855
|
return void 0;
|
|
31823
31856
|
} else {
|
|
31824
|
-
dir =
|
|
31857
|
+
dir = path103.dirname(dir);
|
|
31825
31858
|
}
|
|
31826
31859
|
}
|
|
31827
31860
|
const localRoot = realpathSync2(localPackageRoot);
|
|
31828
31861
|
if (localRoot === realpathSync2(runningRoot)) return void 0;
|
|
31829
|
-
return
|
|
31862
|
+
return path103.join(localRoot, "cli.js");
|
|
31830
31863
|
};
|
|
31831
31864
|
var handoffToLocalCli = async (argv, runningRoot) => {
|
|
31832
31865
|
if (process.env[LOCAL_HANDOFF_ENV] || process.env.ZUDOKU_ENV === "internal") {
|
|
@@ -31838,7 +31871,7 @@ var handoffToLocalCli = async (argv, runningRoot) => {
|
|
|
31838
31871
|
);
|
|
31839
31872
|
if (!localCli) return void 0;
|
|
31840
31873
|
printDiagnosticsToConsole(
|
|
31841
|
-
`Using the project's local ${PACKAGE_NAME} (${
|
|
31874
|
+
`Using the project's local ${PACKAGE_NAME} (${path103.dirname(localCli)})`
|
|
31842
31875
|
);
|
|
31843
31876
|
const child = spawn5(process.execPath, [localCli, ...argv], {
|
|
31844
31877
|
stdio: "inherit",
|