@playdrop/playdrop-cli 0.7.15 → 0.7.17
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.
- package/config/client-meta.json +1 -1
- package/node_modules/@playdrop/ai-client/dist/index.js +461 -444
- package/node_modules/@playdrop/ai-client/package.json +1 -1
- package/node_modules/@playdrop/api-client/dist/client.js +903 -882
- package/node_modules/@playdrop/api-client/dist/core/errors.js +69 -45
- package/node_modules/@playdrop/api-client/dist/core/request.js +188 -159
- package/node_modules/@playdrop/api-client/dist/domains/admin.js +516 -491
- package/node_modules/@playdrop/api-client/dist/domains/ai.js +40 -14
- package/node_modules/@playdrop/api-client/dist/domains/apps.js +480 -462
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.js +439 -419
- package/node_modules/@playdrop/api-client/dist/domains/assets.js +696 -676
- package/node_modules/@playdrop/api-client/dist/domains/auth.js +346 -320
- package/node_modules/@playdrop/api-client/dist/domains/comments.js +124 -98
- package/node_modules/@playdrop/api-client/dist/domains/free-credits.js +91 -65
- package/node_modules/@playdrop/api-client/dist/domains/me.js +71 -45
- package/node_modules/@playdrop/api-client/dist/domains/payments.js +407 -386
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.js +144 -118
- package/node_modules/@playdrop/api-client/dist/domains/search.js +117 -104
- package/node_modules/@playdrop/api-client/dist/domains/tags.js +188 -162
- package/node_modules/@playdrop/api-client/dist/index.js +993 -552
- package/node_modules/@playdrop/api-client/package.json +1 -1
- package/node_modules/@playdrop/boxel-three/dist/src/animations.js +84 -62
- package/node_modules/@playdrop/boxel-three/dist/src/builders.js +341 -308
- package/node_modules/@playdrop/boxel-three/dist/src/context.js +55 -29
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.js +856 -858
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.js +267 -261
- package/node_modules/@playdrop/boxel-three/dist/src/index.js +64 -15
- package/node_modules/@playdrop/boxel-three/dist/src/instantiate.js +89 -63
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.js +81 -56
- package/node_modules/@playdrop/boxel-three/dist/src/overlays.js +112 -86
- package/node_modules/@playdrop/boxel-three/dist/src/primitives.js +45 -17
- package/node_modules/@playdrop/boxel-three/dist/src/scene.js +160 -136
- package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.js +582 -584
- package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.js +123 -97
- package/node_modules/@playdrop/boxel-three/dist/src/textures.js +207 -182
- package/node_modules/@playdrop/boxel-three/dist/src/types.js +15 -1
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.js +451 -425
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.js +109 -84
- package/node_modules/@playdrop/boxel-three/dist/test/export-image.playwright.test.js +127 -106
- package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.js +73 -51
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +97 -79
- package/node_modules/@playdrop/boxel-three/dist/test/index.test.js +29 -7
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +80 -60
- package/node_modules/@playdrop/boxel-three/dist/test/overlays.test.js +41 -19
- package/node_modules/@playdrop/boxel-three/dist/test/scene-filter.test.js +72 -50
- package/node_modules/@playdrop/boxel-three/dist/test/scene-smoke.test.js +84 -62
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +69 -47
- package/node_modules/@playdrop/boxel-three/dist/test/textured-overlay.test.js +129 -109
- package/node_modules/@playdrop/boxel-three/dist/test/voxels.test.js +40 -18
- package/node_modules/@playdrop/boxel-three/package.json +1 -1
- package/node_modules/@playdrop/config/client-meta.json +1 -1
- package/node_modules/@playdrop/types/dist/api.js +289 -203
- package/node_modules/@playdrop/types/dist/app-capability-filters.js +112 -62
- package/node_modules/@playdrop/types/dist/app.js +91 -45
- package/node_modules/@playdrop/types/dist/asset-pack.js +37 -5
- package/node_modules/@playdrop/types/dist/asset-spec.js +170 -90
- package/node_modules/@playdrop/types/dist/asset.js +186 -108
- package/node_modules/@playdrop/types/dist/content-license.js +49 -15
- package/node_modules/@playdrop/types/dist/creator-public-image.js +60 -32
- package/node_modules/@playdrop/types/dist/ecs.js +102 -82
- package/node_modules/@playdrop/types/dist/engine-builtins.js +603 -573
- package/node_modules/@playdrop/types/dist/entity.js +63 -53
- package/node_modules/@playdrop/types/dist/graph.js +116 -80
- package/node_modules/@playdrop/types/dist/index.js +47 -20
- package/node_modules/@playdrop/types/dist/owned-assets.js +55 -33
- package/node_modules/@playdrop/types/dist/player-meta.js +151 -100
- package/node_modules/@playdrop/types/dist/realtime.js +27 -7
- package/node_modules/@playdrop/types/dist/version.js +182 -124
- package/node_modules/@playdrop/types/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,910 +1,931 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var client_exports = {};
|
|
19
|
+
__export(client_exports, {
|
|
20
|
+
createApiClient: () => createApiClient
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(client_exports);
|
|
23
|
+
var import_types = require("@playdrop/types");
|
|
24
|
+
var import_me = require("./domains/me.js");
|
|
25
|
+
var import_search = require("./domains/search.js");
|
|
26
|
+
var import_tags = require("./domains/tags.js");
|
|
27
|
+
var import_apps = require("./domains/apps.js");
|
|
28
|
+
var import_assets = require("./domains/assets.js");
|
|
29
|
+
var import_asset_packs = require("./domains/asset-packs.js");
|
|
30
|
+
var import_auth = require("./domains/auth.js");
|
|
31
|
+
var import_comments = require("./domains/comments.js");
|
|
32
|
+
var import_payments = require("./domains/payments.js");
|
|
33
|
+
var import_admin = require("./domains/admin.js");
|
|
34
|
+
var import_ai = require("./domains/ai.js");
|
|
35
|
+
var import_free_credits = require("./domains/free-credits.js");
|
|
36
|
+
var import_player_meta = require("./domains/player-meta.js");
|
|
37
|
+
var import_request = require("./core/request.js");
|
|
38
|
+
var import_errors = require("./core/errors.js");
|
|
39
|
+
function createApiClient(config = {}) {
|
|
40
|
+
const fetchImpl = config.fetchImpl ?? globalThis.fetch?.bind(globalThis);
|
|
41
|
+
if (!fetchImpl) {
|
|
42
|
+
throw new Error("api_client_missing_fetch");
|
|
43
|
+
}
|
|
44
|
+
const requestTimeoutMs = (0, import_request.resolveRequestTimeoutMs)(config.requestTimeoutMs);
|
|
45
|
+
const includeBrowserCredentials = config.includeBrowserCredentials ?? true;
|
|
46
|
+
const resolveBaseUrl = (0, import_request.createBaseUrlResolver)(config.baseUrl);
|
|
47
|
+
const getClientHeaders = () => config.clientHeaders ? config.clientHeaders() : {};
|
|
48
|
+
async function resolveToken() {
|
|
49
|
+
if (config.tokenProvider) {
|
|
50
|
+
const token = await config.tokenProvider();
|
|
51
|
+
return token ?? null;
|
|
22
52
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (config.tokenProvider) {
|
|
29
|
-
const token = await config.tokenProvider();
|
|
30
|
-
return token ?? null;
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
function buildIapQuery(params) {
|
|
56
|
+
if (!params) {
|
|
57
|
+
return "";
|
|
33
58
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
const search = new URLSearchParams();
|
|
39
|
-
if (params.kind) {
|
|
40
|
-
search.set('kind', params.kind);
|
|
41
|
-
}
|
|
42
|
-
if (params.status) {
|
|
43
|
-
const statuses = Array.isArray(params.status) ? params.status : [params.status];
|
|
44
|
-
if (statuses.length > 0) {
|
|
45
|
-
search.set('status', statuses.join(','));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (params.from) {
|
|
49
|
-
const fromValue = params.from instanceof Date ? params.from.toISOString() : params.from;
|
|
50
|
-
search.set('from', fromValue);
|
|
51
|
-
}
|
|
52
|
-
if (params.to) {
|
|
53
|
-
const toValue = params.to instanceof Date ? params.to.toISOString() : params.to;
|
|
54
|
-
search.set('to', toValue);
|
|
55
|
-
}
|
|
56
|
-
if (typeof params.appId === 'number') {
|
|
57
|
-
search.set('appId', String(params.appId));
|
|
58
|
-
}
|
|
59
|
-
if (typeof params.limit === 'number') {
|
|
60
|
-
search.set('limit', String(params.limit));
|
|
61
|
-
}
|
|
62
|
-
if (typeof params.offset === 'number') {
|
|
63
|
-
search.set('offset', String(params.offset));
|
|
64
|
-
}
|
|
65
|
-
const query = search.toString();
|
|
66
|
-
return query;
|
|
59
|
+
const search = new URLSearchParams();
|
|
60
|
+
if (params.kind) {
|
|
61
|
+
search.set("kind", params.kind);
|
|
67
62
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return String(revision);
|
|
74
|
-
}
|
|
75
|
-
const trimmed = revision.trim().toLowerCase();
|
|
76
|
-
if (!trimmed) {
|
|
77
|
-
throw new Error('invalid_asset_revision');
|
|
78
|
-
}
|
|
79
|
-
const numeric = trimmed.startsWith('r') ? trimmed.slice(1) : trimmed;
|
|
80
|
-
const parsed = Number.parseInt(numeric, 10);
|
|
81
|
-
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
82
|
-
throw new Error('invalid_asset_revision');
|
|
83
|
-
}
|
|
84
|
-
return String(parsed);
|
|
63
|
+
if (params.status) {
|
|
64
|
+
const statuses = Array.isArray(params.status) ? params.status : [params.status];
|
|
65
|
+
if (statuses.length > 0) {
|
|
66
|
+
search.set("status", statuses.join(","));
|
|
67
|
+
}
|
|
85
68
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
throw new Error('invalid_version_format');
|
|
90
|
-
}
|
|
91
|
-
const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
92
|
-
if (!semverRegex.test(trimmed)) {
|
|
93
|
-
throw new Error('invalid_version_format');
|
|
94
|
-
}
|
|
95
|
-
return trimmed;
|
|
69
|
+
if (params.from) {
|
|
70
|
+
const fromValue = params.from instanceof Date ? params.from.toISOString() : params.from;
|
|
71
|
+
search.set("from", fromValue);
|
|
96
72
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
return value;
|
|
73
|
+
if (params.to) {
|
|
74
|
+
const toValue = params.to instanceof Date ? params.to.toISOString() : params.to;
|
|
75
|
+
search.set("to", toValue);
|
|
102
76
|
}
|
|
103
|
-
|
|
104
|
-
|
|
77
|
+
if (typeof params.appId === "number") {
|
|
78
|
+
search.set("appId", String(params.appId));
|
|
105
79
|
}
|
|
106
|
-
|
|
107
|
-
|
|
80
|
+
if (typeof params.limit === "number") {
|
|
81
|
+
search.set("limit", String(params.limit));
|
|
108
82
|
}
|
|
109
|
-
|
|
110
|
-
|
|
83
|
+
if (typeof params.offset === "number") {
|
|
84
|
+
search.set("offset", String(params.offset));
|
|
111
85
|
}
|
|
112
|
-
|
|
113
|
-
|
|
86
|
+
const query = search.toString();
|
|
87
|
+
return query;
|
|
88
|
+
}
|
|
89
|
+
function normalizeAssetRevisionInput(revision) {
|
|
90
|
+
if (typeof revision === "number") {
|
|
91
|
+
if (!Number.isInteger(revision) || revision <= 0) {
|
|
92
|
+
throw new Error("invalid_asset_revision");
|
|
93
|
+
}
|
|
94
|
+
return String(revision);
|
|
114
95
|
}
|
|
115
|
-
|
|
116
|
-
|
|
96
|
+
const trimmed = revision.trim().toLowerCase();
|
|
97
|
+
if (!trimmed) {
|
|
98
|
+
throw new Error("invalid_asset_revision");
|
|
117
99
|
}
|
|
118
|
-
|
|
119
|
-
|
|
100
|
+
const numeric = trimmed.startsWith("r") ? trimmed.slice(1) : trimmed;
|
|
101
|
+
const parsed = Number.parseInt(numeric, 10);
|
|
102
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
103
|
+
throw new Error("invalid_asset_revision");
|
|
120
104
|
}
|
|
121
|
-
|
|
122
|
-
|
|
105
|
+
return String(parsed);
|
|
106
|
+
}
|
|
107
|
+
function normalizeSemverInput(version) {
|
|
108
|
+
const trimmed = typeof version === "string" ? version.trim() : "";
|
|
109
|
+
if (!trimmed) {
|
|
110
|
+
throw new Error("invalid_version_format");
|
|
123
111
|
}
|
|
124
|
-
|
|
125
|
-
|
|
112
|
+
const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
113
|
+
if (!semverRegex.test(trimmed)) {
|
|
114
|
+
throw new Error("invalid_version_format");
|
|
126
115
|
}
|
|
127
|
-
|
|
128
|
-
|
|
116
|
+
return trimmed;
|
|
117
|
+
}
|
|
118
|
+
function normalizeEnumInput(value, allowed, errorCode) {
|
|
119
|
+
if (!allowed.includes(value)) {
|
|
120
|
+
throw new Error(errorCode);
|
|
129
121
|
}
|
|
130
|
-
|
|
131
|
-
|
|
122
|
+
return value;
|
|
123
|
+
}
|
|
124
|
+
function normalizeSavedItemKindInput(kind) {
|
|
125
|
+
return normalizeEnumInput(kind, import_types.SAVED_ITEM_KIND_VALUES, "invalid_saved_item_kind");
|
|
126
|
+
}
|
|
127
|
+
function normalizeEngagementEventTypeInput(eventType) {
|
|
128
|
+
return normalizeEnumInput(eventType, import_types.ENGAGEMENT_EVENT_TYPE_VALUES, "invalid_engagement_event_type");
|
|
129
|
+
}
|
|
130
|
+
function normalizeEngagementTargetKindInput(targetKind) {
|
|
131
|
+
return normalizeEnumInput(targetKind, import_types.ENGAGEMENT_TARGET_KIND_VALUES, "invalid_engagement_target_kind");
|
|
132
|
+
}
|
|
133
|
+
function normalizeLibraryCategoryInput(category) {
|
|
134
|
+
return normalizeEnumInput(category, import_types.LIBRARY_CATEGORY_VALUES, "invalid_library_category");
|
|
135
|
+
}
|
|
136
|
+
function normalizeLibrarySortInput(sort) {
|
|
137
|
+
return normalizeEnumInput(sort, import_types.LIBRARY_SORT_VALUES, "invalid_library_sort");
|
|
138
|
+
}
|
|
139
|
+
function normalizeFollowingSortInput(sort) {
|
|
140
|
+
return normalizeEnumInput(sort, import_types.FOLLOWING_SORT_VALUES, "invalid_following_sort");
|
|
141
|
+
}
|
|
142
|
+
function normalizeFollowingFeedSectionInput(section) {
|
|
143
|
+
return normalizeEnumInput(section, import_types.FOLLOWING_FEED_SECTION_VALUES, "invalid_following_feed_section");
|
|
144
|
+
}
|
|
145
|
+
function normalizeNotificationStatusInput(status) {
|
|
146
|
+
return normalizeEnumInput(status, import_types.NOTIFICATION_STATUS_VALUES, "invalid_notification_status");
|
|
147
|
+
}
|
|
148
|
+
function normalizeSearchKindInput(kind) {
|
|
149
|
+
return normalizeEnumInput(kind, import_types.SEARCH_KIND_VALUES, "invalid_search_kind");
|
|
150
|
+
}
|
|
151
|
+
function normalizeSearchModeInput(mode) {
|
|
152
|
+
return normalizeEnumInput(mode, import_types.SEARCH_MODE_VALUES, "invalid_search_mode");
|
|
153
|
+
}
|
|
154
|
+
function normalizeSearchAssetTypeInput(assetType) {
|
|
155
|
+
return normalizeEnumInput(assetType, import_types.SEARCH_ASSET_TYPE_VALUES, "invalid_search_asset_type");
|
|
156
|
+
}
|
|
157
|
+
function normalizePositiveIntegerInput(value, errorCode) {
|
|
158
|
+
if (!Number.isInteger(value) || value <= 0) {
|
|
159
|
+
throw new Error(errorCode);
|
|
132
160
|
}
|
|
133
|
-
|
|
134
|
-
|
|
161
|
+
return value;
|
|
162
|
+
}
|
|
163
|
+
function normalizeNonNegativeIntegerInput(value, errorCode) {
|
|
164
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
165
|
+
throw new Error(errorCode);
|
|
135
166
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
167
|
+
return value;
|
|
168
|
+
}
|
|
169
|
+
function normalizeCreatorItemSlug(value, field) {
|
|
170
|
+
const trimmed = typeof value === "string" ? value.trim() : "";
|
|
171
|
+
if (!trimmed) {
|
|
172
|
+
throw new Error(field === "creator" ? "invalid_creator_username" : "invalid_item_name");
|
|
141
173
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
174
|
+
return trimmed;
|
|
175
|
+
}
|
|
176
|
+
function normalizeWebPushSubscriptionRequest(requestBody) {
|
|
177
|
+
const subscription = requestBody?.subscription;
|
|
178
|
+
const endpoint = typeof subscription?.endpoint === "string" ? subscription.endpoint.trim() : "";
|
|
179
|
+
const expirationTime = subscription?.expirationTime;
|
|
180
|
+
const p256dh = typeof subscription?.keys?.p256dh === "string" ? subscription.keys.p256dh.trim() : "";
|
|
181
|
+
const auth = typeof subscription?.keys?.auth === "string" ? subscription.keys.auth.trim() : "";
|
|
182
|
+
if (!endpoint || !endpoint.startsWith("https://")) {
|
|
183
|
+
throw new Error("invalid_web_push_subscription");
|
|
147
184
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if (!trimmed) {
|
|
151
|
-
throw new Error(field === 'creator' ? 'invalid_creator_username' : 'invalid_item_name');
|
|
152
|
-
}
|
|
153
|
-
return trimmed;
|
|
185
|
+
if (expirationTime !== null && expirationTime !== void 0 && !Number.isFinite(expirationTime)) {
|
|
186
|
+
throw new Error("invalid_web_push_subscription");
|
|
154
187
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const endpoint = typeof subscription?.endpoint === 'string' ? subscription.endpoint.trim() : '';
|
|
158
|
-
const expirationTime = subscription?.expirationTime;
|
|
159
|
-
const p256dh = typeof subscription?.keys?.p256dh === 'string' ? subscription.keys.p256dh.trim() : '';
|
|
160
|
-
const auth = typeof subscription?.keys?.auth === 'string' ? subscription.keys.auth.trim() : '';
|
|
161
|
-
if (!endpoint || !endpoint.startsWith('https://')) {
|
|
162
|
-
throw new Error('invalid_web_push_subscription');
|
|
163
|
-
}
|
|
164
|
-
if (expirationTime !== null && expirationTime !== undefined && !Number.isFinite(expirationTime)) {
|
|
165
|
-
throw new Error('invalid_web_push_subscription');
|
|
166
|
-
}
|
|
167
|
-
if (!p256dh || !auth) {
|
|
168
|
-
throw new Error('invalid_web_push_subscription');
|
|
169
|
-
}
|
|
170
|
-
return {
|
|
171
|
-
subscription: {
|
|
172
|
-
endpoint,
|
|
173
|
-
expirationTime: expirationTime === undefined ? null : expirationTime,
|
|
174
|
-
keys: {
|
|
175
|
-
p256dh,
|
|
176
|
-
auth,
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
};
|
|
188
|
+
if (!p256dh || !auth) {
|
|
189
|
+
throw new Error("invalid_web_push_subscription");
|
|
180
190
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
throw new Error('invalid_apple_push_environment');
|
|
191
|
+
return {
|
|
192
|
+
subscription: {
|
|
193
|
+
endpoint,
|
|
194
|
+
expirationTime: expirationTime === void 0 ? null : expirationTime,
|
|
195
|
+
keys: {
|
|
196
|
+
p256dh,
|
|
197
|
+
auth
|
|
189
198
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function normalizeApplePushDeviceRequest(requestBody) {
|
|
203
|
+
const deviceToken = typeof requestBody?.deviceToken === "string" ? requestBody.deviceToken.trim().toLowerCase() : "";
|
|
204
|
+
const apnsEnvironment = requestBody?.apnsEnvironment;
|
|
205
|
+
if (!/^[0-9a-f]+$/.test(deviceToken) || deviceToken.length < 16) {
|
|
206
|
+
throw new Error("invalid_apple_push_device_token");
|
|
194
207
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (!appName) {
|
|
198
|
-
return `/creators/${encodeURIComponent(creator)}/apps${suffix}`;
|
|
199
|
-
}
|
|
200
|
-
const name = normalizeCreatorItemSlug(appName, 'name');
|
|
201
|
-
return `/creators/${encodeURIComponent(creator)}/apps/${encodeURIComponent(name)}${suffix}`;
|
|
208
|
+
if (apnsEnvironment !== "development" && apnsEnvironment !== "production") {
|
|
209
|
+
throw new Error("invalid_apple_push_environment");
|
|
202
210
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
211
|
+
return {
|
|
212
|
+
deviceToken,
|
|
213
|
+
apnsEnvironment
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function buildCreatorAppMutationPath(creatorUsername, appName, suffix = "") {
|
|
217
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
218
|
+
if (!appName) {
|
|
219
|
+
return `/creators/${encodeURIComponent(creator)}/apps${suffix}`;
|
|
210
220
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
221
|
+
const name = normalizeCreatorItemSlug(appName, "name");
|
|
222
|
+
return `/creators/${encodeURIComponent(creator)}/apps/${encodeURIComponent(name)}${suffix}`;
|
|
223
|
+
}
|
|
224
|
+
function buildCreatorAssetMutationPath(creatorUsername, assetName, suffix = "") {
|
|
225
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
226
|
+
if (!assetName) {
|
|
227
|
+
return `/creators/${encodeURIComponent(creator)}/assets${suffix}`;
|
|
218
228
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return decodeURIComponent(utf8Match[1]);
|
|
227
|
-
}
|
|
228
|
-
catch {
|
|
229
|
-
return utf8Match[1];
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
const plainMatch = /filename="?([^";]+)"?/i.exec(headerValue);
|
|
233
|
-
return plainMatch?.[1] ?? null;
|
|
229
|
+
const name = normalizeCreatorItemSlug(assetName, "name");
|
|
230
|
+
return `/creators/${encodeURIComponent(creator)}/assets/${encodeURIComponent(name)}${suffix}`;
|
|
231
|
+
}
|
|
232
|
+
function buildCreatorAssetPackMutationPath(creatorUsername, packName, suffix = "") {
|
|
233
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
234
|
+
if (!packName) {
|
|
235
|
+
return `/creators/${encodeURIComponent(creator)}/asset-packs${suffix}`;
|
|
234
236
|
}
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
237
|
+
const name = normalizeCreatorItemSlug(packName, "name");
|
|
238
|
+
return `/creators/${encodeURIComponent(creator)}/asset-packs/${encodeURIComponent(name)}${suffix}`;
|
|
239
|
+
}
|
|
240
|
+
function parseContentDispositionFilename(headerValue) {
|
|
241
|
+
if (!headerValue) {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
const utf8Match = /filename\*=UTF-8''([^;]+)/i.exec(headerValue);
|
|
245
|
+
if (utf8Match && utf8Match[1]) {
|
|
246
|
+
try {
|
|
247
|
+
return decodeURIComponent(utf8Match[1]);
|
|
248
|
+
} catch {
|
|
249
|
+
return utf8Match[1];
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
const plainMatch = /filename="?([^";]+)"?/i.exec(headerValue);
|
|
253
|
+
return plainMatch?.[1] ?? null;
|
|
254
|
+
}
|
|
255
|
+
const request = (0, import_request.createRequestExecutor)({
|
|
256
|
+
fetchImpl,
|
|
257
|
+
resolveBaseUrl,
|
|
258
|
+
resolveUrl: import_request.resolveUrl,
|
|
259
|
+
parseResponseBody: import_request.parseResponseBody,
|
|
260
|
+
resolveToken,
|
|
261
|
+
getClientHeaders,
|
|
262
|
+
requestTimeoutMs,
|
|
263
|
+
includeBrowserCredentials
|
|
264
|
+
});
|
|
265
|
+
return {
|
|
266
|
+
request,
|
|
267
|
+
...(0, import_auth.buildAuthApiClientMethods)({
|
|
268
|
+
request,
|
|
269
|
+
handleApiError: import_errors.handleApiError
|
|
270
|
+
}),
|
|
271
|
+
...(0, import_free_credits.buildFreeCreditsApiClientMethods)({
|
|
272
|
+
request,
|
|
273
|
+
handleApiError: import_errors.handleApiError
|
|
274
|
+
}),
|
|
275
|
+
async me() {
|
|
276
|
+
const response = await request({
|
|
277
|
+
method: "GET",
|
|
278
|
+
path: "/me"
|
|
279
|
+
});
|
|
280
|
+
if (response.status !== 200) {
|
|
281
|
+
(0, import_errors.handleApiError)(response, "me");
|
|
282
|
+
}
|
|
283
|
+
return response.body;
|
|
284
|
+
},
|
|
285
|
+
async updateProfile(updateRequest) {
|
|
286
|
+
const response = await request({
|
|
287
|
+
method: "PATCH",
|
|
288
|
+
path: "/me",
|
|
289
|
+
body: updateRequest
|
|
290
|
+
});
|
|
291
|
+
if (response.status !== 200) {
|
|
292
|
+
(0, import_errors.handleApiError)(response, "update_profile");
|
|
293
|
+
}
|
|
294
|
+
return response.body;
|
|
295
|
+
},
|
|
296
|
+
async changePassword(changeRequest) {
|
|
297
|
+
const response = await request({
|
|
298
|
+
method: "POST",
|
|
299
|
+
path: "/me/password",
|
|
300
|
+
body: changeRequest
|
|
301
|
+
});
|
|
302
|
+
if (response.status !== 200) {
|
|
303
|
+
(0, import_errors.handleApiError)(response, "change_password");
|
|
304
|
+
}
|
|
305
|
+
return response.body;
|
|
306
|
+
},
|
|
307
|
+
async exportPrivacyData() {
|
|
308
|
+
const response = await request({
|
|
309
|
+
method: "GET",
|
|
310
|
+
path: "/me/privacy-export"
|
|
311
|
+
});
|
|
312
|
+
if (response.status !== 200) {
|
|
313
|
+
(0, import_errors.handleApiError)(response, "export_privacy_data");
|
|
314
|
+
}
|
|
315
|
+
return response.body;
|
|
316
|
+
},
|
|
317
|
+
async deleteAccount(deleteRequest) {
|
|
318
|
+
const response = await request({
|
|
319
|
+
method: "DELETE",
|
|
320
|
+
path: "/me",
|
|
321
|
+
body: deleteRequest
|
|
322
|
+
});
|
|
323
|
+
if (response.status !== 200) {
|
|
324
|
+
(0, import_errors.handleApiError)(response, "delete_account");
|
|
325
|
+
}
|
|
326
|
+
return response.body;
|
|
327
|
+
},
|
|
328
|
+
async upgradeToCreator() {
|
|
329
|
+
const response = await request({
|
|
330
|
+
method: "POST",
|
|
331
|
+
path: "/me/upgrade-to-creator"
|
|
332
|
+
});
|
|
333
|
+
if (response.status !== 200) {
|
|
334
|
+
(0, import_errors.handleApiError)(response, "upgrade_to_creator");
|
|
335
|
+
}
|
|
336
|
+
return response.body;
|
|
337
|
+
},
|
|
338
|
+
async fetchUserById(userId) {
|
|
339
|
+
if (!Number.isFinite(userId) || userId <= 0) {
|
|
340
|
+
throw new Error("invalid_user_id");
|
|
341
|
+
}
|
|
342
|
+
const response = await request({
|
|
343
|
+
method: "GET",
|
|
344
|
+
path: `/users/${encodeURIComponent(String(userId))}`
|
|
345
|
+
});
|
|
346
|
+
if (response.status !== 200) {
|
|
347
|
+
(0, import_errors.handleApiError)(response, "fetch_user_by_id");
|
|
348
|
+
}
|
|
349
|
+
return response.body;
|
|
350
|
+
},
|
|
351
|
+
async fetchUserByUsername(username) {
|
|
352
|
+
const trimmed = typeof username === "string" ? username.trim() : "";
|
|
353
|
+
if (!trimmed) {
|
|
354
|
+
throw new Error("invalid_username");
|
|
355
|
+
}
|
|
356
|
+
const response = await request({
|
|
357
|
+
method: "GET",
|
|
358
|
+
path: `/users/by-username/${encodeURIComponent(trimmed)}`
|
|
359
|
+
});
|
|
360
|
+
if (response.status !== 200) {
|
|
361
|
+
(0, import_errors.handleApiError)(response, "fetch_user_by_username");
|
|
362
|
+
}
|
|
363
|
+
return response.body;
|
|
364
|
+
},
|
|
365
|
+
async fetchOwnedProfileAssets() {
|
|
366
|
+
const response = await request({
|
|
367
|
+
method: "GET",
|
|
368
|
+
path: "/me/profile-assets"
|
|
369
|
+
});
|
|
370
|
+
if (response.status !== 200) {
|
|
371
|
+
(0, import_errors.handleApiError)(response, "fetch_owned_profile_assets");
|
|
372
|
+
}
|
|
373
|
+
return response.body;
|
|
374
|
+
},
|
|
375
|
+
async saveItem(kind, creatorUsername, itemName) {
|
|
376
|
+
const normalizedKind = normalizeSavedItemKindInput(kind);
|
|
377
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
378
|
+
const name = normalizeCreatorItemSlug(itemName, "name");
|
|
379
|
+
const response = await request({
|
|
380
|
+
method: "PUT",
|
|
381
|
+
path: `/me/saved-items/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`
|
|
382
|
+
});
|
|
383
|
+
if (response.status !== 200) {
|
|
384
|
+
(0, import_errors.handleApiError)(response, "save_item");
|
|
385
|
+
}
|
|
386
|
+
return response.body;
|
|
387
|
+
},
|
|
388
|
+
async unsaveItem(kind, creatorUsername, itemName) {
|
|
389
|
+
const normalizedKind = normalizeSavedItemKindInput(kind);
|
|
390
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
391
|
+
const name = normalizeCreatorItemSlug(itemName, "name");
|
|
392
|
+
const response = await request({
|
|
393
|
+
method: "DELETE",
|
|
394
|
+
path: `/me/saved-items/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`
|
|
395
|
+
});
|
|
396
|
+
if (response.status !== 200) {
|
|
397
|
+
(0, import_errors.handleApiError)(response, "unsave_item");
|
|
398
|
+
}
|
|
399
|
+
return response.body;
|
|
400
|
+
},
|
|
401
|
+
async likeItem(kind, creatorUsername, itemName) {
|
|
402
|
+
const normalizedKind = normalizeSavedItemKindInput(kind);
|
|
403
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
404
|
+
const name = normalizeCreatorItemSlug(itemName, "name");
|
|
405
|
+
const response = await request({
|
|
406
|
+
method: "PUT",
|
|
407
|
+
path: `/me/likes/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`
|
|
408
|
+
});
|
|
409
|
+
if (response.status !== 200) {
|
|
410
|
+
(0, import_errors.handleApiError)(response, "like_item");
|
|
411
|
+
}
|
|
412
|
+
return response.body;
|
|
413
|
+
},
|
|
414
|
+
async unlikeItem(kind, creatorUsername, itemName) {
|
|
415
|
+
const normalizedKind = normalizeSavedItemKindInput(kind);
|
|
416
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
417
|
+
const name = normalizeCreatorItemSlug(itemName, "name");
|
|
418
|
+
const response = await request({
|
|
419
|
+
method: "DELETE",
|
|
420
|
+
path: `/me/likes/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`
|
|
421
|
+
});
|
|
422
|
+
if (response.status !== 200) {
|
|
423
|
+
(0, import_errors.handleApiError)(response, "unlike_item");
|
|
424
|
+
}
|
|
425
|
+
return response.body;
|
|
426
|
+
},
|
|
427
|
+
async dislikeItem(kind, creatorUsername, itemName) {
|
|
428
|
+
const normalizedKind = normalizeSavedItemKindInput(kind);
|
|
429
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
430
|
+
const name = normalizeCreatorItemSlug(itemName, "name");
|
|
431
|
+
const response = await request({
|
|
432
|
+
method: "PUT",
|
|
433
|
+
path: `/me/dislikes/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`
|
|
434
|
+
});
|
|
435
|
+
if (response.status !== 200) {
|
|
436
|
+
(0, import_errors.handleApiError)(response, "dislike_item");
|
|
437
|
+
}
|
|
438
|
+
return response.body;
|
|
439
|
+
},
|
|
440
|
+
async undislikeItem(kind, creatorUsername, itemName) {
|
|
441
|
+
const normalizedKind = normalizeSavedItemKindInput(kind);
|
|
442
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
443
|
+
const name = normalizeCreatorItemSlug(itemName, "name");
|
|
444
|
+
const response = await request({
|
|
445
|
+
method: "DELETE",
|
|
446
|
+
path: `/me/dislikes/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`
|
|
447
|
+
});
|
|
448
|
+
if (response.status !== 200) {
|
|
449
|
+
(0, import_errors.handleApiError)(response, "undislike_item");
|
|
450
|
+
}
|
|
451
|
+
return response.body;
|
|
452
|
+
},
|
|
453
|
+
async reportContent(kind, creatorUsername, itemName, requestBody) {
|
|
454
|
+
const normalizedKind = normalizeSavedItemKindInput(kind);
|
|
455
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
456
|
+
const name = normalizeCreatorItemSlug(itemName, "name");
|
|
457
|
+
const response = await request({
|
|
458
|
+
method: "POST",
|
|
459
|
+
path: `/me/reports/content/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`,
|
|
460
|
+
body: requestBody
|
|
461
|
+
});
|
|
462
|
+
if (response.status !== 200) {
|
|
463
|
+
(0, import_errors.handleApiError)(response, "report_content");
|
|
464
|
+
}
|
|
465
|
+
return response.body;
|
|
466
|
+
},
|
|
467
|
+
async reportCreator(creatorUsername, requestBody) {
|
|
468
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
469
|
+
const response = await request({
|
|
470
|
+
method: "POST",
|
|
471
|
+
path: `/me/reports/creators/${encodeURIComponent(creator)}`,
|
|
472
|
+
body: requestBody
|
|
473
|
+
});
|
|
474
|
+
if (response.status !== 200) {
|
|
475
|
+
(0, import_errors.handleApiError)(response, "report_creator");
|
|
476
|
+
}
|
|
477
|
+
return response.body;
|
|
478
|
+
},
|
|
479
|
+
async trackEngagementEvent(payload) {
|
|
480
|
+
const eventType = normalizeEngagementEventTypeInput(payload.eventType);
|
|
481
|
+
const targetKind = normalizeEngagementTargetKindInput(payload.targetKind);
|
|
482
|
+
const creatorUsername = normalizeCreatorItemSlug(payload.creatorUsername, "creator");
|
|
483
|
+
const itemName = payload.itemName === void 0 ? void 0 : normalizeCreatorItemSlug(payload.itemName, "name");
|
|
484
|
+
const launchContext = import_types.APP_LAUNCH_CONTEXT_VALUES.includes(payload.launchContext) ? payload.launchContext : void 0;
|
|
485
|
+
const response = await request({
|
|
486
|
+
method: "POST",
|
|
487
|
+
path: "/engagement-events",
|
|
488
|
+
body: {
|
|
489
|
+
eventType,
|
|
490
|
+
targetKind,
|
|
491
|
+
creatorUsername,
|
|
492
|
+
...itemName !== void 0 ? { itemName } : {},
|
|
493
|
+
...launchContext ? { launchContext } : {}
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
if (response.status !== 200) {
|
|
497
|
+
(0, import_errors.handleApiError)(response, "track_engagement_event");
|
|
498
|
+
}
|
|
499
|
+
return response.body;
|
|
500
|
+
},
|
|
501
|
+
async fetchLibrary(options = {}) {
|
|
502
|
+
const params = new URLSearchParams();
|
|
503
|
+
if (options.category) {
|
|
504
|
+
params.set("category", normalizeLibraryCategoryInput(options.category));
|
|
505
|
+
}
|
|
506
|
+
if (options.sort) {
|
|
507
|
+
params.set("sort", normalizeLibrarySortInput(options.sort));
|
|
508
|
+
}
|
|
509
|
+
const query = params.toString();
|
|
510
|
+
const response = await request({
|
|
511
|
+
method: "GET",
|
|
512
|
+
path: `/me/library${query ? `?${query}` : ""}`
|
|
513
|
+
});
|
|
514
|
+
if (response.status !== 200) {
|
|
515
|
+
(0, import_errors.handleApiError)(response, "fetch_library");
|
|
516
|
+
}
|
|
517
|
+
return response.body;
|
|
518
|
+
},
|
|
519
|
+
async followCreator(creatorUsername) {
|
|
520
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
521
|
+
const response = await request({
|
|
522
|
+
method: "PUT",
|
|
523
|
+
path: `/me/following/${encodeURIComponent(creator)}`
|
|
524
|
+
});
|
|
525
|
+
if (response.status !== 200) {
|
|
526
|
+
(0, import_errors.handleApiError)(response, "follow_creator");
|
|
527
|
+
}
|
|
528
|
+
return response.body;
|
|
529
|
+
},
|
|
530
|
+
async unfollowCreator(creatorUsername) {
|
|
531
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
532
|
+
const response = await request({
|
|
533
|
+
method: "DELETE",
|
|
534
|
+
path: `/me/following/${encodeURIComponent(creator)}`
|
|
535
|
+
});
|
|
536
|
+
if (response.status !== 200) {
|
|
537
|
+
(0, import_errors.handleApiError)(response, "unfollow_creator");
|
|
538
|
+
}
|
|
539
|
+
return response.body;
|
|
540
|
+
},
|
|
541
|
+
async blockCreator(creatorUsername) {
|
|
542
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
543
|
+
const response = await request({
|
|
544
|
+
method: "PUT",
|
|
545
|
+
path: `/me/blocked-creators/${encodeURIComponent(creator)}`
|
|
546
|
+
});
|
|
547
|
+
if (response.status !== 200) {
|
|
548
|
+
(0, import_errors.handleApiError)(response, "block_creator");
|
|
549
|
+
}
|
|
550
|
+
return response.body;
|
|
551
|
+
},
|
|
552
|
+
async unblockCreator(creatorUsername) {
|
|
553
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
554
|
+
const response = await request({
|
|
555
|
+
method: "DELETE",
|
|
556
|
+
path: `/me/blocked-creators/${encodeURIComponent(creator)}`
|
|
557
|
+
});
|
|
558
|
+
if (response.status !== 200) {
|
|
559
|
+
(0, import_errors.handleApiError)(response, "unblock_creator");
|
|
560
|
+
}
|
|
561
|
+
return response.body;
|
|
562
|
+
},
|
|
563
|
+
async fetchFollowingCreators(options = {}) {
|
|
564
|
+
const params = new URLSearchParams();
|
|
565
|
+
if (options.sort) {
|
|
566
|
+
params.set("sort", normalizeFollowingSortInput(options.sort));
|
|
567
|
+
}
|
|
568
|
+
const query = params.toString();
|
|
569
|
+
const response = await request({
|
|
570
|
+
method: "GET",
|
|
571
|
+
path: `/me/following${query ? `?${query}` : ""}`
|
|
572
|
+
});
|
|
573
|
+
if (response.status !== 200) {
|
|
574
|
+
(0, import_errors.handleApiError)(response, "fetch_following_creators");
|
|
575
|
+
}
|
|
576
|
+
return response.body;
|
|
577
|
+
},
|
|
578
|
+
async fetchFollowingFeed(options) {
|
|
579
|
+
const params = new URLSearchParams();
|
|
580
|
+
params.set("section", normalizeFollowingFeedSectionInput(options.section));
|
|
581
|
+
if (options.limit !== void 0) {
|
|
582
|
+
params.set("limit", String(normalizePositiveIntegerInput(options.limit, "invalid_following_feed_limit")));
|
|
583
|
+
}
|
|
584
|
+
const response = await request({
|
|
585
|
+
method: "GET",
|
|
586
|
+
path: `/me/following/feed?${params.toString()}`
|
|
587
|
+
});
|
|
588
|
+
if (response.status !== 200) {
|
|
589
|
+
(0, import_errors.handleApiError)(response, "fetch_following_feed");
|
|
590
|
+
}
|
|
591
|
+
return response.body;
|
|
592
|
+
},
|
|
593
|
+
async fetchNotifications(options = {}) {
|
|
594
|
+
const params = new URLSearchParams();
|
|
595
|
+
if (options.status) {
|
|
596
|
+
params.set("status", normalizeNotificationStatusInput(options.status));
|
|
597
|
+
}
|
|
598
|
+
if (options.limit !== void 0) {
|
|
599
|
+
params.set("limit", String(normalizePositiveIntegerInput(options.limit, "invalid_notification_limit")));
|
|
600
|
+
}
|
|
601
|
+
if (options.offset !== void 0) {
|
|
602
|
+
params.set("offset", String(normalizeNonNegativeIntegerInput(options.offset, "invalid_notification_offset")));
|
|
603
|
+
}
|
|
604
|
+
const query = params.toString();
|
|
605
|
+
const response = await request({
|
|
606
|
+
method: "GET",
|
|
607
|
+
path: `/me/notifications${query ? `?${query}` : ""}`
|
|
608
|
+
});
|
|
609
|
+
if (response.status !== 200) {
|
|
610
|
+
(0, import_errors.handleApiError)(response, "fetch_notifications");
|
|
611
|
+
}
|
|
612
|
+
return response.body;
|
|
613
|
+
},
|
|
614
|
+
async markNotificationRead(notificationId) {
|
|
615
|
+
if (!Number.isInteger(notificationId) || notificationId <= 0) {
|
|
616
|
+
throw new Error("invalid_notification_id");
|
|
617
|
+
}
|
|
618
|
+
const response = await request({
|
|
619
|
+
method: "POST",
|
|
620
|
+
path: `/me/notifications/${encodeURIComponent(String(notificationId))}/read`
|
|
621
|
+
});
|
|
622
|
+
if (response.status !== 200) {
|
|
623
|
+
(0, import_errors.handleApiError)(response, "mark_notification_read");
|
|
624
|
+
}
|
|
625
|
+
return response.body;
|
|
626
|
+
},
|
|
627
|
+
async markAllNotificationsRead() {
|
|
628
|
+
const response = await request({
|
|
629
|
+
method: "POST",
|
|
630
|
+
path: "/me/notifications/read-all"
|
|
631
|
+
});
|
|
632
|
+
if (response.status !== 200) {
|
|
633
|
+
(0, import_errors.handleApiError)(response, "mark_all_notifications_read");
|
|
634
|
+
}
|
|
635
|
+
return response.body;
|
|
636
|
+
},
|
|
637
|
+
async fetchWebPushConfig() {
|
|
638
|
+
const response = await request({
|
|
639
|
+
method: "GET",
|
|
640
|
+
path: "/me/push/web/config"
|
|
641
|
+
});
|
|
642
|
+
if (response.status !== 200) {
|
|
643
|
+
(0, import_errors.handleApiError)(response, "fetch_web_push_config");
|
|
644
|
+
}
|
|
645
|
+
return response.body;
|
|
646
|
+
},
|
|
647
|
+
async fetchWebPushSubscriptionStatus(requestBody) {
|
|
648
|
+
const response = await request({
|
|
649
|
+
method: "POST",
|
|
650
|
+
path: "/me/push/web/subscription/status",
|
|
651
|
+
body: normalizeWebPushSubscriptionRequest(requestBody)
|
|
652
|
+
});
|
|
653
|
+
if (response.status !== 200) {
|
|
654
|
+
(0, import_errors.handleApiError)(response, "fetch_web_push_subscription_status");
|
|
655
|
+
}
|
|
656
|
+
return response.body;
|
|
657
|
+
},
|
|
658
|
+
async upsertWebPushSubscription(requestBody) {
|
|
659
|
+
const response = await request({
|
|
660
|
+
method: "PUT",
|
|
661
|
+
path: "/me/push/web/subscription",
|
|
662
|
+
body: normalizeWebPushSubscriptionRequest(requestBody)
|
|
663
|
+
});
|
|
664
|
+
if (response.status !== 200) {
|
|
665
|
+
(0, import_errors.handleApiError)(response, "upsert_web_push_subscription");
|
|
666
|
+
}
|
|
667
|
+
return response.body;
|
|
668
|
+
},
|
|
669
|
+
async deleteWebPushSubscription(requestBody) {
|
|
670
|
+
const response = await request({
|
|
671
|
+
method: "DELETE",
|
|
672
|
+
path: "/me/push/web/subscription",
|
|
673
|
+
body: normalizeWebPushSubscriptionRequest(requestBody)
|
|
674
|
+
});
|
|
675
|
+
if (response.status !== 200) {
|
|
676
|
+
(0, import_errors.handleApiError)(response, "delete_web_push_subscription");
|
|
677
|
+
}
|
|
678
|
+
return response.body;
|
|
679
|
+
},
|
|
680
|
+
async fetchApplePushDeviceStatus(requestBody) {
|
|
681
|
+
const response = await request({
|
|
682
|
+
method: "POST",
|
|
683
|
+
path: "/me/push/apple/device/status",
|
|
684
|
+
body: normalizeApplePushDeviceRequest(requestBody)
|
|
685
|
+
});
|
|
686
|
+
if (response.status !== 200) {
|
|
687
|
+
(0, import_errors.handleApiError)(response, "fetch_apple_push_device_status");
|
|
688
|
+
}
|
|
689
|
+
return response.body;
|
|
690
|
+
},
|
|
691
|
+
async upsertApplePushDevice(requestBody) {
|
|
692
|
+
const response = await request({
|
|
693
|
+
method: "PUT",
|
|
694
|
+
path: "/me/push/apple/device",
|
|
695
|
+
body: normalizeApplePushDeviceRequest(requestBody)
|
|
696
|
+
});
|
|
697
|
+
if (response.status !== 200) {
|
|
698
|
+
(0, import_errors.handleApiError)(response, "upsert_apple_push_device");
|
|
699
|
+
}
|
|
700
|
+
return response.body;
|
|
701
|
+
},
|
|
702
|
+
async deleteApplePushDevice(requestBody) {
|
|
703
|
+
const response = await request({
|
|
704
|
+
method: "DELETE",
|
|
705
|
+
path: "/me/push/apple/device",
|
|
706
|
+
body: normalizeApplePushDeviceRequest(requestBody)
|
|
707
|
+
});
|
|
708
|
+
if (response.status !== 200) {
|
|
709
|
+
(0, import_errors.handleApiError)(response, "delete_apple_push_device");
|
|
710
|
+
}
|
|
711
|
+
return response.body;
|
|
712
|
+
},
|
|
713
|
+
...(0, import_search.buildSearchApiClientMethods)({
|
|
714
|
+
request,
|
|
715
|
+
handleApiError: import_errors.handleApiError,
|
|
716
|
+
normalizeSearchModeInput,
|
|
717
|
+
normalizeSearchKindInput,
|
|
718
|
+
normalizeSearchAssetTypeInput,
|
|
719
|
+
normalizePositiveIntegerInput
|
|
720
|
+
}),
|
|
721
|
+
...(0, import_tags.buildTagsApiClientMethods)({
|
|
722
|
+
request,
|
|
723
|
+
handleApiError: import_errors.handleApiError,
|
|
724
|
+
normalizePositiveIntegerInput
|
|
725
|
+
}),
|
|
726
|
+
...(0, import_comments.buildCommentsApiClientMethods)({
|
|
727
|
+
request,
|
|
728
|
+
handleApiError: import_errors.handleApiError,
|
|
729
|
+
normalizeSavedItemKindInput,
|
|
730
|
+
normalizeCreatorItemSlug,
|
|
731
|
+
normalizePositiveIntegerInput
|
|
732
|
+
}),
|
|
733
|
+
...(0, import_apps.buildAppsApiClientMethods)({
|
|
734
|
+
request,
|
|
735
|
+
handleApiError: import_errors.handleApiError,
|
|
736
|
+
fetchImpl,
|
|
737
|
+
includeBrowserCredentials,
|
|
738
|
+
resolveBaseUrl,
|
|
739
|
+
resolveUrl: import_request.resolveUrl,
|
|
740
|
+
parseResponseBody: import_request.parseResponseBody,
|
|
741
|
+
resolveToken,
|
|
742
|
+
getClientHeaders: () => config.clientHeaders ? config.clientHeaders() : {},
|
|
743
|
+
buildCreatorAppMutationPath,
|
|
744
|
+
normalizeCreatorItemSlug,
|
|
745
|
+
normalizeSemverInput,
|
|
746
|
+
parseContentDispositionFilename
|
|
747
|
+
}),
|
|
748
|
+
...(0, import_player_meta.buildPlayerMetaApiClientMethods)({
|
|
749
|
+
request,
|
|
750
|
+
handleApiError: import_errors.handleApiError
|
|
751
|
+
}),
|
|
752
|
+
...(0, import_assets.buildAssetsApiClientMethods)({
|
|
753
|
+
request,
|
|
754
|
+
handleApiError: import_errors.handleApiError,
|
|
755
|
+
fetchImpl,
|
|
756
|
+
includeBrowserCredentials,
|
|
757
|
+
resolveBaseUrl,
|
|
758
|
+
resolveUrl: import_request.resolveUrl,
|
|
759
|
+
parseResponseBody: import_request.parseResponseBody,
|
|
760
|
+
resolveToken,
|
|
761
|
+
getClientHeaders: () => config.clientHeaders ? config.clientHeaders() : {},
|
|
762
|
+
buildCreatorAssetMutationPath,
|
|
763
|
+
normalizeCreatorItemSlug,
|
|
764
|
+
normalizeAssetRevisionInput,
|
|
765
|
+
parseContentDispositionFilename
|
|
766
|
+
}),
|
|
767
|
+
...(0, import_asset_packs.buildAssetPacksApiClientMethods)({
|
|
768
|
+
request,
|
|
769
|
+
handleApiError: import_errors.handleApiError,
|
|
770
|
+
fetchImpl,
|
|
771
|
+
includeBrowserCredentials,
|
|
772
|
+
resolveBaseUrl,
|
|
773
|
+
resolveUrl: import_request.resolveUrl,
|
|
774
|
+
parseResponseBody: import_request.parseResponseBody,
|
|
775
|
+
resolveToken,
|
|
776
|
+
getClientHeaders: () => config.clientHeaders ? config.clientHeaders() : {},
|
|
777
|
+
buildCreatorAssetPackMutationPath,
|
|
778
|
+
normalizeCreatorItemSlug,
|
|
779
|
+
normalizeSemverInput,
|
|
780
|
+
parseContentDispositionFilename
|
|
781
|
+
}),
|
|
782
|
+
...(0, import_me.buildMeApiClientMethods)({ request, handleApiError: import_errors.handleApiError }),
|
|
783
|
+
async batchUpsertGraphRelations(body) {
|
|
784
|
+
const response = await request({
|
|
785
|
+
method: "POST",
|
|
786
|
+
path: "/me/graph/relations:batchUpsert",
|
|
787
|
+
body
|
|
788
|
+
});
|
|
789
|
+
if (response.status !== 200) {
|
|
790
|
+
(0, import_errors.handleApiError)(response, "batch_upsert_graph_relations");
|
|
791
|
+
}
|
|
792
|
+
return response.body;
|
|
793
|
+
},
|
|
794
|
+
async submitFeedback(feedbackRequest) {
|
|
795
|
+
const response = await request({
|
|
796
|
+
method: "POST",
|
|
797
|
+
path: "/feedback",
|
|
798
|
+
body: feedbackRequest
|
|
799
|
+
});
|
|
800
|
+
if (response.status !== 201 && response.status !== 200) {
|
|
801
|
+
(0, import_errors.handleApiError)(response, "submit_feedback");
|
|
802
|
+
}
|
|
803
|
+
return response.body;
|
|
804
|
+
},
|
|
805
|
+
async listFeedback(options = {}) {
|
|
806
|
+
const params = new URLSearchParams();
|
|
807
|
+
if (options.limit !== void 0) {
|
|
808
|
+
params.set("limit", String(options.limit));
|
|
809
|
+
}
|
|
810
|
+
if (options.offset !== void 0) {
|
|
811
|
+
params.set("offset", String(options.offset));
|
|
812
|
+
}
|
|
813
|
+
if (typeof options.source === "string" && options.source.trim().length > 0) {
|
|
814
|
+
params.set("source", options.source.trim());
|
|
815
|
+
}
|
|
816
|
+
if (options.userId !== void 0) {
|
|
817
|
+
params.set("userId", String(options.userId));
|
|
818
|
+
}
|
|
819
|
+
const query = params.toString();
|
|
820
|
+
const path = `/feedback${query ? `?${query}` : ""}`;
|
|
821
|
+
const response = await request({
|
|
822
|
+
method: "GET",
|
|
823
|
+
path
|
|
824
|
+
});
|
|
825
|
+
if (response.status !== 200) {
|
|
826
|
+
(0, import_errors.handleApiError)(response, "list_feedback");
|
|
827
|
+
}
|
|
828
|
+
return response.body;
|
|
829
|
+
},
|
|
830
|
+
async deleteFeedback(id) {
|
|
831
|
+
const response = await request({
|
|
832
|
+
method: "DELETE",
|
|
833
|
+
path: `/feedback/${encodeURIComponent(String(id))}`
|
|
834
|
+
});
|
|
835
|
+
if (response.status !== 200) {
|
|
836
|
+
(0, import_errors.handleApiError)(response, "delete_feedback");
|
|
837
|
+
}
|
|
838
|
+
return response.body;
|
|
839
|
+
},
|
|
840
|
+
async setSelectedProfileAsset(profileAssetRequest) {
|
|
841
|
+
const response = await request({
|
|
842
|
+
method: "POST",
|
|
843
|
+
path: "/me/profile-asset",
|
|
844
|
+
body: profileAssetRequest
|
|
845
|
+
});
|
|
846
|
+
if (response.status !== 200) {
|
|
847
|
+
(0, import_errors.handleApiError)(response, "set_profile_asset");
|
|
848
|
+
}
|
|
849
|
+
return response.body;
|
|
850
|
+
},
|
|
851
|
+
async fetchHome(options = {}) {
|
|
852
|
+
const params = new URLSearchParams();
|
|
853
|
+
if (typeof options.section === "string" && options.section.trim().length > 0) {
|
|
854
|
+
params.set("section", options.section.trim());
|
|
855
|
+
}
|
|
856
|
+
if (typeof options.limit === "number") {
|
|
857
|
+
params.set("limit", String(options.limit));
|
|
858
|
+
}
|
|
859
|
+
if (typeof options.offset === "number") {
|
|
860
|
+
params.set("offset", String(options.offset));
|
|
861
|
+
}
|
|
862
|
+
const query = params.toString();
|
|
863
|
+
const response = await request({
|
|
864
|
+
method: "GET",
|
|
865
|
+
path: `/home${query ? `?${query}` : ""}`
|
|
866
|
+
});
|
|
867
|
+
if (response.status !== 200) {
|
|
868
|
+
(0, import_errors.handleApiError)(response, "fetch_home");
|
|
869
|
+
}
|
|
870
|
+
return response.body;
|
|
871
|
+
},
|
|
872
|
+
async fetchHomeGamesCollectionPage(collectionId, options = {}) {
|
|
873
|
+
const normalizedCollectionId = collectionId.trim();
|
|
874
|
+
if (!normalizedCollectionId) {
|
|
875
|
+
throw new Error("invalid_home_collection_id");
|
|
876
|
+
}
|
|
877
|
+
const params = new URLSearchParams();
|
|
878
|
+
if (typeof options.limit === "number") {
|
|
879
|
+
params.set("limit", String(options.limit));
|
|
880
|
+
}
|
|
881
|
+
if (typeof options.offset === "number") {
|
|
882
|
+
params.set("offset", String(options.offset));
|
|
883
|
+
}
|
|
884
|
+
if (typeof options.auth === "string" && options.auth.trim().length > 0) {
|
|
885
|
+
params.set("auth", options.auth.trim());
|
|
886
|
+
}
|
|
887
|
+
if (typeof options.controller === "string" && options.controller.trim().length > 0) {
|
|
888
|
+
params.set("controller", options.controller.trim());
|
|
889
|
+
}
|
|
890
|
+
if (options.controllerCompatible === true) {
|
|
891
|
+
params.set("controllerCompatible", "1");
|
|
892
|
+
}
|
|
893
|
+
if (typeof options.surface === "string" && options.surface.trim().length > 0) {
|
|
894
|
+
params.set("surface", options.surface.trim());
|
|
895
|
+
}
|
|
896
|
+
const query = params.toString();
|
|
897
|
+
const response = await request({
|
|
898
|
+
method: "GET",
|
|
899
|
+
path: `/home/games/collections/${encodeURIComponent(normalizedCollectionId)}${query ? `?${query}` : ""}`
|
|
900
|
+
});
|
|
901
|
+
if (response.status !== 200) {
|
|
902
|
+
(0, import_errors.handleApiError)(response, "fetch_home_games_collection_page");
|
|
903
|
+
}
|
|
904
|
+
return response.body;
|
|
905
|
+
},
|
|
906
|
+
...(0, import_admin.buildAdminApiClientMethods)({
|
|
907
|
+
request,
|
|
908
|
+
handleApiError: import_errors.handleApiError,
|
|
909
|
+
fetchImpl,
|
|
910
|
+
includeBrowserCredentials,
|
|
911
|
+
resolveBaseUrl,
|
|
912
|
+
resolveUrl: import_request.resolveUrl,
|
|
913
|
+
parseResponseBody: import_request.parseResponseBody,
|
|
914
|
+
resolveToken,
|
|
915
|
+
getClientHeaders: () => config.clientHeaders ? config.clientHeaders() : {}
|
|
916
|
+
}),
|
|
917
|
+
...(0, import_payments.buildPaymentsApiClientMethods)({
|
|
918
|
+
request,
|
|
919
|
+
handleApiError: import_errors.handleApiError,
|
|
920
|
+
buildIapQuery
|
|
921
|
+
}),
|
|
922
|
+
...(0, import_ai.buildAiApiClientMethods)({
|
|
923
|
+
request,
|
|
924
|
+
handleApiError: import_errors.handleApiError
|
|
925
|
+
})
|
|
926
|
+
};
|
|
910
927
|
}
|
|
928
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
929
|
+
0 && (module.exports = {
|
|
930
|
+
createApiClient
|
|
931
|
+
});
|