@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,123 +1,149 @@
|
|
|
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 player_meta_exports = {};
|
|
19
|
+
__export(player_meta_exports, {
|
|
20
|
+
buildPlayerMetaApiClientMethods: () => buildPlayerMetaApiClientMethods
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(player_meta_exports);
|
|
1
23
|
function appendBooleanQuery(params, key, value) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
24
|
+
if (value === true) {
|
|
25
|
+
params.set(key, "true");
|
|
26
|
+
}
|
|
5
27
|
}
|
|
6
28
|
function appendIntegerQuery(params, key, value) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
29
|
+
if (Number.isInteger(value) && Number(value) >= 0) {
|
|
30
|
+
params.set(key, String(value));
|
|
31
|
+
}
|
|
10
32
|
}
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
33
|
+
function buildPlayerMetaApiClientMethods(input) {
|
|
34
|
+
const { request, handleApiError } = input;
|
|
35
|
+
return {
|
|
36
|
+
async listAchievements(appId, options = {}) {
|
|
37
|
+
const params = new URLSearchParams();
|
|
38
|
+
appendBooleanQuery(params, "includeHiddenDefinitions", options.includeHiddenDefinitions);
|
|
39
|
+
appendBooleanQuery(params, "includeRetired", options.includeRetired);
|
|
40
|
+
const query = params.toString();
|
|
41
|
+
const response = await request({
|
|
42
|
+
method: "GET",
|
|
43
|
+
path: `/v1/apps/${encodeURIComponent(String(appId))}/achievements${query ? `?${query}` : ""}`
|
|
44
|
+
});
|
|
45
|
+
if (response.status !== 200) {
|
|
46
|
+
handleApiError(response, "list_achievements");
|
|
47
|
+
}
|
|
48
|
+
return response.body;
|
|
49
|
+
},
|
|
50
|
+
async getAchievement(appId, key, options = {}) {
|
|
51
|
+
const params = new URLSearchParams();
|
|
52
|
+
appendBooleanQuery(params, "includeHiddenDefinitions", options.includeHiddenDefinitions);
|
|
53
|
+
appendBooleanQuery(params, "includeRetired", options.includeRetired);
|
|
54
|
+
const query = params.toString();
|
|
55
|
+
const response = await request({
|
|
56
|
+
method: "GET",
|
|
57
|
+
path: `/v1/apps/${encodeURIComponent(String(appId))}/achievements/${encodeURIComponent(key)}${query ? `?${query}` : ""}`
|
|
58
|
+
});
|
|
59
|
+
if (response.status !== 200) {
|
|
60
|
+
handleApiError(response, "get_achievement");
|
|
61
|
+
}
|
|
62
|
+
return response.body;
|
|
63
|
+
},
|
|
64
|
+
async unlockAchievement(appId, key) {
|
|
65
|
+
const response = await request({
|
|
66
|
+
method: "POST",
|
|
67
|
+
path: `/v1/apps/${encodeURIComponent(String(appId))}/achievements/${encodeURIComponent(key)}/unlock`
|
|
68
|
+
});
|
|
69
|
+
if (response.status !== 200) {
|
|
70
|
+
handleApiError(response, "unlock_achievement");
|
|
71
|
+
}
|
|
72
|
+
return response.body;
|
|
73
|
+
},
|
|
74
|
+
async setAchievementProgressAtLeast(appId, key, payload) {
|
|
75
|
+
const response = await request({
|
|
76
|
+
method: "PUT",
|
|
77
|
+
path: `/v1/apps/${encodeURIComponent(String(appId))}/achievements/${encodeURIComponent(key)}/progress`,
|
|
78
|
+
body: payload
|
|
79
|
+
});
|
|
80
|
+
if (response.status !== 200) {
|
|
81
|
+
handleApiError(response, "set_achievement_progress");
|
|
82
|
+
}
|
|
83
|
+
return response.body;
|
|
84
|
+
},
|
|
85
|
+
async listLeaderboards(appId, options = {}) {
|
|
86
|
+
const params = new URLSearchParams();
|
|
87
|
+
appendBooleanQuery(params, "includeRetired", options.includeRetired);
|
|
88
|
+
const query = params.toString();
|
|
89
|
+
const response = await request({
|
|
90
|
+
method: "GET",
|
|
91
|
+
path: `/v1/apps/${encodeURIComponent(String(appId))}/leaderboards${query ? `?${query}` : ""}`
|
|
92
|
+
});
|
|
93
|
+
if (response.status !== 200) {
|
|
94
|
+
handleApiError(response, "list_leaderboards");
|
|
95
|
+
}
|
|
96
|
+
return response.body;
|
|
97
|
+
},
|
|
98
|
+
async getLeaderboard(appId, key, options = {}) {
|
|
99
|
+
const params = new URLSearchParams();
|
|
100
|
+
appendIntegerQuery(params, "top", options.top);
|
|
101
|
+
appendIntegerQuery(params, "aroundMe", options.aroundMe);
|
|
102
|
+
appendBooleanQuery(params, "includeRetired", options.includeRetired);
|
|
103
|
+
const query = params.toString();
|
|
104
|
+
const response = await request({
|
|
105
|
+
method: "GET",
|
|
106
|
+
path: `/v1/apps/${encodeURIComponent(String(appId))}/leaderboards/${encodeURIComponent(key)}${query ? `?${query}` : ""}`
|
|
107
|
+
});
|
|
108
|
+
if (response.status !== 200) {
|
|
109
|
+
handleApiError(response, "get_leaderboard");
|
|
110
|
+
}
|
|
111
|
+
return response.body;
|
|
112
|
+
},
|
|
113
|
+
async submitLeaderboardScore(appId, key, payload) {
|
|
114
|
+
const response = await request({
|
|
115
|
+
method: "POST",
|
|
116
|
+
path: `/v1/apps/${encodeURIComponent(String(appId))}/leaderboards/${encodeURIComponent(key)}/submissions`,
|
|
117
|
+
body: payload
|
|
118
|
+
});
|
|
119
|
+
if (response.status !== 200) {
|
|
120
|
+
handleApiError(response, "submit_leaderboard_score");
|
|
121
|
+
}
|
|
122
|
+
return response.body;
|
|
123
|
+
},
|
|
124
|
+
async fetchMyAchievements() {
|
|
125
|
+
const response = await request({
|
|
126
|
+
method: "GET",
|
|
127
|
+
path: "/v1/me/achievements"
|
|
128
|
+
});
|
|
129
|
+
if (response.status !== 200) {
|
|
130
|
+
handleApiError(response, "fetch_my_achievements");
|
|
131
|
+
}
|
|
132
|
+
return response.body;
|
|
133
|
+
},
|
|
134
|
+
async fetchMyLeaderboards() {
|
|
135
|
+
const response = await request({
|
|
136
|
+
method: "GET",
|
|
137
|
+
path: "/v1/me/leaderboards"
|
|
138
|
+
});
|
|
139
|
+
if (response.status !== 200) {
|
|
140
|
+
handleApiError(response, "fetch_my_leaderboards");
|
|
141
|
+
}
|
|
142
|
+
return response.body;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
123
145
|
}
|
|
146
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
+
0 && (module.exports = {
|
|
148
|
+
buildPlayerMetaApiClientMethods
|
|
149
|
+
});
|
|
@@ -1,115 +1,128 @@
|
|
|
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 search_exports = {};
|
|
19
|
+
__export(search_exports, {
|
|
20
|
+
buildSearchApiClientMethods: () => buildSearchApiClientMethods
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(search_exports);
|
|
1
23
|
function setNormalizedStringParam(params, key, value) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
24
|
+
if (typeof value !== "string") {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const normalized = value.trim();
|
|
28
|
+
if (normalized.length > 0) {
|
|
29
|
+
params.set(key, normalized);
|
|
30
|
+
}
|
|
9
31
|
}
|
|
10
32
|
function setNormalizedPositiveIntegerParam(params, key, value, normalizePositiveIntegerInput, errorCode) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
33
|
+
if (value === void 0) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
params.set(key, String(normalizePositiveIntegerInput(value, errorCode)));
|
|
15
37
|
}
|
|
16
38
|
function appendNormalizedTagParams(params, tags) {
|
|
17
|
-
|
|
18
|
-
|
|
39
|
+
if (!Array.isArray(tags)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
for (const tag of tags) {
|
|
43
|
+
if (typeof tag !== "string") {
|
|
44
|
+
continue;
|
|
19
45
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
const normalized = tag.trim();
|
|
25
|
-
if (normalized.length > 0) {
|
|
26
|
-
params.append('tag', normalized);
|
|
27
|
-
}
|
|
46
|
+
const normalized = tag.trim();
|
|
47
|
+
if (normalized.length > 0) {
|
|
48
|
+
params.append("tag", normalized);
|
|
28
49
|
}
|
|
50
|
+
}
|
|
29
51
|
}
|
|
30
52
|
function hasSearchScopeFilters(searchRequest) {
|
|
31
|
-
|
|
32
|
-
|| Array.isArray(searchRequest.tags) && searchRequest.tags.length > 0
|
|
33
|
-
|| searchRequest.appType !== undefined
|
|
34
|
-
|| searchRequest.auth !== undefined
|
|
35
|
-
|| searchRequest.controller !== undefined
|
|
36
|
-
|| searchRequest.surface !== undefined
|
|
37
|
-
|| searchRequest.assetType !== undefined
|
|
38
|
-
|| searchRequest.assetCategory !== undefined
|
|
39
|
-
|| typeof searchRequest.assetSubcategory === 'string'
|
|
40
|
-
|| typeof searchRequest.assetSpec === 'string'
|
|
41
|
-
|| typeof searchRequest.assetSpecOwner === 'string'
|
|
42
|
-
|| typeof searchRequest.assetSpecName === 'string'
|
|
43
|
-
|| searchRequest.packContainsCategory !== undefined
|
|
44
|
-
|| typeof searchRequest.packContainsSubcategory === 'string';
|
|
53
|
+
return typeof searchRequest.creatorUsername === "string" && searchRequest.creatorUsername.trim().length > 0 || Array.isArray(searchRequest.tags) && searchRequest.tags.length > 0 || searchRequest.appType !== void 0 || searchRequest.auth !== void 0 || searchRequest.controller !== void 0 || searchRequest.surface !== void 0 || searchRequest.assetType !== void 0 || searchRequest.assetCategory !== void 0 || typeof searchRequest.assetSubcategory === "string" || typeof searchRequest.assetSpec === "string" || typeof searchRequest.assetSpecOwner === "string" || typeof searchRequest.assetSpecName === "string" || searchRequest.packContainsCategory !== void 0 || typeof searchRequest.packContainsSubcategory === "string";
|
|
45
54
|
}
|
|
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
|
-
|
|
55
|
+
function buildSearchApiClientMethods(input) {
|
|
56
|
+
const { request, handleApiError, normalizeSearchModeInput, normalizeSearchKindInput, normalizeSearchAssetTypeInput, normalizePositiveIntegerInput } = input;
|
|
57
|
+
return {
|
|
58
|
+
async search(searchRequest) {
|
|
59
|
+
const query = typeof searchRequest.q === "string" ? searchRequest.q.trim() : "";
|
|
60
|
+
if (!query && !hasSearchScopeFilters(searchRequest)) {
|
|
61
|
+
throw new Error("invalid_search_query");
|
|
62
|
+
}
|
|
63
|
+
const params = new URLSearchParams();
|
|
64
|
+
if (query) {
|
|
65
|
+
params.set("q", query);
|
|
66
|
+
}
|
|
67
|
+
if (searchRequest.mode) {
|
|
68
|
+
params.set("mode", normalizeSearchModeInput(searchRequest.mode));
|
|
69
|
+
}
|
|
70
|
+
if (searchRequest.kind) {
|
|
71
|
+
params.set("kind", normalizeSearchKindInput(searchRequest.kind));
|
|
72
|
+
}
|
|
73
|
+
if (searchRequest.sort) {
|
|
74
|
+
params.set("sort", searchRequest.sort);
|
|
75
|
+
}
|
|
76
|
+
setNormalizedStringParam(params, "creator", searchRequest.creatorUsername);
|
|
77
|
+
setNormalizedPositiveIntegerParam(params, "page", searchRequest.page, normalizePositiveIntegerInput, "invalid_search_page");
|
|
78
|
+
setNormalizedPositiveIntegerParam(params, "pageSize", searchRequest.pageSize, normalizePositiveIntegerInput, "invalid_search_page_size");
|
|
79
|
+
if (searchRequest.appType) {
|
|
80
|
+
params.set("appType", searchRequest.appType);
|
|
81
|
+
}
|
|
82
|
+
setNormalizedStringParam(params, "auth", searchRequest.auth);
|
|
83
|
+
setNormalizedStringParam(params, "controller", searchRequest.controller);
|
|
84
|
+
setNormalizedStringParam(params, "surface", searchRequest.surface);
|
|
85
|
+
if (searchRequest.assetType) {
|
|
86
|
+
params.set("assetType", normalizeSearchAssetTypeInput(searchRequest.assetType));
|
|
87
|
+
}
|
|
88
|
+
if (searchRequest.assetCategory) {
|
|
89
|
+
params.set("assetCategory", searchRequest.assetCategory);
|
|
90
|
+
}
|
|
91
|
+
setNormalizedStringParam(params, "assetSubcategory", searchRequest.assetSubcategory);
|
|
92
|
+
setNormalizedStringParam(params, "assetSpec", searchRequest.assetSpec);
|
|
93
|
+
setNormalizedStringParam(params, "assetSpecOwner", searchRequest.assetSpecOwner);
|
|
94
|
+
setNormalizedStringParam(params, "assetSpecName", searchRequest.assetSpecName);
|
|
95
|
+
if (searchRequest.packContainsCategory) {
|
|
96
|
+
params.set("packContainsCategory", searchRequest.packContainsCategory);
|
|
97
|
+
}
|
|
98
|
+
setNormalizedStringParam(params, "packContainsSubcategory", searchRequest.packContainsSubcategory);
|
|
99
|
+
appendNormalizedTagParams(params, searchRequest.tags);
|
|
100
|
+
const response = await request({
|
|
101
|
+
method: "GET",
|
|
102
|
+
path: `/search?${params.toString()}`
|
|
103
|
+
});
|
|
104
|
+
if (response.status !== 200) {
|
|
105
|
+
handleApiError(response, "search");
|
|
106
|
+
}
|
|
107
|
+
return response.body;
|
|
108
|
+
},
|
|
109
|
+
async suggestSearch(searchRequest) {
|
|
110
|
+
const query = typeof searchRequest.q === "string" ? searchRequest.q.trim() : "";
|
|
111
|
+
if (!query) {
|
|
112
|
+
throw new Error("invalid_search_query");
|
|
113
|
+
}
|
|
114
|
+
const response = await request({
|
|
115
|
+
method: "GET",
|
|
116
|
+
path: `/search/suggest?q=${encodeURIComponent(query)}`
|
|
117
|
+
});
|
|
118
|
+
if (response.status !== 200) {
|
|
119
|
+
handleApiError(response, "suggest_search");
|
|
120
|
+
}
|
|
121
|
+
return response.body;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
115
124
|
}
|
|
125
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
126
|
+
0 && (module.exports = {
|
|
127
|
+
buildSearchApiClientMethods
|
|
128
|
+
});
|