chore: merge main and preserve keyed archive regressions
This commit is contained in:
@@ -284,8 +284,13 @@ const parseKeyedArchive = (
|
||||
)
|
||||
) {
|
||||
const controlAction = /ControlConnector/iu.test(className);
|
||||
// AppKit connectors (NSNibOutletConnector, NSNibControlConnector)
|
||||
// archive NSSource as the outlet owner or sending control and
|
||||
// NSDestination as the outlet value or action target, so they are read
|
||||
// in that order without the inversion the unprefixed fields use.
|
||||
const source = firstObjectReference(
|
||||
controlAction ? fields.destination : fields.source,
|
||||
archivedObjectReference(fields.NSSource),
|
||||
controlAction ? fields.to : fields.from,
|
||||
controlAction ? fields.target : fields.owner,
|
||||
);
|
||||
@@ -297,11 +302,13 @@ const parseKeyedArchive = (
|
||||
source_id: source,
|
||||
destination_id: firstObjectReference(
|
||||
controlAction ? fields.source : fields.destination,
|
||||
archivedObjectReference(fields.NSDestination),
|
||||
controlAction ? fields.from : fields.to,
|
||||
controlAction ? fields.owner : fields.target,
|
||||
),
|
||||
label: firstString(
|
||||
fields.label,
|
||||
fields.NSLabel,
|
||||
fields.selector,
|
||||
fields.identifier,
|
||||
fields.action,
|
||||
@@ -352,6 +359,18 @@ export const firstString = (...values: unknown[]): string | null => {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* The node identity of a resolved archive reference: its authored object ID,
|
||||
* otherwise its archive UID, which is how the referenced object's node is keyed.
|
||||
*/
|
||||
const archivedObjectReference = (value: unknown): string | null => {
|
||||
const item = record(value);
|
||||
if (typeof item.archiveUID !== "number") return null;
|
||||
return (
|
||||
firstString(item.objectID, item["object-id"]) ?? String(item.archiveUID)
|
||||
);
|
||||
};
|
||||
|
||||
const firstObjectReference = (...values: unknown[]): string | null => {
|
||||
for (const value of values) {
|
||||
const direct = firstString(value);
|
||||
|
||||
Reference in New Issue
Block a user