@octaviaflow/flow-rules 0.11.0 → 0.11.1

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/index.cjs CHANGED
@@ -88,6 +88,7 @@ __export(exports_src, {
88
88
  NodeStatus: () => NodeStatus,
89
89
  ONEDRIVE_OPERATIONS: () => ONEDRIVE_OPERATIONS,
90
90
  OneDriveActionConfig: () => OneDriveActionConfig,
91
+ PLATFORM_CONFIG_KEYS: () => PLATFORM_CONFIG_KEYS,
91
92
  QueryMode: () => QueryMode,
92
93
  QueryType: () => QueryType,
93
94
  S3ActionConfig: () => S3ActionConfig,
@@ -5664,6 +5665,10 @@ function contractDerivedKeys(definition) {
5664
5665
  var MAX_STEP_CONFIG_BYTES = 256 * 1024;
5665
5666
  var FORBIDDEN_KEYS = new Set(["__proto__", "constructor", "prototype"]);
5666
5667
  var MAX_DEPTH = 12;
5668
+ var PLATFORM_CONFIG_KEYS = {
5669
+ flowId: { key: "flowId", label: "Flow", type: "string" /* String */, validation: { required: false } },
5670
+ outputAs: { key: "outputAs", label: "Output as", type: "string" /* String */, validation: { required: false } }
5671
+ };
5667
5672
  function typeMatches(field, value) {
5668
5673
  if (value === null || value === undefined || value === "")
5669
5674
  return true;
@@ -5771,8 +5776,10 @@ function validateStepConfig(step) {
5771
5776
  const declared = new Map(contractFieldsFor(definition).map((f) => [f.key, f]));
5772
5777
  const entries = Object.entries(config);
5773
5778
  for (const [key, value] of entries) {
5774
- const field = declared.get(key);
5779
+ const field = declared.get(key) ?? PLATFORM_CONFIG_KEYS[key];
5775
5780
  if (!field) {
5781
+ if (isEditorPrivateKey(key))
5782
+ continue;
5776
5783
  issues.push({
5777
5784
  severity: "warning",
5778
5785
  code: "UNDECLARED_FIELD",
package/dist/index.d.ts CHANGED
@@ -60,6 +60,6 @@ export { CONNECTOR_EVENT_ENTITIES, EVENT_CAPABLE_CONNECTOR_IDS, getEntitiesForCo
60
60
  export * from "./catalog/workflow";
61
61
  export { type FlowConnection, type FlowData, type FlowStep, generateConnectionsFromSteps, transformConnectionToEdge, transformFlowToWorkflow, transformStepToNode, validateFlowData, } from "./rules/flowShape";
62
62
  export { flattenNestedWorkflow } from "./rules/flattenNestedWorkflow";
63
- export { configErrors, MAX_STEP_CONFIG_BYTES, validateStepConfig, validateStepConfigs, type ConfigIssue, type ConfigIssueCode, } from "./rules/configSafety";
63
+ export { configErrors, MAX_STEP_CONFIG_BYTES, validateStepConfig, PLATFORM_CONFIG_KEYS, validateStepConfigs, type ConfigIssue, type ConfigIssueCode, } from "./rules/configSafety";
64
64
  export { isMappingFunction, MAPPING_FUNCTION_SPECS, MAPPING_FUNCTIONS, mappingTransformFunctionName, USER_FUNCTION_PREFIX, type MappingFunction, type MappingFunctionSpec, } from "./rules/mappingFunctions";
65
65
  export { CONFIG_CONTRACTS, contractDerivedKeys, contractDrift, contractFieldsFor, contractVocabularyDrift, contractFor, declaredKeys, isEditorPrivateKey, type ConfigContract, type ContractField, type ContractFieldType, } from "./rules/configContracts";
package/dist/index.js CHANGED
@@ -5510,6 +5510,10 @@ function contractDerivedKeys(definition) {
5510
5510
  var MAX_STEP_CONFIG_BYTES = 256 * 1024;
5511
5511
  var FORBIDDEN_KEYS = new Set(["__proto__", "constructor", "prototype"]);
5512
5512
  var MAX_DEPTH = 12;
5513
+ var PLATFORM_CONFIG_KEYS = {
5514
+ flowId: { key: "flowId", label: "Flow", type: "string" /* String */, validation: { required: false } },
5515
+ outputAs: { key: "outputAs", label: "Output as", type: "string" /* String */, validation: { required: false } }
5516
+ };
5513
5517
  function typeMatches(field, value) {
5514
5518
  if (value === null || value === undefined || value === "")
5515
5519
  return true;
@@ -5617,8 +5621,10 @@ function validateStepConfig(step) {
5617
5621
  const declared = new Map(contractFieldsFor(definition).map((f) => [f.key, f]));
5618
5622
  const entries = Object.entries(config);
5619
5623
  for (const [key, value] of entries) {
5620
- const field = declared.get(key);
5624
+ const field = declared.get(key) ?? PLATFORM_CONFIG_KEYS[key];
5621
5625
  if (!field) {
5626
+ if (isEditorPrivateKey(key))
5627
+ continue;
5622
5628
  issues.push({
5623
5629
  severity: "warning",
5624
5630
  code: "UNDECLARED_FIELD",
@@ -5793,6 +5799,7 @@ export {
5793
5799
  NodeStatus,
5794
5800
  ONEDRIVE_OPERATIONS,
5795
5801
  OneDriveActionConfig,
5802
+ PLATFORM_CONFIG_KEYS,
5796
5803
  QueryMode,
5797
5804
  QueryType,
5798
5805
  S3ActionConfig,
@@ -33,8 +33,26 @@
33
33
  * An enumerated field's options are checked but only WARN, for the same
34
34
  * reason — see the note at that check.
35
35
  */
36
+ import { type FieldConfig } from "../catalog/types";
36
37
  /** Largest config a single step may carry, serialised. */
37
38
  export declare const MAX_STEP_CONFIG_BYTES: number;
39
+ /**
40
+ * Keys that belong to the PLATFORM, not to any action — on nearly every step,
41
+ * declared by no contract, and rightly so:
42
+ *
43
+ * - `flowId`: NodeConfigPanel seeds every custom panel's config with the flow
44
+ * it belongs to, and it is saved with the step;
45
+ * - `outputAs`: the Engine reads it for EVERY step type — the step's key in
46
+ * the run's data bag.
47
+ *
48
+ * Type-checked like a declared field; never reported as undeclared; never
49
+ * advertised by `contractFieldsFor` (an agent is told the action's own keys).
50
+ * Before this, every panel-built step raised one to four UNDECLARED_FIELD
51
+ * warnings for these and the editor's own `_` snapshots, which drowned the
52
+ * warnings that mean something — `connection` on a storage step, `message` on
53
+ * a Slack step (DEV-412).
54
+ */
55
+ export declare const PLATFORM_CONFIG_KEYS: Readonly<Record<string, FieldConfig>>;
38
56
  export type ConfigIssueCode = "FORBIDDEN_KEY" | "CONFIG_TOO_LARGE" | "CONFIG_TOO_DEEP" | "FIELD_WRONG_TYPE" | "FIELD_BAD_OPTION" | "UNDECLARED_FIELD";
39
57
  export interface ConfigIssue {
40
58
  severity: "error" | "warning";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octaviaflow/flow-rules",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "The flow action catalog and the rules engine behind Flow Doctor — one definition of what a step accepts and what makes a flow valid, shared by the editor and the server",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",