@lukoweb/apitogo 0.1.98 → 0.1.100

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 CHANGED
@@ -832,7 +832,7 @@ import { stat } from "node:fs/promises";
832
832
  var fileExists;
833
833
  var init_file_exists = __esm({
834
834
  "src/config/file-exists.ts"() {
835
- fileExists = (path70) => stat(path70).then(() => true).catch(() => false);
835
+ fileExists = (path71) => stat(path71).then(() => true).catch(() => false);
836
836
  }
837
837
  });
838
838
 
@@ -5628,8 +5628,8 @@ var PlatformApiClient = class {
5628
5628
  constructor(config2) {
5629
5629
  this.config = config2;
5630
5630
  }
5631
- url(path70) {
5632
- return `${this.config.apiUrl}${path70.startsWith("/") ? path70 : `/${path70}`}`;
5631
+ url(path71) {
5632
+ return `${this.config.apiUrl}${path71.startsWith("/") ? path71 : `/${path71}`}`;
5633
5633
  }
5634
5634
  headers(extra) {
5635
5635
  return {
@@ -5639,9 +5639,9 @@ var PlatformApiClient = class {
5639
5639
  ...extra
5640
5640
  };
5641
5641
  }
5642
- async request(method, path70, init4) {
5642
+ async request(method, path71, init4) {
5643
5643
  const response = await fetchWithRetry(
5644
- this.url(path70),
5644
+ this.url(path71),
5645
5645
  {
5646
5646
  method,
5647
5647
  ...init4,
@@ -5841,15 +5841,15 @@ var PlatformApiClient = class {
5841
5841
  }
5842
5842
  );
5843
5843
  }
5844
- deleteDevPortalPage(projectId, path70) {
5845
- const query = new URLSearchParams({ path: path70 });
5844
+ deleteDevPortalPage(projectId, path71) {
5845
+ const query = new URLSearchParams({ path: path71 });
5846
5846
  return this.request(
5847
5847
  "DELETE",
5848
5848
  `/api/v1/projects/${projectId}/dev-portal/pages/files?${query.toString()}`
5849
5849
  );
5850
5850
  }
5851
- renameDevPortalPage(projectId, path70, newName) {
5852
- const query = new URLSearchParams({ path: path70 });
5851
+ renameDevPortalPage(projectId, path71, newName) {
5852
+ const query = new URLSearchParams({ path: path71 });
5853
5853
  return this.request(
5854
5854
  "POST",
5855
5855
  `/api/v1/projects/${projectId}/dev-portal/pages/files/rename?${query.toString()}`,
@@ -7449,8 +7449,8 @@ function normalizeActionKey(actionKey) {
7449
7449
  const trimmed = actionKey.trim();
7450
7450
  if (trimmed.includes(":")) {
7451
7451
  const [method2, ...pathParts] = trimmed.split(":");
7452
- const path71 = pathParts.join(":").trim();
7453
- return `${method2.toLowerCase()}:${path71.startsWith("/") ? path71 : `/${path71}`}`;
7452
+ const path72 = pathParts.join(":").trim();
7453
+ return `${method2.toLowerCase()}:${path72.startsWith("/") ? path72 : `/${path72}`}`;
7454
7454
  }
7455
7455
  const spaceIndex = trimmed.indexOf(" ");
7456
7456
  if (spaceIndex <= 0) {
@@ -7459,8 +7459,8 @@ function normalizeActionKey(actionKey) {
7459
7459
  );
7460
7460
  }
7461
7461
  const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
7462
- const path70 = trimmed.slice(spaceIndex + 1).trim();
7463
- return `${method}:${path70.startsWith("/") ? path70 : `/${path70}`}`;
7462
+ const path71 = trimmed.slice(spaceIndex + 1).trim();
7463
+ return `${method}:${path71.startsWith("/") ? path71 : `/${path71}`}`;
7464
7464
  }
7465
7465
  async function applyGatewayPublicRoutes(client, projectId, routes, options) {
7466
7466
  const applied = [];
@@ -7525,13 +7525,33 @@ async function listAllGatewayActions(client, projectId, pageSize = 100) {
7525
7525
  }
7526
7526
  return items;
7527
7527
  }
7528
+ async function resolveIncludedActionKeysForCreate(client, projectId, includedActionKeys, options) {
7529
+ if (options?.skipDefaultActions) {
7530
+ return includedActionKeys ?? [];
7531
+ }
7532
+ if (includedActionKeys && includedActionKeys.length > 0) {
7533
+ return includedActionKeys;
7534
+ }
7535
+ try {
7536
+ const actions = await listAllGatewayActions(client, projectId);
7537
+ return actions.map((action) => action.actionKey);
7538
+ } catch {
7539
+ return includedActionKeys ?? [];
7540
+ }
7541
+ }
7528
7542
  async function handleCreateGatewayPlan(client, config2, args) {
7529
7543
  const projectId = resolveProjectId(args.projectId, config2);
7544
+ const includedActionKeys = await resolveIncludedActionKeysForCreate(
7545
+ client,
7546
+ projectId,
7547
+ args.includedActionKeys,
7548
+ { skipDefaultActions: args.skipDefaultActions }
7549
+ );
7530
7550
  const body = {
7531
7551
  sku: args.sku,
7532
7552
  displayName: args.displayName,
7533
7553
  limitsJson: args.limitsJson ?? null,
7534
- includedActionKeys: args.includedActionKeys ?? [],
7554
+ includedActionKeys,
7535
7555
  priceAmount: args.priceAmount,
7536
7556
  priceCurrency: args.priceCurrency,
7537
7557
  billingPeriod: args.billingPeriod,
@@ -7725,6 +7745,14 @@ function resolveIncludedActionKeysForUpsert(manifestPlan, existingPlan) {
7725
7745
  }
7726
7746
  return [];
7727
7747
  }
7748
+ async function resolveActionKeysOrAllProjectActions(manifestPlan, existingPlan, getAllKeys) {
7749
+ const resolved = resolveIncludedActionKeysForUpsert(manifestPlan, existingPlan);
7750
+ if (resolved.length > 0) {
7751
+ return resolved;
7752
+ }
7753
+ const allKeys = await getAllKeys();
7754
+ return allKeys.length > 0 ? allKeys : resolved;
7755
+ }
7728
7756
  var GATEWAY_PLAN_SORT_TEMP_OFFSET = 1e3;
7729
7757
  function buildGatewayPlanSortTargetsFromIds(manifestPlans, planIdsBySku, skuById) {
7730
7758
  const targets = [];
@@ -7759,17 +7787,36 @@ async function applyGatewayPlanSortOrders(client, config2, projectId, targets) {
7759
7787
  }
7760
7788
  return results;
7761
7789
  }
7790
+ async function listProjectActionKeys(client, projectId) {
7791
+ try {
7792
+ const actions = await listAllGatewayActions(client, projectId);
7793
+ return actions.map((action) => action.actionKey);
7794
+ } catch {
7795
+ return [];
7796
+ }
7797
+ }
7762
7798
  async function upsertGatewayPlansFromManifest(client, config2, projectId, plans, options) {
7763
7799
  const existing = await client.listGatewayPlans(projectId);
7764
7800
  const bySku = new Map(existing.map((plan) => [plan.sku.toLowerCase(), plan]));
7765
7801
  const results = [];
7766
7802
  const planIdsBySku = /* @__PURE__ */ new Map();
7803
+ let cachedProjectActionKeys;
7804
+ const projectActionKeys = async () => {
7805
+ if (cachedProjectActionKeys === void 0) {
7806
+ cachedProjectActionKeys = await listProjectActionKeys(client, projectId);
7807
+ }
7808
+ return cachedProjectActionKeys;
7809
+ };
7767
7810
  for (const [index, inputRaw] of plans.entries()) {
7768
7811
  const input3 = normalizePlanForGatewayApi(inputRaw);
7769
7812
  const found = bySku.get(input3.sku.toLowerCase());
7770
7813
  if (found) {
7771
7814
  if (options?.syncActionsOnly) {
7772
- const actionKeys = resolveIncludedActionKeysForUpsert(input3, found);
7815
+ const actionKeys = await resolveActionKeysOrAllProjectActions(
7816
+ input3,
7817
+ found,
7818
+ projectActionKeys
7819
+ );
7773
7820
  if (actionKeys.length === 0) {
7774
7821
  continue;
7775
7822
  }
@@ -7793,7 +7840,11 @@ async function upsertGatewayPlansFromManifest(client, config2, projectId, plans,
7793
7840
  billingPeriod: input3.billingPeriod ? normalizeBillingPeriod(input3.billingPeriod) : void 0
7794
7841
  };
7795
7842
  if (!options?.deferActionKeys) {
7796
- patchArgs.includedActionKeys = resolveIncludedActionKeysForUpsert(input3, found);
7843
+ patchArgs.includedActionKeys = await resolveActionKeysOrAllProjectActions(
7844
+ input3,
7845
+ found,
7846
+ projectActionKeys
7847
+ );
7797
7848
  }
7798
7849
  const patchedJson = await handlePatchGatewayPlan(client, config2, patchArgs);
7799
7850
  results.push(JSON.parse(patchedJson));
@@ -7811,7 +7862,8 @@ async function upsertGatewayPlansFromManifest(client, config2, projectId, plans,
7811
7862
  priceCurrency: input3.priceCurrency ?? "usd",
7812
7863
  billingPeriod: normalizeBillingPeriod(input3.billingPeriod),
7813
7864
  limitsJson: planLimitsForPlatform(input3),
7814
- includedActionKeys: options?.deferActionKeys ? [] : resolveIncludedActionKeysForUpsert(input3),
7865
+ includedActionKeys: options?.deferActionKeys ? [] : await resolveActionKeysOrAllProjectActions(input3, void 0, projectActionKeys),
7866
+ skipDefaultActions: true,
7815
7867
  sortOrder: index
7816
7868
  });
7817
7869
  const created = JSON.parse(createdJson);
@@ -11620,8 +11672,8 @@ function normalizeActionKeyFormat(actionKey) {
11620
11672
  const trimmed = actionKey.trim();
11621
11673
  if (trimmed.includes(":")) {
11622
11674
  const [method2, ...pathParts] = trimmed.split(":");
11623
- const path71 = pathParts.join(":").trim();
11624
- return `${method2.toLowerCase()}:${path71.startsWith("/") ? path71 : `/${path71}`}`;
11675
+ const path72 = pathParts.join(":").trim();
11676
+ return `${method2.toLowerCase()}:${path72.startsWith("/") ? path72 : `/${path72}`}`;
11625
11677
  }
11626
11678
  const spaceIndex = trimmed.indexOf(" ");
11627
11679
  if (spaceIndex <= 0) {
@@ -11630,8 +11682,8 @@ function normalizeActionKeyFormat(actionKey) {
11630
11682
  );
11631
11683
  }
11632
11684
  const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
11633
- const path70 = trimmed.slice(spaceIndex + 1).trim();
11634
- return `${method}:${path70.startsWith("/") ? path70 : `/${path70}`}`;
11685
+ const path71 = trimmed.slice(spaceIndex + 1).trim();
11686
+ return `${method}:${path71.startsWith("/") ? path71 : `/${path71}`}`;
11635
11687
  }
11636
11688
  function normalizePublicRoute(route) {
11637
11689
  const trimmed = route.trim();
@@ -12748,7 +12800,7 @@ import {
12748
12800
  // package.json
12749
12801
  var package_default = {
12750
12802
  name: "@lukoweb/apitogo",
12751
- version: "0.1.98",
12803
+ version: "0.1.100",
12752
12804
  type: "module",
12753
12805
  sideEffects: [
12754
12806
  "**/*.css",
@@ -13526,14 +13578,14 @@ var flattenAllOf = (schema2) => {
13526
13578
  };
13527
13579
 
13528
13580
  // src/lib/util/traverse.ts
13529
- var traverse = (specification, transform, path70 = []) => {
13530
- const transformed = transform(specification, path70);
13581
+ var traverse = (specification, transform, path71 = []) => {
13582
+ const transformed = transform(specification, path71);
13531
13583
  if (typeof transformed !== "object" || transformed === null) {
13532
13584
  return transformed;
13533
13585
  }
13534
13586
  const result = Array.isArray(transformed) ? [] : {};
13535
13587
  for (const [key, value] of Object.entries(transformed)) {
13536
- const currentPath = [...path70, key];
13588
+ const currentPath = [...path71, key];
13537
13589
  if (Array.isArray(value)) {
13538
13590
  result[key] = value.map(
13539
13591
  (item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
@@ -13561,9 +13613,9 @@ var resolveLocalRef = (schema2, ref) => {
13561
13613
  if (schemaCache?.has(ref)) {
13562
13614
  return schemaCache.get(ref);
13563
13615
  }
13564
- const path70 = ref.split("/").slice(1);
13616
+ const path71 = ref.split("/").slice(1);
13565
13617
  let current = schema2;
13566
- for (const segment of path70) {
13618
+ for (const segment of path71) {
13567
13619
  if (!current || typeof current !== "object") {
13568
13620
  current = null;
13569
13621
  }
@@ -13582,7 +13634,7 @@ var dereference = async (schema2, resolvers = []) => {
13582
13634
  }
13583
13635
  const cloned = structuredClone(schema2);
13584
13636
  const visited = /* @__PURE__ */ new Set();
13585
- const resolve = async (current, path70) => {
13637
+ const resolve = async (current, path71) => {
13586
13638
  if (isIndexableObject(current)) {
13587
13639
  if (visited.has(current)) {
13588
13640
  return CIRCULAR_REF;
@@ -13590,7 +13642,7 @@ var dereference = async (schema2, resolvers = []) => {
13590
13642
  visited.add(current);
13591
13643
  if (Array.isArray(current)) {
13592
13644
  for (let index = 0; index < current.length; index++) {
13593
- current[index] = await resolve(current[index], `${path70}/${index}`);
13645
+ current[index] = await resolve(current[index], `${path71}/${index}`);
13594
13646
  }
13595
13647
  } else {
13596
13648
  if ("$ref" in current && typeof current.$ref === "string") {
@@ -13601,13 +13653,13 @@ var dereference = async (schema2, resolvers = []) => {
13601
13653
  for (const resolver of resolvers) {
13602
13654
  const resolved = await resolver($ref);
13603
13655
  if (resolved) {
13604
- result2 = await resolve(resolved, path70);
13656
+ result2 = await resolve(resolved, path71);
13605
13657
  break;
13606
13658
  }
13607
13659
  }
13608
13660
  if (result2 === void 0) {
13609
13661
  const resolved = await resolveLocalRef(cloned, $ref);
13610
- result2 = await resolve(resolved, path70);
13662
+ result2 = await resolve(resolved, path71);
13611
13663
  }
13612
13664
  if (hasSiblings) {
13613
13665
  if (result2 === CIRCULAR_REF) {
@@ -13620,7 +13672,7 @@ var dereference = async (schema2, resolvers = []) => {
13620
13672
  return result2;
13621
13673
  }
13622
13674
  for (const key in current) {
13623
- current[key] = await resolve(current[key], `${path70}/${key}`);
13675
+ current[key] = await resolve(current[key], `${path71}/${key}`);
13624
13676
  }
13625
13677
  }
13626
13678
  visited.delete(current);
@@ -13659,9 +13711,9 @@ var upgradeSchema = (schema2) => {
13659
13711
  }
13660
13712
  return sub;
13661
13713
  });
13662
- schema2 = traverse(schema2, (sub, path70) => {
13714
+ schema2 = traverse(schema2, (sub, path71) => {
13663
13715
  if (sub.example !== void 0) {
13664
- if (isSchemaPath(path70 ?? [])) {
13716
+ if (isSchemaPath(path71 ?? [])) {
13665
13717
  sub.examples = [sub.example];
13666
13718
  } else {
13667
13719
  sub.examples = {
@@ -13674,11 +13726,11 @@ var upgradeSchema = (schema2) => {
13674
13726
  }
13675
13727
  return sub;
13676
13728
  });
13677
- schema2 = traverse(schema2, (schema3, path70) => {
13729
+ schema2 = traverse(schema2, (schema3, path71) => {
13678
13730
  if (schema3.type === "object" && schema3.properties !== void 0) {
13679
- const parentPath = path70?.slice(0, -1);
13731
+ const parentPath = path71?.slice(0, -1);
13680
13732
  const isMultipart = parentPath?.some((segment, index) => {
13681
- return segment === "content" && path70?.[index + 1] === "multipart/form-data";
13733
+ return segment === "content" && path71?.[index + 1] === "multipart/form-data";
13682
13734
  });
13683
13735
  if (isMultipart) {
13684
13736
  const entries = Object.entries(schema3.properties);
@@ -13692,8 +13744,8 @@ var upgradeSchema = (schema2) => {
13692
13744
  }
13693
13745
  return schema3;
13694
13746
  });
13695
- schema2 = traverse(schema2, (schema3, path70) => {
13696
- if (path70?.includes("content") && path70.includes("application/octet-stream")) {
13747
+ schema2 = traverse(schema2, (schema3, path71) => {
13748
+ if (path71?.includes("content") && path71.includes("application/octet-stream")) {
13697
13749
  return {};
13698
13750
  }
13699
13751
  if (schema3.type === "string" && schema3.format === "binary") {
@@ -13719,11 +13771,11 @@ var upgradeSchema = (schema2) => {
13719
13771
  }
13720
13772
  return sub;
13721
13773
  });
13722
- schema2 = traverse(schema2, (schema3, path70) => {
13774
+ schema2 = traverse(schema2, (schema3, path71) => {
13723
13775
  if (schema3.type === "string" && schema3.format === "byte") {
13724
- const parentPath = path70?.slice(0, -1);
13776
+ const parentPath = path71?.slice(0, -1);
13725
13777
  const contentMediaType = parentPath?.find(
13726
- (_, index) => path70?.[index - 1] === "content"
13778
+ (_, index) => path71?.[index - 1] === "content"
13727
13779
  );
13728
13780
  return {
13729
13781
  type: "string",
@@ -13735,7 +13787,7 @@ var upgradeSchema = (schema2) => {
13735
13787
  });
13736
13788
  return schema2;
13737
13789
  };
13738
- function isSchemaPath(path70) {
13790
+ function isSchemaPath(path71) {
13739
13791
  const schemaLocations = [
13740
13792
  ["components", "schemas"],
13741
13793
  "properties",
@@ -13748,10 +13800,10 @@ function isSchemaPath(path70) {
13748
13800
  ];
13749
13801
  return schemaLocations.some((location) => {
13750
13802
  if (Array.isArray(location)) {
13751
- return location.every((segment, index) => path70[index] === segment);
13803
+ return location.every((segment, index) => path71[index] === segment);
13752
13804
  }
13753
- return path70.includes(location);
13754
- }) || path70.includes("schema") || path70.some((segment) => segment.endsWith("Schema"));
13805
+ return path71.includes(location);
13806
+ }) || path71.includes("schema") || path71.some((segment) => segment.endsWith("Schema"));
13755
13807
  }
13756
13808
 
13757
13809
  // src/lib/oas/parser/index.ts
@@ -13833,13 +13885,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
13833
13885
  "anyOf",
13834
13886
  "oneOf"
13835
13887
  ]);
13836
- var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path70 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
13888
+ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path71 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
13837
13889
  if (obj === null || typeof obj !== "object") return obj;
13838
13890
  const refPath = obj.__$ref;
13839
13891
  const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
13840
13892
  if (isCircular) {
13841
13893
  if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
13842
- const circularProp = path70.find((p) => !OPENAPI_PROPS.has(p)) || path70[0];
13894
+ const circularProp = path71.find((p) => !OPENAPI_PROPS.has(p)) || path71[0];
13843
13895
  return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
13844
13896
  }
13845
13897
  if (refs.has(obj)) return refs.get(obj);
@@ -13849,7 +13901,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
13849
13901
  value,
13850
13902
  currentPath,
13851
13903
  refs,
13852
- [...path70, key],
13904
+ [...path71, key],
13853
13905
  currentRefPaths
13854
13906
  );
13855
13907
  const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
@@ -13884,7 +13936,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
13884
13936
  var getAllTags = (schema2) => {
13885
13937
  const rootTags = schema2.tags ?? [];
13886
13938
  const operations = Object.values(schema2.paths ?? {}).flatMap(
13887
- (path70) => HttpMethods.map((k) => path70?.[k]).filter((op) => op != null)
13939
+ (path71) => HttpMethods.map((k) => path71?.[k]).filter((op) => op != null)
13888
13940
  );
13889
13941
  const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
13890
13942
  const hasUntaggedOperations = operations.some(
@@ -13939,7 +13991,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
13939
13991
  var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
13940
13992
  var getAllOperations = (paths) => {
13941
13993
  const operations = Object.entries(paths ?? {}).flatMap(
13942
- ([path70, value]) => HttpMethods.flatMap((method) => {
13994
+ ([path71, value]) => HttpMethods.flatMap((method) => {
13943
13995
  if (!value?.[method]) return [];
13944
13996
  const operation = value[method];
13945
13997
  const pathParameters = value.parameters ?? [];
@@ -13959,7 +14011,7 @@ var getAllOperations = (paths) => {
13959
14011
  return {
13960
14012
  ...operation,
13961
14013
  method,
13962
- path: path70,
14014
+ path: path71,
13963
14015
  parameters,
13964
14016
  servers,
13965
14017
  tags: operation.tags ?? []
@@ -14317,8 +14369,8 @@ var Schema = builder.objectRef("Schema").implement({
14317
14369
  }),
14318
14370
  paths: t.field({
14319
14371
  type: [PathItem],
14320
- resolve: (root) => Object.entries(root.paths ?? {}).map(([path70, value]) => ({
14321
- path: path70,
14372
+ resolve: (root) => Object.entries(root.paths ?? {}).map(([path71, value]) => ({
14373
+ path: path71,
14322
14374
  // biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
14323
14375
  methods: Object.keys(value)
14324
14376
  }))
@@ -14483,7 +14535,7 @@ init_joinUrl();
14483
14535
 
14484
14536
  // src/vite/api/schema-codegen.ts
14485
14537
  var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
14486
- var getSegmentsFromPath = (path70) => path70.split("/").slice(1).map(unescapeJsonPointer);
14538
+ var getSegmentsFromPath = (path71) => path71.split("/").slice(1).map(unescapeJsonPointer);
14487
14539
  var createLocalRefMap = (obj) => {
14488
14540
  const refMap = /* @__PURE__ */ new Map();
14489
14541
  const siblingsMap = /* @__PURE__ */ new Map();
@@ -14514,16 +14566,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
14514
14566
  /"__refMap\+Siblings:(.*?)"/g,
14515
14567
  (_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
14516
14568
  );
14517
- var lookup2 = (schema2, path70, filePath) => {
14518
- const parts = getSegmentsFromPath(path70);
14569
+ var lookup2 = (schema2, path71, filePath) => {
14570
+ const parts = getSegmentsFromPath(path71);
14519
14571
  let val = schema2;
14520
14572
  for (const part of parts) {
14521
14573
  while (val.$ref?.startsWith("#/")) {
14522
- val = val.$ref === path70 ? val : lookup2(schema2, val.$ref, filePath);
14574
+ val = val.$ref === path71 ? val : lookup2(schema2, val.$ref, filePath);
14523
14575
  }
14524
14576
  if (val[part] === void 0) {
14525
14577
  throw new Error(
14526
- `Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path70}`
14578
+ `Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path71}`
14527
14579
  );
14528
14580
  }
14529
14581
  val = val[part];
@@ -14768,8 +14820,8 @@ var SchemaManager = class {
14768
14820
  }
14769
14821
  }
14770
14822
  };
14771
- getLatestSchema = (path70) => this.processedSchemas[path70]?.at(0);
14772
- getSchemasForPath = (path70) => this.processedSchemas[path70];
14823
+ getLatestSchema = (path71) => this.processedSchemas[path71]?.at(0);
14824
+ getSchemasForPath = (path71) => this.processedSchemas[path71];
14773
14825
  getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
14774
14826
  getUrlToFilePathMap = () => {
14775
14827
  const map = /* @__PURE__ */ new Map();
@@ -17227,14 +17279,14 @@ async function generateSitemap({
17227
17279
 
17228
17280
  // src/vite/prerender/utils.ts
17229
17281
  init_joinUrl();
17230
- var resolveRoutePath = (path70) => {
17231
- const segments = path70.split("/");
17282
+ var resolveRoutePath = (path71) => {
17283
+ const segments = path71.split("/");
17232
17284
  if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
17233
17285
  return void 0;
17234
17286
  }
17235
17287
  return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
17236
17288
  };
17237
- var isSkipped = (path70) => path70.includes("*") || /^\d+$/.test(path70);
17289
+ var isSkipped = (path71) => path71.includes("*") || /^\d+$/.test(path71);
17238
17290
  var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
17239
17291
  if (route.path && isSkipped(route.path)) return [];
17240
17292
  const routePath = route.path ? resolveRoutePath(route.path) : void 0;
@@ -17826,7 +17878,7 @@ var check_default = {
17826
17878
  // src/cli/make-config/handler.ts
17827
17879
  import { constants as constants2 } from "node:fs";
17828
17880
  import { access as access8, mkdir as mkdir12, readFile as readFile16, writeFile as writeFile15 } from "node:fs/promises";
17829
- import path60 from "node:path";
17881
+ import path61 from "node:path";
17830
17882
  import { stdin as input2 } from "node:process";
17831
17883
  import { glob as glob5 } from "glob";
17832
17884
 
@@ -19860,7 +19912,7 @@ function printPlanAddedHint(displayName) {
19860
19912
  `Plan "${displayName}" added to modules.userPanel.plans.items in apitogo.config.json.`
19861
19913
  );
19862
19914
  printDiagnosticsToConsole(
19863
- "Configure includedActionKeys, billing, and Stripe in the manifest before publish."
19915
+ "New plans copy includedActionKeys from the local OpenAPI file when present. Set includedActionKeys to restrict, and configure Stripe before publishing paid plans."
19864
19916
  );
19865
19917
  printDiagnosticsToConsole(`Docs: ${DOCS}/docs/configuration/plans`);
19866
19918
  }
@@ -20316,8 +20368,139 @@ async function ensureThinConfigTsx(dir) {
20316
20368
  return true;
20317
20369
  }
20318
20370
 
20371
+ // src/cli/platform/helpers/openapi-action-keys.ts
20372
+ import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
20373
+ import path60 from "node:path";
20374
+ import YAML3 from "yaml";
20375
+ var HTTP_METHODS = [
20376
+ "get",
20377
+ "post",
20378
+ "put",
20379
+ "patch",
20380
+ "delete",
20381
+ "head",
20382
+ "options"
20383
+ ];
20384
+ function normalizeOpenApiPathTemplate(pathTemplate) {
20385
+ if (!pathTemplate.trim()) {
20386
+ return "/";
20387
+ }
20388
+ let value = pathTemplate.trim();
20389
+ if (!value.startsWith("/")) {
20390
+ value = `/${value}`;
20391
+ }
20392
+ if (value.length > 1 && value.endsWith("/")) {
20393
+ value = value.replace(/\/+$/, "");
20394
+ }
20395
+ return value;
20396
+ }
20397
+ function resolveRelativeServerBasePath(document) {
20398
+ const serverUrl = document.servers?.[0]?.url;
20399
+ if (!serverUrl || serverUrl === "/") {
20400
+ return null;
20401
+ }
20402
+ return serverUrl.startsWith("/") ? serverUrl.replace(/\/+$/, "") : null;
20403
+ }
20404
+ function combineBasePath(basePath, pathKey) {
20405
+ const normalizedPath = normalizeOpenApiPathTemplate(pathKey);
20406
+ if (!basePath || basePath === "/") {
20407
+ return normalizedPath;
20408
+ }
20409
+ const baseNorm = normalizeOpenApiPathTemplate(basePath);
20410
+ if (normalizedPath === "/") {
20411
+ return baseNorm;
20412
+ }
20413
+ return `${baseNorm.replace(/\/+$/, "")}${normalizedPath}`;
20414
+ }
20415
+ function extractGatewayActionKeysFromOpenApiDocument(document) {
20416
+ if (!document || typeof document !== "object") {
20417
+ return [];
20418
+ }
20419
+ const spec = document;
20420
+ if (!spec.paths || typeof spec.paths !== "object") {
20421
+ return [];
20422
+ }
20423
+ const basePath = resolveRelativeServerBasePath(spec);
20424
+ const keys = /* @__PURE__ */ new Set();
20425
+ for (const [pathKey, pathItem] of Object.entries(spec.paths)) {
20426
+ if (!pathItem || typeof pathItem !== "object") {
20427
+ continue;
20428
+ }
20429
+ const pathTemplate = combineBasePath(basePath, pathKey);
20430
+ for (const method of HTTP_METHODS) {
20431
+ if (!pathItem[method] || typeof pathItem[method] !== "object") {
20432
+ continue;
20433
+ }
20434
+ keys.add(`${method}:${pathTemplate}`);
20435
+ }
20436
+ }
20437
+ return [...keys].sort((a, b) => a.localeCompare(b));
20438
+ }
20439
+ function extractGatewayActionKeysFromOpenApiFile(filePath) {
20440
+ try {
20441
+ const raw = readFileSync3(filePath, "utf8");
20442
+ const ext = path60.extname(filePath).toLowerCase();
20443
+ const parsed = ext === ".json" ? JSON.parse(raw) : YAML3.parse(raw);
20444
+ return extractGatewayActionKeysFromOpenApiDocument(parsed);
20445
+ } catch {
20446
+ return [];
20447
+ }
20448
+ }
20449
+ function resolveConfigOpenApiFilePath(siteDirectory, config2) {
20450
+ const backend = config2.backend;
20451
+ const candidates = [];
20452
+ if (typeof backend?.openApiPath === "string" && backend.openApiPath.trim()) {
20453
+ candidates.push(backend.openApiPath.trim());
20454
+ }
20455
+ const apis = config2.apis;
20456
+ const entries = Array.isArray(apis) ? apis : apis ? [apis] : [];
20457
+ for (const entry of entries) {
20458
+ if (entry && typeof entry === "object" && entry.type === "file" && typeof entry.input === "string") {
20459
+ candidates.push(entry.input);
20460
+ }
20461
+ }
20462
+ for (const candidate of candidates) {
20463
+ const resolved = path60.isAbsolute(candidate) ? candidate : path60.resolve(siteDirectory, candidate);
20464
+ if (existsSync4(resolved)) {
20465
+ return resolved;
20466
+ }
20467
+ }
20468
+ return void 0;
20469
+ }
20470
+ function loadOpenApiActionKeysForSite(siteDirectory, config2) {
20471
+ const filePath = resolveConfigOpenApiFilePath(siteDirectory, config2);
20472
+ if (!filePath) {
20473
+ return [];
20474
+ }
20475
+ return extractGatewayActionKeysFromOpenApiFile(filePath);
20476
+ }
20477
+ function loadOpenApiActionKeysFromSiteDirectory(siteDirectory) {
20478
+ const configPath = path60.join(siteDirectory, "apitogo.config.json");
20479
+ if (!existsSync4(configPath)) {
20480
+ return [];
20481
+ }
20482
+ try {
20483
+ const parsed = JSON.parse(readFileSync3(configPath, "utf8"));
20484
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
20485
+ return [];
20486
+ }
20487
+ return loadOpenApiActionKeysForSite(siteDirectory, parsed);
20488
+ } catch {
20489
+ return [];
20490
+ }
20491
+ }
20492
+ function withDefaultIncludedActionKeys(plan, actionKeys) {
20493
+ if (plan.includedActionKeys && plan.includedActionKeys.length > 0) {
20494
+ return plan;
20495
+ }
20496
+ if (actionKeys.length === 0) {
20497
+ return plan;
20498
+ }
20499
+ return { ...plan, includedActionKeys: actionKeys };
20500
+ }
20501
+
20319
20502
  // src/cli/make-config/handler.ts
20320
- var toPosixPath2 = (value) => value.split(path60.sep).join(path60.posix.sep);
20503
+ var toPosixPath2 = (value) => value.split(path61.sep).join(path61.posix.sep);
20321
20504
  var fileExists3 = async (filePath) => {
20322
20505
  try {
20323
20506
  await access8(filePath, constants2.F_OK);
@@ -20375,7 +20558,7 @@ async function persistConfig(config2, ctx) {
20375
20558
  };
20376
20559
  await writeFile15(ctx.jsonPath, `${JSON.stringify(next, null, 2)}
20377
20560
  `, "utf8");
20378
- const tsxPath = path60.join(ctx.dir, "apitogo.config.tsx");
20561
+ const tsxPath = path61.join(ctx.dir, "apitogo.config.tsx");
20379
20562
  if (await fileExists3(tsxPath) && tsxRoutes.length > 0) {
20380
20563
  const tsxSource = await readFile16(tsxPath, "utf8");
20381
20564
  if (isManagedConfigWrapper(tsxSource)) {
@@ -20402,7 +20585,7 @@ function mergeBackendFlag(config2, backend) {
20402
20585
  return next;
20403
20586
  }
20404
20587
  async function makeConfig(argv) {
20405
- const dir = path60.resolve(process.cwd(), argv.dir);
20588
+ const dir = path61.resolve(process.cwd(), argv.dir);
20406
20589
  const pagesDir = toPosixPath2(
20407
20590
  argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
20408
20591
  );
@@ -20422,14 +20605,14 @@ async function makeConfig(argv) {
20422
20605
  printDiagnosticsToConsole("Created tsconfig.json.");
20423
20606
  }
20424
20607
  await ensurePortalStubFiles(dir);
20425
- const jsonPath = path60.join(dir, APITOGO_JSON_FILENAME);
20608
+ const jsonPath = path61.join(dir, APITOGO_JSON_FILENAME);
20426
20609
  let createdJson = false;
20427
20610
  let config2;
20428
20611
  if (await fileExists3(jsonPath)) {
20429
20612
  config2 = await readJsonConfig(jsonPath);
20430
20613
  } else {
20431
20614
  config2 = createDefaultApitogoJsonConfig({
20432
- title: titleFromDirectoryName(path60.basename(dir)),
20615
+ title: titleFromDirectoryName(path61.basename(dir)),
20433
20616
  pagesDir
20434
20617
  });
20435
20618
  createdJson = true;
@@ -20478,8 +20661,8 @@ async function makeConfig(argv) {
20478
20661
  return;
20479
20662
  }
20480
20663
  if (action2.kind === "page") {
20481
- const pagePath = path60.join(dir, action2.page.relativePath);
20482
- await mkdir12(path60.dirname(pagePath), { recursive: true });
20664
+ const pagePath = path61.join(dir, action2.page.relativePath);
20665
+ await mkdir12(path61.dirname(pagePath), { recursive: true });
20483
20666
  await writeFile15(
20484
20667
  pagePath,
20485
20668
  buildStarterDocsPageTsx(action2.page.slug, action2.page.title),
@@ -20489,7 +20672,10 @@ async function makeConfig(argv) {
20489
20672
  return;
20490
20673
  }
20491
20674
  if (action2.kind === "plan") {
20492
- config2 = applyPlansToJsonConfig(config2, [action2.planItem]);
20675
+ const actionKeys = loadOpenApiActionKeysForSite(dir, config2);
20676
+ config2 = applyPlansToJsonConfig(config2, [
20677
+ withDefaultIncludedActionKeys(action2.planItem, actionKeys)
20678
+ ]);
20493
20679
  config2 = await persistConfig(config2, persistCtx);
20494
20680
  }
20495
20681
  }
@@ -20503,6 +20689,14 @@ async function makeConfig(argv) {
20503
20689
  if (argv.patch !== void 0) {
20504
20690
  const patch = parseJsonObjectFlag(argv.patch, "patch");
20505
20691
  if (patch) {
20692
+ const plans = patch.plans;
20693
+ if (Array.isArray(plans)) {
20694
+ const actionKeys = loadOpenApiActionKeysForSite(dir, config2);
20695
+ const keys = actionKeys.length > 0 ? actionKeys : loadOpenApiActionKeysFromSiteDirectory(dir);
20696
+ patch.plans = plans.map(
20697
+ (plan) => isPlainObject3(plan) ? withDefaultIncludedActionKeys(plan, keys) : plan
20698
+ );
20699
+ }
20506
20700
  config2 = deepMerge(config2, patch);
20507
20701
  changes.push("patch");
20508
20702
  }
@@ -20517,7 +20711,10 @@ async function makeConfig(argv) {
20517
20711
  if (argv.plan !== void 0) {
20518
20712
  const plan = parseJsonObjectFlag(argv.plan, "plan");
20519
20713
  if (plan) {
20520
- config2 = applyPlansToJsonConfig(config2, [plan]);
20714
+ const actionKeys = loadOpenApiActionKeysForSite(dir, config2);
20715
+ config2 = applyPlansToJsonConfig(config2, [
20716
+ withDefaultIncludedActionKeys(plan, actionKeys)
20717
+ ]);
20521
20718
  changes.push("plan");
20522
20719
  }
20523
20720
  }
@@ -20532,7 +20729,7 @@ async function makeConfig(argv) {
20532
20729
  if (argv.openapi) {
20533
20730
  const wire = await wireDevPortalOpenApi(
20534
20731
  dir,
20535
- path60.resolve(dir, argv.openapi)
20732
+ path61.resolve(dir, argv.openapi)
20536
20733
  );
20537
20734
  if (wire.status !== "succeeded") {
20538
20735
  throw new Error(
@@ -20561,7 +20758,7 @@ async function makeConfig(argv) {
20561
20758
  const slug = normalizePageSlug(argv.pageSlug);
20562
20759
  const pageTemplate = normalizePageTemplate(argv.pageTemplate);
20563
20760
  const relativePagePath = pageComponentRelativePath(slug);
20564
- const filePath = path60.join(dir, relativePagePath);
20761
+ const filePath = path61.join(dir, relativePagePath);
20565
20762
  const isUpdate = argv.pageUpdate === true;
20566
20763
  if (isUpdate) {
20567
20764
  if (!await fileExists3(filePath)) {
@@ -20594,7 +20791,7 @@ async function makeConfig(argv) {
20594
20791
  argv.pageContent,
20595
20792
  pageTemplate
20596
20793
  );
20597
- await mkdir12(path60.dirname(filePath), { recursive: true });
20794
+ await mkdir12(path61.dirname(filePath), { recursive: true });
20598
20795
  await writeFile15(filePath, tsx, "utf8");
20599
20796
  const configResult = await wireNewDevPortalPageInConfig(
20600
20797
  dir,
@@ -20607,7 +20804,7 @@ async function makeConfig(argv) {
20607
20804
  pagePath: relativePagePath,
20608
20805
  pageTemplate,
20609
20806
  configUpdated: configResult.updated,
20610
- configPath: configResult.configPath ? path60.relative(dir, configResult.configPath) : null
20807
+ configPath: configResult.configPath ? path61.relative(dir, configResult.configPath) : null
20611
20808
  };
20612
20809
  changes.push("page_add");
20613
20810
  }
@@ -20761,14 +20958,14 @@ var deploy_default = {
20761
20958
 
20762
20959
  // src/cli/dev/handler.ts
20763
20960
  init_joinUrl();
20764
- import path63 from "node:path";
20961
+ import path64 from "node:path";
20765
20962
 
20766
20963
  // src/vite/dev-server.ts
20767
20964
  init_logger();
20768
20965
  import fs11 from "node:fs/promises";
20769
20966
  import http from "node:http";
20770
20967
  import https from "node:https";
20771
- import path62 from "node:path";
20968
+ import path63 from "node:path";
20772
20969
  import { createHttpTerminator } from "http-terminator";
20773
20970
  import {
20774
20971
  createServer as createViteServer,
@@ -20801,7 +20998,7 @@ init_loader();
20801
20998
  // src/vite/pagefind-dev-index.ts
20802
20999
  init_invariant();
20803
21000
  init_joinUrl();
20804
- import path61 from "node:path";
21001
+ import path62 from "node:path";
20805
21002
  import { createIndex as createIndex2 } from "pagefind";
20806
21003
  import { isRunnableDevEnvironment } from "vite";
20807
21004
  async function* buildPagefindDevIndex(vite, config2) {
@@ -20854,7 +21051,7 @@ async function* buildPagefindDevIndex(vite, config2) {
20854
21051
  path: urlPath
20855
21052
  };
20856
21053
  }
20857
- const outputPath = path61.join(vite.config.publicDir, "pagefind");
21054
+ const outputPath = path62.join(vite.config.publicDir, "pagefind");
20858
21055
  await pagefindIndex.writeFiles({ outputPath });
20859
21056
  yield { type: "complete", success: true, indexed };
20860
21057
  }
@@ -20873,9 +21070,9 @@ var DevServer = class {
20873
21070
  this.protocol = "https";
20874
21071
  const { dir } = this.options;
20875
21072
  const [key, cert, ca] = await Promise.all([
20876
- fs11.readFile(path62.resolve(dir, config2.https.key)),
20877
- fs11.readFile(path62.resolve(dir, config2.https.cert)),
20878
- config2.https.ca ? fs11.readFile(path62.resolve(dir, config2.https.ca)) : void 0
21073
+ fs11.readFile(path63.resolve(dir, config2.https.key)),
21074
+ fs11.readFile(path63.resolve(dir, config2.https.cert)),
21075
+ config2.https.ca ? fs11.readFile(path63.resolve(dir, config2.https.ca)) : void 0
20879
21076
  ]);
20880
21077
  return https.createServer({ key, cert, ca });
20881
21078
  }
@@ -20892,7 +21089,7 @@ var DevServer = class {
20892
21089
  );
20893
21090
  const server = await this.createNodeServer(config2);
20894
21091
  if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
20895
- const publicRoot = path62.resolve(
21092
+ const publicRoot = path63.resolve(
20896
21093
  this.options.dir,
20897
21094
  typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
20898
21095
  );
@@ -20909,7 +21106,7 @@ var DevServer = class {
20909
21106
  // built-in transform middleware which would treat the path as a static asset.
20910
21107
  name: "apitogo:entry-client",
20911
21108
  configureServer(server2) {
20912
- const entryPath = path62.posix.join(
21109
+ const entryPath = path63.posix.join(
20913
21110
  server2.config.base,
20914
21111
  "/__z/entry.client.tsx"
20915
21112
  );
@@ -21074,7 +21271,7 @@ init_package_json();
21074
21271
  async function dev(argv) {
21075
21272
  const packageJson2 = getZudokuPackageJson();
21076
21273
  process.env.NODE_ENV = "development";
21077
- const dir = path63.resolve(process.cwd(), argv.dir);
21274
+ const dir = path64.resolve(process.cwd(), argv.dir);
21078
21275
  const server = new DevServer({
21079
21276
  dir,
21080
21277
  argPort: argv.port,
@@ -21157,11 +21354,11 @@ var dev_default = {
21157
21354
  };
21158
21355
 
21159
21356
  // src/cli/init/handler.ts
21160
- import path66 from "node:path";
21357
+ import path67 from "node:path";
21161
21358
 
21162
21359
  // src/cli/scaffold/run-scaffold-discovery.ts
21163
21360
  import { access as access10, readFile as readFile18, writeFile as writeFile17 } from "node:fs/promises";
21164
- import path65 from "node:path";
21361
+ import path66 from "node:path";
21165
21362
 
21166
21363
  // src/cli/scaffold/wire-docs.ts
21167
21364
  import {
@@ -21174,7 +21371,7 @@ import {
21174
21371
  symlink,
21175
21372
  writeFile as writeFile16
21176
21373
  } from "node:fs/promises";
21177
- import path64 from "node:path";
21374
+ import path65 from "node:path";
21178
21375
  var DOCS_DIR_WHITELIST = [
21179
21376
  "docs",
21180
21377
  "documents",
@@ -21211,14 +21408,14 @@ async function isDirectory(filePath) {
21211
21408
  }
21212
21409
  }
21213
21410
  function toPosix2(value) {
21214
- return value.split(path64.sep).join(path64.posix.sep);
21411
+ return value.split(path65.sep).join(path65.posix.sep);
21215
21412
  }
21216
21413
  function isWhitelistedDirName(name) {
21217
21414
  return DOCS_DIR_WHITELIST.includes(name.toLowerCase());
21218
21415
  }
21219
21416
  function isInside2(parent, child) {
21220
- const relative = path64.relative(parent, child);
21221
- return relative === "" || !relative.startsWith("..") && !path64.isAbsolute(relative);
21417
+ const relative = path65.relative(parent, child);
21418
+ return relative === "" || !relative.startsWith("..") && !path65.isAbsolute(relative);
21222
21419
  }
21223
21420
  async function collectMarkdownFiles(dir) {
21224
21421
  const files = [];
@@ -21232,7 +21429,7 @@ async function collectMarkdownFiles(dir) {
21232
21429
  if (entry.name.startsWith(".")) {
21233
21430
  continue;
21234
21431
  }
21235
- const full = path64.join(dir, entry.name);
21432
+ const full = path65.join(dir, entry.name);
21236
21433
  if (entry.isDirectory()) {
21237
21434
  if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink()) {
21238
21435
  continue;
@@ -21247,11 +21444,11 @@ async function collectMarkdownFiles(dir) {
21247
21444
  return files;
21248
21445
  }
21249
21446
  async function collectSearchRoots(siteDirectory) {
21250
- const site = path64.resolve(siteDirectory);
21251
- const parent = path64.dirname(site);
21447
+ const site = path65.resolve(siteDirectory);
21448
+ const parent = path65.dirname(site);
21252
21449
  const roots = [];
21253
21450
  const add = (dir) => {
21254
- const resolved = path64.resolve(dir);
21451
+ const resolved = path65.resolve(dir);
21255
21452
  if (!roots.includes(resolved)) {
21256
21453
  roots.push(resolved);
21257
21454
  }
@@ -21264,7 +21461,7 @@ async function collectSearchRoots(siteDirectory) {
21264
21461
  if (!entry.isDirectory() || SKIP_SEARCH_DIRS.has(entry.name)) {
21265
21462
  continue;
21266
21463
  }
21267
- add(path64.join(parent, entry.name));
21464
+ add(path65.join(parent, entry.name));
21268
21465
  }
21269
21466
  } catch {
21270
21467
  }
@@ -21273,13 +21470,13 @@ async function collectSearchRoots(siteDirectory) {
21273
21470
  return roots;
21274
21471
  }
21275
21472
  async function discoverNearbyDocsDirectories(siteDirectory) {
21276
- const site = path64.resolve(siteDirectory);
21277
- const sitePages = path64.join(site, PAGES_DIR);
21473
+ const site = path65.resolve(siteDirectory);
21474
+ const sitePages = path65.join(site, PAGES_DIR);
21278
21475
  const searchedDirectories = await collectSearchRoots(site);
21279
21476
  const directories = [];
21280
21477
  const seen = /* @__PURE__ */ new Set();
21281
21478
  const consider = async (dir) => {
21282
- const resolved = path64.resolve(dir);
21479
+ const resolved = path65.resolve(dir);
21283
21480
  if (resolved === site || seen.has(resolved) || isInside2(sitePages, resolved)) {
21284
21481
  return;
21285
21482
  }
@@ -21296,7 +21493,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
21296
21493
  directories.push({ sourceDirectory: resolved, files });
21297
21494
  };
21298
21495
  for (const root of searchedDirectories) {
21299
- if (isWhitelistedDirName(path64.basename(root))) {
21496
+ if (isWhitelistedDirName(path65.basename(root))) {
21300
21497
  await consider(root);
21301
21498
  }
21302
21499
  try {
@@ -21308,7 +21505,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
21308
21505
  if (!isWhitelistedDirName(entry.name)) {
21309
21506
  continue;
21310
21507
  }
21311
- await consider(path64.join(root, entry.name));
21508
+ await consider(path65.join(root, entry.name));
21312
21509
  }
21313
21510
  } catch {
21314
21511
  }
@@ -21319,8 +21516,8 @@ function slugifyDirName(name) {
21319
21516
  return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "docs";
21320
21517
  }
21321
21518
  async function allocateLinkName(pagesDir, sourceDirectory, used) {
21322
- const base = slugifyDirName(path64.basename(sourceDirectory));
21323
- const parent = slugifyDirName(path64.basename(path64.dirname(sourceDirectory)));
21519
+ const base = slugifyDirName(path65.basename(sourceDirectory));
21520
+ const parent = slugifyDirName(path65.basename(path65.dirname(sourceDirectory)));
21324
21521
  const candidates = [base, `${parent}-${base}`];
21325
21522
  let index = 2;
21326
21523
  while (true) {
@@ -21328,7 +21525,7 @@ async function allocateLinkName(pagesDir, sourceDirectory, used) {
21328
21525
  if (used.has(name)) {
21329
21526
  continue;
21330
21527
  }
21331
- const target = path64.join(pagesDir, name);
21528
+ const target = path65.join(pagesDir, name);
21332
21529
  if (await pathExists5(target)) {
21333
21530
  const stat4 = await lstat(target);
21334
21531
  if (!stat4.isDirectory() || !await isManagedLinkDir(target)) {
@@ -21359,8 +21556,8 @@ async function alreadyLinked(linkPath, sourcePath) {
21359
21556
  return false;
21360
21557
  }
21361
21558
  const current = await readlink(linkPath);
21362
- const resolved = path64.resolve(path64.dirname(linkPath), current);
21363
- return resolved === path64.resolve(sourcePath);
21559
+ const resolved = path65.resolve(path65.dirname(linkPath), current);
21560
+ return resolved === path65.resolve(sourcePath);
21364
21561
  } catch {
21365
21562
  return false;
21366
21563
  }
@@ -21372,8 +21569,8 @@ async function linkMarkdownFile(sourcePath, linkPath) {
21372
21569
  if (await pathExists5(linkPath)) {
21373
21570
  return "skipped";
21374
21571
  }
21375
- await mkdir13(path64.dirname(linkPath), { recursive: true });
21376
- const relativeTarget = path64.relative(path64.dirname(linkPath), sourcePath);
21572
+ await mkdir13(path65.dirname(linkPath), { recursive: true });
21573
+ const relativeTarget = path65.relative(path65.dirname(linkPath), sourcePath);
21377
21574
  await symlink(
21378
21575
  relativeTarget,
21379
21576
  linkPath,
@@ -21388,7 +21585,7 @@ async function applyDocsNavigation(siteDirectory, routes) {
21388
21585
  if (routes.length === 0) {
21389
21586
  return;
21390
21587
  }
21391
- const configPath = path64.join(siteDirectory, CONFIG_FILENAME);
21588
+ const configPath = path65.join(siteDirectory, CONFIG_FILENAME);
21392
21589
  if (!await pathExists5(configPath)) {
21393
21590
  return;
21394
21591
  }
@@ -21404,8 +21601,8 @@ async function applyDocsNavigation(siteDirectory, routes) {
21404
21601
  `, "utf8");
21405
21602
  }
21406
21603
  async function discoverAndWireDocs(siteDirectory) {
21407
- const site = path64.resolve(siteDirectory);
21408
- const pagesDir = path64.join(site, PAGES_DIR);
21604
+ const site = path65.resolve(siteDirectory);
21605
+ const pagesDir = path65.join(site, PAGES_DIR);
21409
21606
  const { directories, searchedDirectories } = await discoverNearbyDocsDirectories(site);
21410
21607
  if (directories.length === 0) {
21411
21608
  return {
@@ -21427,14 +21624,14 @@ async function discoverAndWireDocs(siteDirectory) {
21427
21624
  directory.sourceDirectory,
21428
21625
  usedNames
21429
21626
  );
21430
- const linkDirectory = path64.join(pagesDir, linkName);
21627
+ const linkDirectory = path65.join(pagesDir, linkName);
21431
21628
  const linked = [];
21432
21629
  const skipped = [];
21433
21630
  for (const sourcePath of directory.files) {
21434
21631
  const relativeSource = toPosix2(
21435
- path64.relative(directory.sourceDirectory, sourcePath)
21632
+ path65.relative(directory.sourceDirectory, sourcePath)
21436
21633
  );
21437
- const linkPath = path64.join(linkDirectory, relativeSource);
21634
+ const linkPath = path65.join(linkDirectory, relativeSource);
21438
21635
  const result = await linkMarkdownFile(sourcePath, linkPath);
21439
21636
  if (result === "skipped") {
21440
21637
  skipped.push({
@@ -21443,7 +21640,7 @@ async function discoverAndWireDocs(siteDirectory) {
21443
21640
  });
21444
21641
  continue;
21445
21642
  }
21446
- const relativeLink = toPosix2(path64.relative(site, linkPath));
21643
+ const relativeLink = toPosix2(path65.relative(site, linkPath));
21447
21644
  const route = toRoutePath(relativeLink, PAGES_DIR);
21448
21645
  linked.push({ sourcePath, linkPath, route, relativeSource });
21449
21646
  routes.push(route);
@@ -21476,11 +21673,11 @@ async function discoverAndWireDocs(siteDirectory) {
21476
21673
  };
21477
21674
  }
21478
21675
  function siteRelative(siteDirectory, filePath) {
21479
- const relative = toPosix2(path64.relative(siteDirectory, filePath));
21676
+ const relative = toPosix2(path65.relative(siteDirectory, filePath));
21480
21677
  if (!relative) {
21481
21678
  return ".";
21482
21679
  }
21483
- if (path64.isAbsolute(relative)) {
21680
+ if (path65.isAbsolute(relative)) {
21484
21681
  return toPosix2(filePath);
21485
21682
  }
21486
21683
  if (relative.startsWith("..")) {
@@ -21547,7 +21744,7 @@ async function pathExists6(filePath) {
21547
21744
  }
21548
21745
  async function wireOpenApiIntoJsonConfig(siteDirectory, openApiPath) {
21549
21746
  const input3 = toSiteRelativeOpenApiInput(siteDirectory, openApiPath);
21550
- const jsonConfigPath = path65.join(siteDirectory, "apitogo.config.json");
21747
+ const jsonConfigPath = path66.join(siteDirectory, "apitogo.config.json");
21551
21748
  const raw = await readFile18(jsonConfigPath, "utf8");
21552
21749
  const siteConfig = JSON.parse(raw);
21553
21750
  const updated = applyOpenApiToSiteConfig(siteConfig, {
@@ -21599,7 +21796,7 @@ async function discoverAndWireOpenApiLite(siteDirectory, mode) {
21599
21796
  wired: false
21600
21797
  };
21601
21798
  }
21602
- const jsonConfigPath = path65.join(siteDirectory, "apitogo.config.json");
21799
+ const jsonConfigPath = path66.join(siteDirectory, "apitogo.config.json");
21603
21800
  if (!await pathExists6(jsonConfigPath)) {
21604
21801
  return {
21605
21802
  openApiDiscovery: {
@@ -21660,8 +21857,8 @@ function slugifyName2(name) {
21660
21857
  return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "dev-portal-site";
21661
21858
  }
21662
21859
  function resolveInitOutputDirectory(dirArg, name) {
21663
- const resolved = path66.resolve(process.cwd(), dirArg);
21664
- const base = path66.basename(resolved);
21860
+ const resolved = path67.resolve(process.cwd(), dirArg);
21861
+ const base = path67.basename(resolved);
21665
21862
  const isDot = dirArg === "." || dirArg === "./" || base === "." || resolved === process.cwd();
21666
21863
  if (isDot) {
21667
21864
  const fromName = name?.trim();
@@ -21671,7 +21868,7 @@ function resolveInitOutputDirectory(dirArg, name) {
21671
21868
  );
21672
21869
  }
21673
21870
  return {
21674
- outputDirectory: path66.resolve(process.cwd(), slugifyName2(fromName)),
21871
+ outputDirectory: path67.resolve(process.cwd(), slugifyName2(fromName)),
21675
21872
  siteName: fromName
21676
21873
  };
21677
21874
  }
@@ -21915,9 +22112,9 @@ var remove_default = {
21915
22112
  };
21916
22113
 
21917
22114
  // src/cli/status/handler.ts
21918
- import path67 from "node:path";
22115
+ import path68 from "node:path";
21919
22116
  async function status(argv) {
21920
- const sourceDirectory = path67.resolve(process.cwd(), argv.dir);
22117
+ const sourceDirectory = path68.resolve(process.cwd(), argv.dir);
21921
22118
  const config2 = loadConfig();
21922
22119
  const client = new PlatformApiClient(config2);
21923
22120
  let whoamiJson;
@@ -21997,7 +22194,7 @@ var status_default = {
21997
22194
  };
21998
22195
 
21999
22196
  // src/cli/teardown/handler.ts
22000
- import path68 from "node:path";
22197
+ import path69 from "node:path";
22001
22198
  function resultLooksFailed3(payload) {
22002
22199
  try {
22003
22200
  const parsed = JSON.parse(payload);
@@ -22013,7 +22210,7 @@ async function teardown(argv) {
22013
22210
  );
22014
22211
  return;
22015
22212
  }
22016
- const sourceDirectory = path68.resolve(process.cwd(), argv.dir);
22213
+ const sourceDirectory = path69.resolve(process.cwd(), argv.dir);
22017
22214
  const config2 = loadConfig();
22018
22215
  const client = new PlatformApiClient(config2);
22019
22216
  let projectId = argv.projectId?.trim();
@@ -22078,7 +22275,7 @@ var teardown_default = {
22078
22275
  };
22079
22276
 
22080
22277
  // src/cli/common/outdated.ts
22081
- import { existsSync as existsSync4, mkdirSync } from "node:fs";
22278
+ import { existsSync as existsSync5, mkdirSync } from "node:fs";
22082
22279
  import { readFile as readFile19, writeFile as writeFile18 } from "node:fs/promises";
22083
22280
  import { join } from "node:path";
22084
22281
  import colors10 from "picocolors";
@@ -22146,12 +22343,12 @@ function box(message, {
22146
22343
 
22147
22344
  // src/cli/common/xdg/lib.ts
22148
22345
  import { homedir } from "node:os";
22149
- import path69 from "node:path";
22346
+ import path70 from "node:path";
22150
22347
  function defineDirectoryWithFallback(xdgName, fallback) {
22151
22348
  if (process.env[xdgName]) {
22152
22349
  return process.env[xdgName];
22153
22350
  } else {
22154
- return path69.join(homedir(), fallback);
22351
+ return path70.join(homedir(), fallback);
22155
22352
  }
22156
22353
  }
22157
22354
  var XDG_CONFIG_HOME = defineDirectoryWithFallback(
@@ -22166,15 +22363,15 @@ var XDG_STATE_HOME = defineDirectoryWithFallback(
22166
22363
  "XDG_DATA_HOME",
22167
22364
  ".local/state"
22168
22365
  );
22169
- var ZUDOKU_XDG_CONFIG_HOME = path69.join(
22366
+ var ZUDOKU_XDG_CONFIG_HOME = path70.join(
22170
22367
  XDG_CONFIG_HOME,
22171
22368
  CLI_XDG_FOLDER_NAME
22172
22369
  );
22173
- var ZUDOKU_XDG_DATA_HOME = path69.join(
22370
+ var ZUDOKU_XDG_DATA_HOME = path70.join(
22174
22371
  XDG_DATA_HOME,
22175
22372
  CLI_XDG_FOLDER_NAME
22176
22373
  );
22177
- var ZUDOKU_XDG_STATE_HOME = path69.join(
22374
+ var ZUDOKU_XDG_STATE_HOME = path70.join(
22178
22375
  XDG_STATE_HOME,
22179
22376
  CLI_XDG_FOLDER_NAME
22180
22377
  );
@@ -22219,12 +22416,12 @@ async function getLatestVersion() {
22219
22416
  return void 0;
22220
22417
  }
22221
22418
  async function getVersionCheckInfo() {
22222
- if (!existsSync4(ZUDOKU_XDG_STATE_HOME)) {
22419
+ if (!existsSync5(ZUDOKU_XDG_STATE_HOME)) {
22223
22420
  mkdirSync(ZUDOKU_XDG_STATE_HOME, { recursive: true });
22224
22421
  }
22225
22422
  const versionCheckPath = join(ZUDOKU_XDG_STATE_HOME, VERSION_CHECK_FILE);
22226
22423
  let versionCheckInfo;
22227
- if (existsSync4(versionCheckPath)) {
22424
+ if (existsSync5(versionCheckPath)) {
22228
22425
  try {
22229
22426
  versionCheckInfo = await readFile19(versionCheckPath, "utf-8").then(
22230
22427
  JSON.parse
@@ -28,9 +28,13 @@ export interface ApplyPublicRoutesResult {
28
28
  export declare function applyGatewayPublicRoutes(client: PlatformApiClient, projectId: string, routes: string[], options?: {
29
29
  knownActions?: GatewayActionDto[];
30
30
  }): Promise<ApplyPublicRoutesResult>;
31
+ export declare function listAllGatewayActions(client: PlatformApiClient, projectId: string, pageSize?: number): Promise<GatewayActionDto[]>;
31
32
  export declare function handleListGatewayPlans(client: PlatformApiClient, config: ApitogoConfig, args: {
32
33
  projectId?: string;
33
34
  }): Promise<string>;
35
+ export declare function resolveIncludedActionKeysForCreate(client: PlatformApiClient, projectId: string, includedActionKeys: string[] | undefined, options?: {
36
+ skipDefaultActions?: boolean;
37
+ }): Promise<string[]>;
34
38
  export declare function handleCreateGatewayPlan(client: PlatformApiClient, config: ApitogoConfig, args: {
35
39
  projectId?: string;
36
40
  sku: string;
@@ -41,6 +45,7 @@ export declare function handleCreateGatewayPlan(client: PlatformApiClient, confi
41
45
  priceCurrency?: string;
42
46
  billingPeriod?: string;
43
47
  sortOrder?: number;
48
+ skipDefaultActions?: boolean;
44
49
  }): Promise<string>;
45
50
  export declare function handleGetGatewayPlan(client: PlatformApiClient, config: ApitogoConfig, args: {
46
51
  projectId?: string;
@@ -82,7 +82,8 @@ load.
82
82
  - **rateLimit** — maximum calls per renewal window (per minute when `renewalPeriodSeconds` is 60).
83
83
  - **quota** — longer-window cap (per 30 days when `renewalPeriodDays` is 30).
84
84
 
85
- After OpenAPI is deployed, you can scope plans to specific API operations with
85
+ New plans include **all** discovered OpenAPI operations unless you set `includedActionKeys`.
86
+ After OpenAPI is deployed, you can scope a plan to specific operations with
86
87
  `includedActionKeys` (for example `get:/orders/{id}`). Edit those fields in
87
88
  `apitogo.config.json` — see [Manifest](./manifest.md).
88
89
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukoweb/apitogo",
3
- "version": "0.1.98",
3
+ "version": "0.1.100",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "**/*.css",