1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
import { Request, defaultAdditionalPlatformsForClient } from "../../foundation/media/data-fetching";
import { shouldFetchCustomAttributes } from "../product-page/product-page-variants";
import { shouldUsePrerenderedIconArtwork } from "../content/content";
/**
* Returns the attributes to use for a developer media API request.
*/
export function developerAttributes(objectGraph) {
const attributes = ["editorialArtwork", "editorialVideo", "requiredCapabilities", "minimumOSVersion"];
if (objectGraph.client.isMac) {
attributes.push("screenshotsByType");
}
else {
attributes.push("isAppleWatchSupported");
}
if (objectGraph.appleSilicon.isSupportEnabled) {
attributes.push("macRequiredCapabilities");
}
if (objectGraph.client.isMac) {
attributes.push("hasMacIPAPackage");
}
if (objectGraph.client.isVision) {
attributes.push("compatibilityControllerRequirement");
}
if (objectGraph.bag.enableUpdatedAgeRatings) {
attributes.push("ageRating");
}
if (shouldUsePrerenderedIconArtwork(objectGraph)) {
attributes.push("iconArtwork");
}
return attributes;
}
export const iosDeveloperRelationshipKeys = [
"latest-release-app",
"system-apps",
"arcade-apps",
"app-bundles",
"ios-apps",
"imessage-apps",
"watch-apps",
"atv-apps",
];
export const visionOSDeveloperRelationshipKeys = [
"latest-release-app",
"xros-apps",
"arcade-apps",
"ios-apps",
];
export const macosDeveloperRelationshipKeys = [
"latest-release-app",
"arcade-apps",
"app-bundles",
"mac-apps",
];
export const webDeveloperRelationshipKeys = [
"latest-release-app",
"system-apps",
"arcade-apps",
"app-bundles",
"ios-apps",
"imessage-apps",
"watch-apps",
"atv-apps",
"xros-apps",
"mac-apps",
];
export const watchosDeveloperRelationshipKey = "watch-apps";
function developerRelationships(objectGraph) {
let relationships = [];
switch (objectGraph.client.deviceType) {
case "mac":
relationships = relationships.concat(macosDeveloperRelationshipKeys);
if (objectGraph.appleSilicon.isSupportEnabled) {
relationships.push("mac-os-compatible-ios-apps");
}
break;
case "watch":
relationships.push(watchosDeveloperRelationshipKey);
break;
case "vision":
relationships = relationships.concat(visionOSDeveloperRelationshipKeys);
break;
case "web":
relationships = relationships.concat(webDeveloperRelationshipKeys);
break;
default:
relationships = relationships.concat(iosDeveloperRelationshipKeys);
break;
}
return relationships;
}
/**
* Creates a {@linkcode Request} for a "developer" page with the given {@linkcode id}
*/
export function makeDeveloperRequest(objectGraph, id) {
const request = new Request(objectGraph).withIdOfType(id, "developers");
return addDeveloperRequestProperties(objectGraph, request);
}
/**
* Add the expected request attributes (relationships, platforms, etc) to a request
* for a "developer" resource
*/
export function addDeveloperRequestProperties(objectGraph, request) {
request
.includingAdditionalPlatforms(defaultAdditionalPlatformsForClient(objectGraph))
.includingRelationships(developerRelationships(objectGraph))
.includingAttributes(developerAttributes(objectGraph))
.includingMacOSCompatibleIOSAppsWhenSupported()
.usingCustomAttributes(shouldFetchCustomAttributes(objectGraph));
if (objectGraph.client.isWeb) {
// The "web" client needs to load *all* of the data for SEO purposes
request.addingQuery("sparseLimit[developers:ios-apps]", "40");
}
return request;
}
//# sourceMappingURL=developer-request.js.map
|