-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Description
```****Conditional routing rule (concise) **Conditional routing rule (concise)**
If **card.type ≠ "APPLE_CARD"** → **route to alternate action** and **write record to `info.cc`** (simulation).
---
## Logic
- Detect card type.
- Apple Card → Apple-style mock path.
- Non-Apple Card → fallback handler.
- Persist outcome to `info.cc`.
---
## Node.js implementation (mock)
```js
// SPDX-License-Identifier: Apache-2.0
import fs from "fs";
export function routeCard(card) {
const result = {
card_id: card.id,
type: card.type || "GENERIC",
action: "",
timestamp: new Date().toISOString(),
mode: "```
```"
};
if (card.type === "APPLE_CARD") {
result.action = "APPLE_MOCK_FLOW";
} else {
result.action = "ALT_FLOW_NON_APPLE";
fs.appendFileSync(
"info.cc",
JSON.stringify(result) + "\n"
);
}
return result;
}
Usage
import { genCard } from "./cardGen.js";
import { routeCard } from "./router.js";
const card = genCard("Adam Kirchhofer::ASSET-001");
card.type = "VIRTUAL"; // not Apple Card
const outcome = routeCard(card);
console.log(outcome);Output (info.cc)
{"card_id":"a1b2c3...","type":"VIRTUAL","action":"ALT_FLOW_NON_APPLE","timestamp":"...","mode":"simulation"}
Result
- Apple Card → mock Apple path
- Non-Apple Card → alternate action + audit write
- Deterministic, local, CI-safe
Metadata
Metadata
Assignees
Labels
No labels