( input: KeyedStream, alias: string, )
| 1261 | } |
| 1262 | |
| 1263 | function wrapInputWithAlias( |
| 1264 | input: KeyedStream, |
| 1265 | alias: string, |
| 1266 | ): NamespacedAndKeyedStream { |
| 1267 | return input.pipe( |
| 1268 | map(([key, row]) => { |
| 1269 | // Initialize the record with a nested structure. |
| 1270 | // If __parentContext exists (from parent-referencing includes), merge parent |
| 1271 | // aliases into the namespaced row so WHERE can resolve parent refs. |
| 1272 | const { __parentContext, ...cleanRow } = row as any |
| 1273 | const nsRow: Record<string, any> = { [alias]: cleanRow } |
| 1274 | if (__parentContext) { |
| 1275 | Object.assign(nsRow, __parentContext) |
| 1276 | ;(nsRow as any).__parentContext = __parentContext |
| 1277 | } |
| 1278 | return [key, nsRow] as [unknown, Record<string, typeof row>] |
| 1279 | }), |
| 1280 | ) |
| 1281 | } |
| 1282 | |
| 1283 | function encodeKeyForUnionBranch(key: unknown): string { |
| 1284 | if (typeof key === `string`) { |
no test coverage detected