@rex0220/kintone-sql-tools 3.73.0 → 3.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-cli/ksql.js CHANGED
@@ -18837,6 +18837,7 @@ async function executeParsedStatement(stmt, client, options, cacheContext) {
18837
18837
  options.recursiveCteMaxDepth,
18838
18838
  options.recursiveCteMaxRows,
18839
18839
  options.recursiveCteMaxExpansions,
18840
+ options.resolveMetadata !== false,
18840
18841
  hasNativeUpsertExecutionOption(options) ? {
18841
18842
  surface: "CLI",
18842
18843
  enableNativeUpsert: nativeUpsertExecutionEnabled(options),
@@ -26784,6 +26785,10 @@ async function buildExplainWhereAnalysis(query, client, cacheContext, maxRecords
26784
26785
  return;
26785
26786
  }
26786
26787
  const typed = node;
26788
+ if (typed["type"] === "UPSERT" || typed["type"] === "UPSERT_SELECT") {
26789
+ const upsert = node;
26790
+ await getFieldsCached(upsert.appId, tracedClient, cacheContext);
26791
+ }
26787
26792
  if (typed["type"] === "SELECT") {
26788
26793
  const select = node;
26789
26794
  await validateSelectGroupingPlanning(select, tracedClient, cacheContext);
@@ -27827,21 +27832,29 @@ var explainMaterializedTables = /* @__PURE__ */ new WeakMap();
27827
27832
  function defaultRecursiveExplainContext() {
27828
27833
  return { maxRecords: 1e4, recursiveLimits: resolveRecursiveCteLimits({}) };
27829
27834
  }
27830
- async function executeExplain(stmt, client, cacheContext, maxRecords, cursorMaxActive, dmlMaxRows = 100, dmlMaxSubtableRows = DEFAULT_APPLY_MAX_SUBTABLE_ROWS, relativeDatePlan, recursiveCteMaxDepth, recursiveCteMaxRows, recursiveCteMaxExpansions, nativeUpsertOptions = { surface: "DOCUMENT_ONLY" }) {
27835
+ async function executeExplain(stmt, client, cacheContext, maxRecords, cursorMaxActive, dmlMaxRows = 100, dmlMaxSubtableRows = DEFAULT_APPLY_MAX_SUBTABLE_ROWS, relativeDatePlan, recursiveCteMaxDepth, recursiveCteMaxRows, recursiveCteMaxExpansions, resolveMetadata = true, nativeUpsertOptions = { surface: "DOCUMENT_ONLY" }) {
27831
27836
  const recursiveLimits = resolveRecursiveCteLimits({
27832
27837
  recursiveCteMaxDepth,
27833
27838
  recursiveCteMaxRows,
27834
27839
  recursiveCteMaxExpansions
27835
27840
  });
27836
27841
  const sharedPlan = relativeDatePlan ?? await resolveRelativeDateExecutionPlan(stmt.query, client, cacheContext);
27837
- const analysis = await buildExplainWhereAnalysis(
27842
+ const analysis = resolveMetadata ? await buildExplainWhereAnalysis(
27838
27843
  stmt.query,
27839
27844
  client,
27840
27845
  cacheContext,
27841
27846
  maxRecords,
27842
27847
  sharedPlan,
27843
27848
  explainMaterializedTables.get(stmt)
27844
- );
27849
+ ) : {
27850
+ capabilities: /* @__PURE__ */ new Map(),
27851
+ orderPlans: /* @__PURE__ */ new Map(),
27852
+ plainGroupByPlans: /* @__PURE__ */ new Map(),
27853
+ fieldApps: /* @__PURE__ */ new Set(),
27854
+ processStatusApps: /* @__PURE__ */ new Set(),
27855
+ numberPrecisionApps: /* @__PURE__ */ new Set(),
27856
+ relativeDatePlan: sharedPlan
27857
+ };
27845
27858
  const fetchCollector = { sources: [] };
27846
27859
  const relativeLines = relativeDateExplainLines(sharedPlan);
27847
27860
  const planLines = sharedPlan.hasServerOnlyWhereFunction && !sharedPlan.allowed ? [...explainMetadataLines(analysis), ...relativeLines] : [
@@ -32626,7 +32639,8 @@ async function run() {
32626
32639
  appProfileByApp.set(appId, appBindingByMappedApp.get(appId)?.profile ?? profileName.toLowerCase());
32627
32640
  }
32628
32641
  const cacheContext = buildCacheContext(profileName, appBindingByMappedApp);
32629
- if (args.dryRun && (!dryRunNeedsMetadata || dryRunUsesStaticTypedPlan)) {
32642
+ const fullyOfflineDryRun = args.dryRun && (!dryRunNeedsMetadata || dryRunUsesStaticTypedPlan);
32643
+ if (fullyOfflineDryRun) {
32630
32644
  client = createDryRunClient();
32631
32645
  } else {
32632
32646
  for (const explicitProfile of appProfileByApp.values()) {
@@ -32894,7 +32908,7 @@ async function run() {
32894
32908
  Object.keys(args.importCsv).length > 0 || Object.keys(args.importJson).length > 0,
32895
32909
  dmlMaxRows,
32896
32910
  dmlMaxSubtableRows,
32897
- !dryRunUsesStaticTypedPlan,
32911
+ !fullyOfflineDryRun,
32898
32912
  recursiveCteMaxDepth,
32899
32913
  recursiveCteMaxRows,
32900
32914
  recursiveCteMaxExpansions,
@@ -33051,7 +33065,8 @@ query=${label}`);
33051
33065
  dmlMaxSubtableRows,
33052
33066
  recursiveCteMaxDepth,
33053
33067
  recursiveCteMaxRows,
33054
- recursiveCteMaxExpansions
33068
+ recursiveCteMaxExpansions,
33069
+ resolveMetadata: !fullyOfflineDryRun
33055
33070
  }, args.nativeUpsert, true)) : await execute(sql, client, withNativeUpsertExecutionOption({
33056
33071
  maxRecords,
33057
33072
  fetchParallel,