MCPcopy Index your code
hub / github.com/github/copilot-sdk / getSharedSessionEventEnvelopeProperties

Function getSharedSessionEventEnvelopeProperties

scripts/codegen/utils.ts:1172–1196  ·  view source on GitHub ↗
(
    schema: JSONSchema7,
    definitionCollections: DefinitionCollections = collectDefinitionCollections(schema as Record<string, unknown>)
)

Source from the content-addressed store, hash-verified

1170}
1171
1172export function getSharedSessionEventEnvelopeProperties(
1173 schema: JSONSchema7,
1174 definitionCollections: DefinitionCollections = collectDefinitionCollections(schema as Record<string, unknown>)
1175): SessionEventEnvelopeProperty[] {
1176 const variants = getSessionEventVariantSchemas(schema, definitionCollections);
1177 const firstVariant = variants[0];
1178 const firstProperties = firstVariant.properties ?? {};
1179
1180 return Object.entries(firstProperties)
1181 .filter(([name]) => name !== "type" && name !== "data")
1182 .map(([name]) => {
1183 const propertySchemas = variants
1184 .map((variant) => variant.properties?.[name])
1185 .filter((propSchema): propSchema is JSONSchema7 => typeof propSchema === "object" && propSchema !== null);
1186
1187 if (propertySchemas.length !== variants.length) return undefined;
1188
1189 return {
1190 name,
1191 schema: selectSessionEventEnvelopePropertySchema(propertySchemas),
1192 required: variants.every((variant) => (variant.required ?? []).includes(name)),
1193 };
1194 })
1195 .filter((property): property is SessionEventEnvelopeProperty => property !== undefined);
1196}
1197
1198function selectSessionEventEnvelopePropertySchema(propertySchemas: JSONSchema7[]): JSONSchema7 {
1199 // Some variants further constrain a shared envelope property, e.g. ephemeral const true.

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…