| 1 | /** |
| 2 | * Shared internal helpers for the AppIntegrations service. |
| 3 | * NOT exported from the service barrel. |
| 4 | */ |
| 5 | |
| 6 | /** |
| 7 | * The AppIntegrations wire TagMap is `{ [key: string]: string | undefined }`. |
| 8 | * Collapse it to a plain `Record<string, string>` so it can be diffed with |
| 9 | * `diffTags`. |
| 10 | */ |
| 11 | export const definedTags = (tags?: { |
| 12 | [key: string]: string | undefined; |
| 13 | }): Record<string, string> => { |
| 14 | const out: Record<string, string> = {}; |
| 15 | for (const [key, value] of Object.entries(tags ?? {})) { |
| 16 | if (value !== undefined) { |
| 17 | out[key] = value; |
| 18 | } |
| 19 | } |
| 20 | return out; |
| 21 | }; |