@cadraos/sdk 0.3.14-p46.3 → 0.3.14

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.
Files changed (52) hide show
  1. package/README.md +104 -53
  2. package/dist/ai-functions/react/index.cjs +176 -0
  3. package/dist/ai-functions/react/index.cjs.map +1 -0
  4. package/dist/ai-functions/react/index.d.cts +129 -0
  5. package/dist/ai-functions/react/index.d.ts +129 -0
  6. package/dist/ai-functions/react/index.js +153 -0
  7. package/dist/ai-functions/react/index.js.map +1 -0
  8. package/dist/ai-functions/server/index.cjs +296 -0
  9. package/dist/ai-functions/server/index.cjs.map +1 -0
  10. package/dist/ai-functions/server/index.d.cts +334 -0
  11. package/dist/ai-functions/server/index.d.ts +334 -0
  12. package/dist/ai-functions/server/index.js +284 -0
  13. package/dist/ai-functions/server/index.js.map +1 -0
  14. package/dist/board-host/index.cjs +217 -129
  15. package/dist/board-host/index.cjs.map +1 -1
  16. package/dist/board-host/index.d.cts +96 -1
  17. package/dist/board-host/index.d.ts +96 -1
  18. package/dist/board-host/index.js +218 -131
  19. package/dist/board-host/index.js.map +1 -1
  20. package/dist/board-host/server/index.d.cts +44 -0
  21. package/dist/board-host/server/index.d.ts +44 -0
  22. package/dist/chat/index.cjs +299 -17
  23. package/dist/chat/index.cjs.map +1 -1
  24. package/dist/chat/index.d.cts +225 -0
  25. package/dist/chat/index.d.ts +225 -0
  26. package/dist/chat/index.js +299 -17
  27. package/dist/chat/index.js.map +1 -1
  28. package/dist/index.cjs +221 -3
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +286 -1
  31. package/dist/index.d.ts +286 -1
  32. package/dist/index.js +215 -4
  33. package/dist/index.js.map +1 -1
  34. package/dist/kanban/engine/index.cjs +774 -683
  35. package/dist/kanban/engine/index.cjs.map +1 -1
  36. package/dist/kanban/engine/index.d.cts +90 -1
  37. package/dist/kanban/engine/index.d.ts +90 -1
  38. package/dist/kanban/engine/index.js +774 -684
  39. package/dist/kanban/engine/index.js.map +1 -1
  40. package/dist/kanban/index.cjs +214 -3
  41. package/dist/kanban/index.cjs.map +1 -1
  42. package/dist/kanban/index.d.cts +252 -0
  43. package/dist/kanban/index.d.ts +252 -0
  44. package/dist/kanban/index.js +214 -3
  45. package/dist/kanban/index.js.map +1 -1
  46. package/dist/teams/index.cjs +214 -3
  47. package/dist/teams/index.cjs.map +1 -1
  48. package/dist/teams/index.d.cts +225 -0
  49. package/dist/teams/index.d.ts +225 -0
  50. package/dist/teams/index.js +214 -3
  51. package/dist/teams/index.js.map +1 -1
  52. package/package.json +21 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/ai-functions/server/slots.ts","../../../src/ai-functions/server/classify.ts"],"names":[],"mappings":";AAwBO,IAAM,mBAAA,GAAN,cAAkC,KAAA,CAAM;AAAA,EACpC,IAAA;AAAA,EACA,OAAA;AAAA,EACT,WAAA,CAAY,IAAA,EAAc,OAAA,EAAiB,OAAA,EAAiB;AAC1D,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,qBAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AAAA,EACjB;AACF;AAGO,IAAM,wBAAA,GAAN,cAAuC,mBAAA,CAAoB;AAAA,EAChE,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,YAAA,EAAc,OAAA,EAAS,CAAA,kBAAA,EAAqB,OAAO,CAAA,6BAAA,CAA+B,CAAA;AACxF,IAAA,IAAA,CAAK,IAAA,GAAO,0BAAA;AAAA,EACd;AACF;AAGO,IAAM,0BAAA,GAAN,cAAyC,mBAAA,CAAoB;AAAA,EAClE,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,cAAA,EAAgB,OAAA,EAAS,CAAA,0BAAA,EAA6B,OAAO,CAAA,EAAA,CAAI,CAAA;AACvE,IAAA,IAAA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,IAAA,EAAM,cAAA,EAAgB,GAAG,IAAA,EAAM,GAAI,iBAAA,KAAsB,MAAA,GAAY,EAAE,iBAAA,EAAkB,GAAI,EAAC,EAAG;AAAA,EAC5G;AACA,EAAA,IAAI,MAAA,KAAW,OAAO,IAAA,KAAS,qBAAA,SAA8B,EAAE,IAAA,EAAM,cAAA,EAAgB,GAAG,IAAA,EAAK;AAC7F,EAAA,IAAI,MAAA,KAAW,OAAO,IAAA,KAAS,oBAAA,SAA6B,EAAE,IAAA,EAAM,WAAA,EAAa,GAAG,IAAA,EAAK;AACzF,EAAA,IAAI,MAAA,KAAW,OAAO,IAAA,KAAS,eAAA,SAAwB,EAAE,IAAA,EAAM,WAAA,EAAa,GAAG,IAAA,EAAK;AACpF,EAAA,IAAI,SAAS,cAAA,IAAkB,IAAA,KAAS,gBAAgB,MAAA,KAAW,GAAA,IAAO,eAAe,SAAA,EAAW;AAClG,IAAA,OAAO,EAAE,IAAA,EAAM,SAAA,EAAW,GAAG,IAAA,EAAK;AAAA,EACpC;AACA,EAAA,IACE,SAAS,cAAA,IACT,MAAA,KAAW,KACV,MAAA,KAAW,MAAA,IAAa,SAAS,WAAA,EAClC;AACA,IAAA,OAAO,EAAE,IAAA,EAAM,SAAA,EAAW,GAAG,IAAA,EAAK;AAAA,EACpC;AACA,EAAA,OAAO,EAAE,IAAA,EAAM,UAAA,EAAY,GAAG,IAAA,EAAK;AACrC","file":"index.js","sourcesContent":["/**\n * Slot catalog, resolver, compatibility and handlers (p93 AIF-017, specs D28).\n *\n * Port of Yobo's app-local `lib/cadra/function-config.ts` semantics (60 s\n * process-local Map cache, cleared on write) MINUS the env fallback: an unset\n * slot is unavailable, never silently served from `process.env`.\n */\n\nimport type { AiFunctionDescriptor, AiFunctionRunResult, AiFunctionRunShorthandOptions, AiFunctionVariables } from '../../types/ai-functions.js';\nimport type {\n AiFunctionSetSlotResult,\n AiFunctionSlot,\n AiFunctionSlotBinding,\n AiFunctionSlotCompatIssue,\n AiFunctionSlotCompatVerdict,\n AiFunctionSlotOption,\n AiFunctionSlotRow,\n AiFunctionSlotStore,\n AiFunctionsClientLike,\n} from './types.js';\n\n// ── errors ──────────────────────────────────────────────────────────────────\n\n/** Base class for slot-module errors. `code` is stable; branch on it, not `instanceof`. */\nexport class AiFunctionSlotError extends Error {\n readonly code: string;\n readonly slotKey: string;\n constructor(code: string, slotKey: string, message: string) {\n super(message);\n this.name = 'AiFunctionSlotError';\n this.code = code;\n this.slotKey = slotKey;\n }\n}\n\n/** `runSlot` on a slot with no binding. No request was sent. */\nexport class AiFunctionSlotUnsetError extends AiFunctionSlotError {\n constructor(slotKey: string) {\n super('slot_unset', slotKey, `AI function slot \"${slotKey}\" is not bound to a function.`);\n this.name = 'AiFunctionSlotUnsetError';\n }\n}\n\n/** A key that is not in the declared catalog. */\nexport class AiFunctionUnknownSlotError extends AiFunctionSlotError {\n constructor(slotKey: string) {\n super('unknown_slot', slotKey, `Unknown AI function slot \"${slotKey}\".`);\n this.name = 'AiFunctionUnknownSlotError';\n }\n}\n\n/** `setSlot` refused: the function's live version does not fit the slot. */\nexport class AiFunctionSlotIncompatibleError extends AiFunctionSlotError {\n readonly functionKey: string;\n readonly issues: AiFunctionSlotCompatIssue[];\n constructor(slotKey: string, functionKey: string, issues: AiFunctionSlotCompatIssue[]) {\n super(\n 'binding_incompatible',\n slotKey,\n `\"${functionKey}\" does not fit slot \"${slotKey}\": ` + issues.map((i) => i.message).join('; ')\n );\n this.name = 'AiFunctionSlotIncompatibleError';\n this.functionKey = functionKey;\n this.issues = issues;\n }\n}\n\n// ── catalog ─────────────────────────────────────────────────────────────────\n\nconst SLOT_KEY_RE = /^[a-z][a-z0-9_]{1,63}$/;\n\n/**\n * Declare the host app's slots. Validates keys (lower_snake, unique) and\n * parameter names, and returns the same array (frozen) so literal key types\n * survive: `runSlot(deps, 'campaign_subject', …)`.\n */\nexport function defineAiFunctionSlots<const T extends readonly AiFunctionSlot[]>(slots: T): T {\n const seen = new Set<string>();\n for (const slot of slots) {\n if (!SLOT_KEY_RE.test(slot.key)) {\n throw new Error(`Invalid AI function slot key \"${slot.key}\" (use lower_snake_case, 2–64 chars).`);\n }\n if (seen.has(slot.key)) throw new Error(`Duplicate AI function slot key \"${slot.key}\".`);\n seen.add(slot.key);\n const names = new Set<string>();\n for (const p of slot.parameters) {\n if (!p.name || names.has(p.name)) {\n throw new Error(`Slot \"${slot.key}\": parameter names must be non-empty and unique (\"${p.name}\").`);\n }\n names.add(p.name);\n if (p.type === 'enum' && (!p.options || p.options.length === 0)) {\n throw new Error(`Slot \"${slot.key}\": enum parameter \"${p.name}\" needs options.`);\n }\n }\n }\n return Object.freeze(slots) as T;\n}\n\n// ── resolver ────────────────────────────────────────────────────────────────\n\n/** Parse a stored value into a binding; anything else is \"unset\". */\nexport function parseAiFunctionSlotBinding(raw: unknown): AiFunctionSlotBinding | null {\n let value = raw;\n if (typeof value === 'string') {\n const t = value.trim();\n if (!t.startsWith('{')) return null;\n try {\n value = JSON.parse(t);\n } catch {\n return null;\n }\n }\n if (value && typeof value === 'object') {\n const fk = (value as { functionKey?: unknown }).functionKey;\n if (typeof fk === 'string' && fk.trim()) return { functionKey: fk.trim() };\n }\n return null;\n}\n\nexport interface AiFunctionSlotResolver {\n /** The binding for `key` (cached for `ttlMs`, including \"unset\"). */\n get(key: string): Promise<AiFunctionSlotBinding | null>;\n /** Store a binding and clear that key's cache. */\n set(key: string, binding: AiFunctionSlotBinding): Promise<void>;\n /** Remove a binding and clear that key's cache. */\n delete(key: string): Promise<void>;\n /** Every stored binding, read fresh from the store (admin view). */\n list(): Promise<Map<string, AiFunctionSlotBinding>>;\n /** Drop one key's cache entry, or all. */\n clearCache(key?: string): void;\n}\n\nexport interface CreateAiFunctionSlotResolverOptions {\n store: AiFunctionSlotStore;\n /** Cache TTL in ms (default 60 000). The cache is per process. */\n ttlMs?: number;\n}\n\n/**\n * Resolve slot → binding with a process-local TTL cache. Writes through this\n * resolver clear the cache so the writing process live-swaps; other processes\n * pick the change up within `ttlMs`.\n */\nexport function createAiFunctionSlotResolver(\n options: CreateAiFunctionSlotResolverOptions\n): AiFunctionSlotResolver {\n const { store } = options;\n const ttlMs = options.ttlMs ?? 60_000;\n const cache = new Map<string, { value: AiFunctionSlotBinding | null; expiresAt: number }>();\n\n return {\n async get(key) {\n const now = Date.now();\n const hit = cache.get(key);\n if (hit && hit.expiresAt > now) return hit.value;\n const value = parseAiFunctionSlotBinding(await store.get(key));\n cache.set(key, { value, expiresAt: now + ttlMs });\n return value;\n },\n async set(key, binding) {\n await store.set(key, { functionKey: binding.functionKey });\n cache.delete(key);\n },\n async delete(key) {\n await store.delete(key);\n cache.delete(key);\n },\n async list() {\n const rows = await store.list();\n const out = new Map<string, AiFunctionSlotBinding>();\n for (const row of rows) {\n const b = parseAiFunctionSlotBinding(row.value);\n if (b) out.set(row.key, b);\n }\n return out;\n },\n clearCache(key) {\n if (key) cache.delete(key);\n else cache.clear();\n },\n };\n}\n\n// ── compatibility (D16 rule on a D27 descriptor) ────────────────────────────\n\n/** Server default maxLength per type when the version sets none (D10). */\nconst DEFAULT_MAX_LENGTH: Partial<Record<string, number>> = { string: 2000, text: 24000 };\n\n/**\n * Does `descriptor` (a function's live version) fit `slot`? Passes iff: same\n * output kind; every slot parameter exists with the same type (`string` ≠\n * `text`); every REQUIRED function parameter is declared by the slot as\n * required; enum options ⊇ the slot's; string/text effective maxLength ≥ the\n * slot's.\n */\nexport function checkAiFunctionSlotCompatibility(\n slot: Pick<AiFunctionSlot, 'outputKind' | 'parameters'>,\n descriptor: Pick<AiFunctionDescriptor, 'outputKind' | 'parameters'>\n): AiFunctionSlotCompatVerdict {\n const issues: AiFunctionSlotCompatIssue[] = [];\n\n if (descriptor.outputKind !== slot.outputKind) {\n issues.push({\n code: 'output_kind',\n message: `returns ${descriptor.outputKind}, the slot expects ${slot.outputKind}`,\n });\n }\n\n const fnParams = new Map(descriptor.parameters.map((p) => [p.name, p]));\n const slotParams = new Map(slot.parameters.map((p) => [p.name, p]));\n\n for (const sp of slot.parameters) {\n const fp = fnParams.get(sp.name);\n if (!fp) {\n issues.push({ code: 'parameter_missing', parameter: sp.name, message: `has no parameter '${sp.name}'` });\n continue;\n }\n if (fp.type !== sp.type) {\n issues.push({\n code: 'parameter_type',\n parameter: sp.name,\n message: `parameter '${sp.name}' is ${fp.type}, the slot passes ${sp.type}`,\n });\n continue;\n }\n if (sp.options && sp.options.length > 0) {\n const have = new Set(fp.options ?? []);\n const missing = sp.options.filter((o) => !have.has(o));\n if (missing.length > 0) {\n issues.push({\n code: 'options',\n parameter: sp.name,\n message: `parameter '${sp.name}' does not accept ${missing.map((m) => `'${m}'`).join(', ')}`,\n });\n }\n }\n if (typeof sp.maxLength === 'number' && (sp.type === 'string' || sp.type === 'text')) {\n const effective = fp.maxLength ?? DEFAULT_MAX_LENGTH[fp.type];\n if (typeof effective === 'number' && effective < sp.maxLength) {\n issues.push({\n code: 'max_length',\n parameter: sp.name,\n message: `parameter '${sp.name}' allows ${effective} characters, the slot may pass ${sp.maxLength}`,\n });\n }\n }\n }\n\n for (const fp of descriptor.parameters) {\n if (!fp.required) continue;\n const sp = slotParams.get(fp.name);\n if (!sp || !sp.required) {\n issues.push({\n code: 'parameter_required',\n parameter: fp.name,\n message: sp\n ? `requires '${fp.name}', which the slot passes only optionally`\n : `requires '${fp.name}', which the slot does not pass`,\n });\n }\n }\n\n return { compatible: issues.length === 0, issues };\n}\n\n// ── handlers ────────────────────────────────────────────────────────────────\n\nexport interface AiFunctionSlotDeps {\n client: AiFunctionsClientLike;\n slots: readonly AiFunctionSlot[];\n resolver: AiFunctionSlotResolver;\n}\n\nexport interface AiFunctionSlotHandlers {\n /** Catalog + binding + live descriptor + compat verdict + compatible choices. */\n listSlots(): Promise<AiFunctionSlotRow[]>;\n /** Bind a slot; refuses an incompatible function (`AiFunctionSlotIncompatibleError`). */\n setSlot(input: { key: string; functionKey: string }): Promise<AiFunctionSetSlotResult>;\n /** Unbind a slot (it becomes unavailable). */\n resetSlot(input: { key: string }): Promise<{ key: string }>;\n /** The org's callable functions, optionally by output kind. */\n listFunctions(input?: { outputKind?: AiFunctionDescriptor['outputKind'] }): Promise<AiFunctionDescriptor[]>;\n}\n\nfunction findSlot(slots: readonly AiFunctionSlot[], key: string): AiFunctionSlot {\n const slot = slots.find((s) => s.key === key);\n if (!slot) throw new AiFunctionUnknownSlotError(key);\n return slot;\n}\n\nfunction toOption(d: AiFunctionDescriptor): AiFunctionSlotOption {\n return { functionKey: d.functionKey, title: d.title, liveVersion: d.liveVersion };\n}\n\n/**\n * Framework-free async handlers. Wrap each in one router entry of the host\n * (tRPC procedure, route handler, …) behind the host's admin permission.\n * Errors from the SDK are rethrown untouched — map them with\n * `classifyAiFunctionError` so a failed catalog read shows as an error, never\n * as an empty list.\n */\nexport function createAiFunctionSlotHandlers(deps: AiFunctionSlotDeps): AiFunctionSlotHandlers {\n const { client, slots, resolver } = deps;\n\n return {\n async listSlots() {\n const [functions, bindings] = await Promise.all([client.aiFunctions.list(), resolver.list()]);\n const byKey = new Map(functions.map((f) => [f.functionKey, f]));\n\n return slots.map((slot): AiFunctionSlotRow => {\n const binding = bindings.get(slot.key) ?? null;\n const bound = binding ? byKey.get(binding.functionKey) : undefined;\n let compat: AiFunctionSlotCompatVerdict | null = null;\n if (binding) {\n compat = bound\n ? checkAiFunctionSlotCompatibility(slot, bound)\n : {\n compatible: false,\n issues: [\n {\n code: 'function_unavailable',\n message: `'${binding.functionKey}' is not published or no longer exists`,\n },\n ],\n };\n }\n return {\n key: slot.key,\n label: slot.label,\n usedFor: slot.usedFor ?? null,\n outputKind: slot.outputKind,\n parameters: slot.parameters.map((p) => ({ ...p })),\n binding,\n boundFunction: bound ? { ...toOption(bound), outputKind: bound.outputKind } : null,\n compat,\n options: functions\n .filter((f) => checkAiFunctionSlotCompatibility(slot, f).compatible)\n .map(toOption),\n };\n });\n },\n\n async setSlot({ key, functionKey }) {\n const slot = findSlot(slots, key);\n const descriptor = await client.aiFunctions.get(functionKey);\n const verdict = checkAiFunctionSlotCompatibility(slot, descriptor);\n if (!verdict.compatible) {\n throw new AiFunctionSlotIncompatibleError(key, functionKey, verdict.issues);\n }\n await resolver.set(key, { functionKey });\n return { key, functionKey, liveVersion: descriptor.liveVersion };\n },\n\n async resetSlot({ key }) {\n findSlot(slots, key);\n await resolver.delete(key);\n return { key };\n },\n\n async listFunctions(input) {\n const functions = await client.aiFunctions.list();\n return input?.outputKind ? functions.filter((f) => f.outputKind === input.outputKind) : functions;\n },\n };\n}\n\n/**\n * Run the function bound to a slot. Unset ⇒ `AiFunctionSlotUnsetError` with no\n * request. Calls use the host's Cadra API key (`public_api`, billed to that org).\n */\nexport async function runSlot<TOutput = unknown>(\n deps: AiFunctionSlotDeps,\n key: string,\n parameters: AiFunctionVariables,\n opts?: AiFunctionRunShorthandOptions\n): Promise<AiFunctionRunResult<TOutput>> {\n findSlot(deps.slots, key);\n const binding = await deps.resolver.get(key);\n if (!binding) throw new AiFunctionSlotUnsetError(key);\n return deps.client.aiFunctions.run<TOutput>(binding.functionKey, parameters, opts);\n}\n","/**\n * Structural SDK-error classifier (p93 AIF-017, specs D28).\n *\n * Reads `status` / `name` / `serverCode` off the thrown value — never\n * `instanceof`: the SDK is often `link:`ed or duplicated in a host bundle, so\n * class identity across module boundaries is a needless failure mode (Yobo\n * `lib/cadra/upstream-error.ts` lesson, F55).\n */\n\nimport type { AiFunctionErrorClassification } from './types.js';\n\nfunction numberAt(source: unknown, key: string): number | undefined {\n if (!source || typeof source !== 'object') return undefined;\n const raw = (source as Record<string, unknown>)[key];\n const n = typeof raw === 'string' ? Number(raw) : raw;\n return typeof n === 'number' && Number.isFinite(n) && n >= 0 ? n : undefined;\n}\n\nfunction stringAt(source: unknown, key: string): string | undefined {\n if (!source || typeof source !== 'object') return undefined;\n const raw = (source as Record<string, unknown>)[key];\n return typeof raw === 'string' && raw ? raw : undefined;\n}\n\n/**\n * Map anything an AI-function call threw to one of\n * `rate_limited | unauthorized | forbidden | not_found | timeout | network | upstream`.\n */\nexport function classifyAiFunctionError(error: unknown): AiFunctionErrorClassification {\n const status = numberAt(error, 'status');\n const name = stringAt(error, 'name');\n const serverCode = stringAt(error, 'serverCode');\n const message = stringAt(error, 'message') ?? (typeof error === 'string' ? error : 'AI function call failed');\n const details = error && typeof error === 'object' ? (error as { details?: unknown }).details : undefined;\n\n const base = {\n ...(status !== undefined ? { status } : {}),\n ...(serverCode ? { serverCode } : {}),\n message,\n };\n\n if (status === 429 || name === 'RateLimitError' || serverCode === 'RATE_LIMITED') {\n const retryAfterSeconds =\n numberAt(error, 'retryAfter') ?? numberAt(details, 'retryAfter') ?? numberAt(details, 'retry_after');\n return { kind: 'rate_limited', ...base, ...(retryAfterSeconds !== undefined ? { retryAfterSeconds } : {}) };\n }\n if (status === 401 || name === 'AuthenticationError') return { kind: 'unauthorized', ...base };\n if (status === 403 || name === 'AuthorizationError') return { kind: 'forbidden', ...base };\n if (status === 404 || name === 'NotFoundError') return { kind: 'not_found', ...base };\n if (name === 'TimeoutError' || name === 'AbortError' || status === 408 || serverCode === 'TIMEOUT') {\n return { kind: 'timeout', ...base };\n }\n if (\n name === 'NetworkError' ||\n status === 0 ||\n (status === undefined && name === 'TypeError')\n ) {\n return { kind: 'network', ...base };\n }\n return { kind: 'upstream', ...base };\n}\n"]}
@@ -73,86 +73,8 @@ function collectDueRefs(lanes) {
73
73
  }
74
74
  return Array.from(byRef.values());
75
75
  }
76
- var DEFAULT_ORG_COLUMN = "org_id";
77
- function laneStageId(lane) {
78
- return lane.id ?? lane.key;
79
- }
80
- function suggestHostState(lane) {
81
- return lane.label ?? lane.key ?? "";
82
- }
83
- function freshFieldRow(ref, requiresPredicate) {
84
- return {
85
- ref,
86
- kind: requiresPredicate ? "predicate" : "column",
87
- column: "",
88
- path: "",
89
- via: "",
90
- table: "",
91
- name: "",
92
- predicateOnly: requiresPredicate
93
- };
94
- }
95
- function fieldRowFromBinding(b, requiresPredicate) {
96
- const base = freshFieldRow(b.ref, requiresPredicate);
97
- switch (b.kind) {
98
- case "column":
99
- return { ...base, kind: "column", column: b.column };
100
- case "json":
101
- return { ...base, kind: "json", column: b.column, path: b.path };
102
- case "fk":
103
- return { ...base, kind: "fk", via: b.via, table: b.table, column: b.column };
104
- case "predicate":
105
- return { ...base, kind: "predicate", name: b.name };
106
- default:
107
- return base;
108
- }
109
- }
110
- function fieldRowError(row) {
111
- switch (row.kind) {
112
- case "column":
113
- return identifierError(row.column) && `column ${identifierError(row.column)}`;
114
- case "json": {
115
- const colErr = identifierError(row.column);
116
- if (colErr) return `column ${colErr}`;
117
- if (!isValidJsonPath(row.path))
118
- return "path must be dot-separated identifiers";
119
- return null;
120
- }
121
- case "fk": {
122
- const viaErr = identifierError(row.via);
123
- if (viaErr) return `via ${viaErr}`;
124
- const tableErr = identifierError(row.table);
125
- if (tableErr) return `table ${tableErr}`;
126
- const colErr = identifierError(row.column);
127
- if (colErr) return `column ${colErr}`;
128
- return null;
129
- }
130
- case "predicate":
131
- return row.name.length === 0 ? "pick a predicate" : !isValidIdentifier(row.name) ? "predicate name must be a single identifier" : null;
132
- default:
133
- return "unknown kind";
134
- }
135
- }
136
- function rowToBinding(row) {
137
- switch (row.kind) {
138
- case "column":
139
- return { ref: row.ref, kind: "column", column: row.column };
140
- case "json":
141
- return { ref: row.ref, kind: "json", column: row.column, path: row.path };
142
- case "fk":
143
- return {
144
- ref: row.ref,
145
- kind: "fk",
146
- via: row.via,
147
- table: row.table,
148
- column: row.column
149
- };
150
- case "predicate":
151
- return { ref: row.ref, kind: "predicate", name: row.name };
152
- default:
153
- return { ref: row.ref, kind: "column", column: "" };
154
- }
155
- }
76
+
77
+ // src/board-host/widget/styles.ts
156
78
  var S = {
157
79
  card: {
158
80
  background: "#fff",
@@ -234,6 +156,200 @@ var S = {
234
156
  borderRadius: 999
235
157
  }
236
158
  };
159
+ function laneStageId(lane) {
160
+ return lane.id ?? lane.key;
161
+ }
162
+ function withStale(offered, extra) {
163
+ const known = new Set(offered.map((o) => o.value));
164
+ const stale = extra.filter((v) => v && !known.has(v)).map((v) => ({ value: v, label: `${v} (not on the board)` }));
165
+ return [...offered, ...stale];
166
+ }
167
+ function LaneMapStep({
168
+ lanes,
169
+ value,
170
+ onChange,
171
+ hostStates,
172
+ createIfMissing
173
+ }) {
174
+ function setEntry(key, entry) {
175
+ onChange({ ...value, [key]: entry });
176
+ }
177
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: lanes.map((lane) => {
178
+ const entry = value[lane.key];
179
+ const hostState = entry?.hostState ?? "";
180
+ const alsoFrom = entry?.alsoFrom ?? [];
181
+ const mapped = hostState.trim().length > 0;
182
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S.lane, children: [
183
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
184
+ lane.label,
185
+ /* @__PURE__ */ jsxRuntime.jsx("small", { style: { display: "block", color: "#98a1ad", fontSize: 11 }, children: laneStageId(lane) })
186
+ ] }),
187
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#98a1ad", textAlign: "center" }, children: "\u2192" }),
188
+ hostStates ? /* @__PURE__ */ jsxRuntime.jsxs(
189
+ "select",
190
+ {
191
+ "aria-label": `Host state for ${lane.label}`,
192
+ value: hostState,
193
+ onChange: (e) => {
194
+ const next = e.target.value;
195
+ setEntry(lane.key, {
196
+ hostState: next,
197
+ alsoFrom: alsoFrom.filter((s) => s !== next)
198
+ });
199
+ },
200
+ style: { ...S.input, minWidth: 0, width: "100%" },
201
+ children: [
202
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "\u2014 host state \u2014" }),
203
+ withStale(hostStates, [hostState]).map((o) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: o.value, children: o.label }, o.value))
204
+ ]
205
+ }
206
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
207
+ "input",
208
+ {
209
+ "aria-label": `Host state for ${lane.label}`,
210
+ value: hostState,
211
+ placeholder: "\u2014 host state \u2014",
212
+ onChange: (e) => {
213
+ setEntry(lane.key, { ...entry, hostState: e.target.value });
214
+ },
215
+ style: { ...S.input, minWidth: 0, width: "100%" }
216
+ }
217
+ ),
218
+ createIfMissing ? /* @__PURE__ */ jsxRuntime.jsxs(
219
+ "label",
220
+ {
221
+ style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5, color: "#6b7480" },
222
+ children: [
223
+ /* @__PURE__ */ jsxRuntime.jsx(
224
+ "input",
225
+ {
226
+ type: "checkbox",
227
+ "aria-label": `Create lane ${lane.label} if missing`,
228
+ checked: createIfMissing.value[lane.key] ?? false,
229
+ onChange: (e) => createIfMissing.onChange(lane.key, e.target.checked)
230
+ }
231
+ ),
232
+ "create"
233
+ ]
234
+ }
235
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
236
+ hostStates && /* @__PURE__ */ jsxRuntime.jsxs(
237
+ "label",
238
+ {
239
+ style: {
240
+ gridColumn: "1 / -1",
241
+ display: "flex",
242
+ alignItems: "flex-start",
243
+ gap: 8,
244
+ fontSize: 11.5,
245
+ color: "#6b7480"
246
+ },
247
+ children: [
248
+ "Also accepts",
249
+ /* @__PURE__ */ jsxRuntime.jsx(
250
+ "select",
251
+ {
252
+ multiple: true,
253
+ "aria-label": `Also accepts for ${lane.label}`,
254
+ value: alsoFrom,
255
+ onChange: (e) => {
256
+ const picked = Array.from(e.target.options).filter((o) => o.selected).map((o) => o.value);
257
+ setEntry(lane.key, { hostState, alsoFrom: picked });
258
+ },
259
+ style: { ...S.input, minWidth: 0, flex: 1 },
260
+ children: withStale(hostStates, alsoFrom).filter((o) => o.value !== hostState).map((o) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: o.value, children: o.label }, o.value))
261
+ }
262
+ )
263
+ ]
264
+ }
265
+ ),
266
+ /* @__PURE__ */ jsxRuntime.jsx(
267
+ "span",
268
+ {
269
+ style: { ...S.st, color: mapped ? "#16a34a" : "#c2710c", gridColumn: "1 / -1", marginTop: 2 },
270
+ children: mapped ? "\u2713 mapped" : "\u26A0 gap \u2014 unmapped lane"
271
+ }
272
+ )
273
+ ] }, lane.key);
274
+ }) });
275
+ }
276
+ var DEFAULT_ORG_COLUMN = "org_id";
277
+ function suggestHostState(lane) {
278
+ return lane.label ?? lane.key ?? "";
279
+ }
280
+ function freshFieldRow(ref, requiresPredicate) {
281
+ return {
282
+ ref,
283
+ kind: requiresPredicate ? "predicate" : "column",
284
+ column: "",
285
+ path: "",
286
+ via: "",
287
+ table: "",
288
+ name: "",
289
+ predicateOnly: requiresPredicate
290
+ };
291
+ }
292
+ function fieldRowFromBinding(b, requiresPredicate) {
293
+ const base = freshFieldRow(b.ref, requiresPredicate);
294
+ switch (b.kind) {
295
+ case "column":
296
+ return { ...base, kind: "column", column: b.column };
297
+ case "json":
298
+ return { ...base, kind: "json", column: b.column, path: b.path };
299
+ case "fk":
300
+ return { ...base, kind: "fk", via: b.via, table: b.table, column: b.column };
301
+ case "predicate":
302
+ return { ...base, kind: "predicate", name: b.name };
303
+ default:
304
+ return base;
305
+ }
306
+ }
307
+ function fieldRowError(row) {
308
+ switch (row.kind) {
309
+ case "column":
310
+ return identifierError(row.column) && `column ${identifierError(row.column)}`;
311
+ case "json": {
312
+ const colErr = identifierError(row.column);
313
+ if (colErr) return `column ${colErr}`;
314
+ if (!isValidJsonPath(row.path))
315
+ return "path must be dot-separated identifiers";
316
+ return null;
317
+ }
318
+ case "fk": {
319
+ const viaErr = identifierError(row.via);
320
+ if (viaErr) return `via ${viaErr}`;
321
+ const tableErr = identifierError(row.table);
322
+ if (tableErr) return `table ${tableErr}`;
323
+ const colErr = identifierError(row.column);
324
+ if (colErr) return `column ${colErr}`;
325
+ return null;
326
+ }
327
+ case "predicate":
328
+ return row.name.length === 0 ? "pick a predicate" : !isValidIdentifier(row.name) ? "predicate name must be a single identifier" : null;
329
+ default:
330
+ return "unknown kind";
331
+ }
332
+ }
333
+ function rowToBinding(row) {
334
+ switch (row.kind) {
335
+ case "column":
336
+ return { ref: row.ref, kind: "column", column: row.column };
337
+ case "json":
338
+ return { ref: row.ref, kind: "json", column: row.column, path: row.path };
339
+ case "fk":
340
+ return {
341
+ ref: row.ref,
342
+ kind: "fk",
343
+ via: row.via,
344
+ table: row.table,
345
+ column: row.column
346
+ };
347
+ case "predicate":
348
+ return { ref: row.ref, kind: "predicate", name: row.name };
349
+ default:
350
+ return { ref: row.ref, kind: "column", column: "" };
351
+ }
352
+ }
237
353
  function statusColors(status) {
238
354
  switch (status) {
239
355
  case "valid":
@@ -592,57 +708,28 @@ function BoardHostMapping({
592
708
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: S.ttl, children: "Lane map" }),
593
709
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: { marginLeft: "auto", fontSize: 11, color: "#98a1ad" }, children: "auto-matched by name" })
594
710
  ] }),
595
- lanes.map((lane) => {
596
- const mapped = (laneStates[lane.key] ?? "").trim().length > 0;
597
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S.lane, children: [
598
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
599
- lane.label,
600
- /* @__PURE__ */ jsxRuntime.jsx("small", { style: { display: "block", color: "#98a1ad", fontSize: 11 }, children: laneStageId(lane) })
601
- ] }),
602
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#98a1ad", textAlign: "center" }, children: "\u2192" }),
603
- /* @__PURE__ */ jsxRuntime.jsx(
604
- "input",
605
- {
606
- "aria-label": `Host state for ${lane.label}`,
607
- value: laneStates[lane.key] ?? "",
608
- placeholder: "\u2014 host state \u2014",
609
- onChange: (e) => {
610
- setLaneStates((s) => ({ ...s, [lane.key]: e.target.value }));
611
- setValidation(null);
612
- },
613
- style: { ...S.input, minWidth: 0, width: "100%" }
614
- }
615
- ),
616
- /* @__PURE__ */ jsxRuntime.jsxs(
617
- "label",
618
- {
619
- style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5, color: "#6b7480" },
620
- children: [
621
- /* @__PURE__ */ jsxRuntime.jsx(
622
- "input",
623
- {
624
- type: "checkbox",
625
- "aria-label": `Create lane ${lane.label} if missing`,
626
- checked: laneCreate[lane.key] ?? false,
627
- onChange: (e) => {
628
- setLaneCreate((c) => ({ ...c, [lane.key]: e.target.checked }));
629
- setValidation(null);
630
- }
631
- }
632
- ),
633
- "create"
634
- ]
635
- }
711
+ /* @__PURE__ */ jsxRuntime.jsx(
712
+ LaneMapStep,
713
+ {
714
+ lanes,
715
+ value: Object.fromEntries(
716
+ Object.entries(laneStates).map(([k, hostState]) => [k, { hostState }])
636
717
  ),
637
- /* @__PURE__ */ jsxRuntime.jsx(
638
- "span",
639
- {
640
- style: { ...S.st, color: mapped ? "#16a34a" : "#c2710c", gridColumn: "1 / -1", marginTop: 2 },
641
- children: mapped ? "\u2713 mapped" : "\u26A0 gap \u2014 unmapped lane"
718
+ onChange: (next) => {
719
+ setLaneStates(
720
+ Object.fromEntries(Object.entries(next).map(([k, e]) => [k, e.hostState]))
721
+ );
722
+ setValidation(null);
723
+ },
724
+ createIfMissing: {
725
+ value: laneCreate,
726
+ onChange: (key, checked) => {
727
+ setLaneCreate((c) => ({ ...c, [key]: checked }));
728
+ setValidation(null);
642
729
  }
643
- )
644
- ] }, lane.key);
645
- })
730
+ }
731
+ }
732
+ )
646
733
  ] }),
647
734
  /* @__PURE__ */ jsxRuntime.jsxs("section", { style: S.sec, "aria-label": "Field map", children: [
648
735
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: S.lbl, children: [
@@ -819,6 +906,7 @@ function BoardHostMapping({
819
906
 
820
907
  exports.BoardHostMapping = BoardHostMapping;
821
908
  exports.BoardHostMappingProvider = BoardHostMappingProvider;
909
+ exports.LaneMapStep = LaneMapStep;
822
910
  exports.WIDGET_IDENTIFIER_PATTERN = WIDGET_IDENTIFIER_PATTERN;
823
911
  exports.collectDueRefs = collectDueRefs;
824
912
  exports.identifierError = identifierError;