@daemux/store-automator 0.10.27 → 0.10.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
},
|
|
6
6
|
"metadata": {
|
|
7
7
|
"description": "App Store & Google Play automation for Flutter apps",
|
|
8
|
-
"version": "0.10.
|
|
8
|
+
"version": "0.10.28"
|
|
9
9
|
},
|
|
10
10
|
"plugins": [
|
|
11
11
|
{
|
|
12
12
|
"name": "store-automator",
|
|
13
13
|
"source": "./plugins/store-automator",
|
|
14
14
|
"description": "3 agents for app store publishing: reviewer, meta-creator, media-designer",
|
|
15
|
-
"version": "0.10.
|
|
15
|
+
"version": "0.10.28",
|
|
16
16
|
"keywords": [
|
|
17
17
|
"flutter",
|
|
18
18
|
"app-store",
|
package/package.json
CHANGED
|
@@ -26,12 +26,12 @@ from asc_iap_api import BASE_URL, TIMEOUT, print_api_errors
|
|
|
26
26
|
def get_subscription_availability(headers: dict, sub_id: str) -> dict | None:
|
|
27
27
|
"""Fetch current availability settings for a subscription.
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
Returns the availability resource or None if not yet configured.
|
|
30
|
+
Does not include territory details to avoid ASC API limit errors.
|
|
30
31
|
"""
|
|
31
32
|
resp = requests.get(
|
|
32
33
|
f"{BASE_URL}/subscriptions/{sub_id}/subscriptionAvailability",
|
|
33
34
|
headers=headers,
|
|
34
|
-
params={"include": "availableTerritories", "limit[availableTerritories]": 200},
|
|
35
35
|
timeout=TIMEOUT,
|
|
36
36
|
)
|
|
37
37
|
if not resp.ok:
|
|
@@ -39,11 +39,7 @@ def get_subscription_availability(headers: dict, sub_id: str) -> dict | None:
|
|
|
39
39
|
return None
|
|
40
40
|
print_api_errors(resp, f"get availability for subscription {sub_id}")
|
|
41
41
|
return None
|
|
42
|
-
|
|
43
|
-
result = body.get("data")
|
|
44
|
-
if result:
|
|
45
|
-
result["_included_territories"] = body.get("included", [])
|
|
46
|
-
return result
|
|
42
|
+
return resp.json().get("data")
|
|
47
43
|
|
|
48
44
|
|
|
49
45
|
def list_all_territory_ids(headers: dict) -> list[str]:
|
|
@@ -122,10 +122,14 @@ def sync_subscription_group(
|
|
|
122
122
|
def _sync_availability(headers: dict, sub_id: str, sub_config: dict) -> None:
|
|
123
123
|
"""Ensure subscription territory availability is configured with all territories.
|
|
124
124
|
|
|
125
|
-
If
|
|
126
|
-
|
|
127
|
-
Also re-creates availability if existing territory count is suspiciously low.
|
|
125
|
+
If availability already exists, it is left as-is (idempotent skip).
|
|
126
|
+
Otherwise fetches all App Store territories and creates availability.
|
|
128
127
|
"""
|
|
128
|
+
existing = get_subscription_availability(headers, sub_id)
|
|
129
|
+
if existing:
|
|
130
|
+
print(" Availability already configured")
|
|
131
|
+
return
|
|
132
|
+
|
|
129
133
|
avail_config = sub_config.get("availability", {})
|
|
130
134
|
available_in_new = avail_config.get("available_in_new_territories", True)
|
|
131
135
|
territory_ids = avail_config.get("territories", [])
|
|
@@ -137,14 +141,6 @@ def _sync_availability(headers: dict, sub_id: str, sub_config: dict) -> None:
|
|
|
137
141
|
print(" WARNING: Could not fetch territories", file=sys.stderr)
|
|
138
142
|
return
|
|
139
143
|
|
|
140
|
-
existing = get_subscription_availability(headers, sub_id)
|
|
141
|
-
if existing:
|
|
142
|
-
included = existing.get("_included_territories", [])
|
|
143
|
-
if len(included) >= 100:
|
|
144
|
-
print(f" Availability OK ({len(included)} territories)")
|
|
145
|
-
return
|
|
146
|
-
print(f" Availability has only {len(included)} territories, recreating with {len(territory_ids)}")
|
|
147
|
-
|
|
148
144
|
result = create_subscription_availability(
|
|
149
145
|
headers, sub_id, territory_ids, available_in_new=available_in_new,
|
|
150
146
|
)
|