@playdrop/playdrop-cli 0.3.4-build.1 → 0.3.5-build.1
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/README.md +60 -23
- package/config/client-meta.json +5 -5
- package/dist/apps/upload.js +5 -3
- package/dist/assets/model-artifacts.js +1 -1
- package/dist/catalogue.d.ts +6 -0
- package/dist/catalogue.js +38 -1
- package/dist/commandContext.d.ts +1 -0
- package/dist/commandContext.js +45 -15
- package/dist/commands/browse.d.ts +16 -0
- package/dist/commands/browse.js +370 -0
- package/dist/commands/build.js +4 -9
- package/dist/commands/capture.js +24 -24
- package/dist/commands/captureRemote.d.ts +11 -0
- package/dist/commands/captureRemote.js +90 -0
- package/dist/commands/comments.d.ts +14 -0
- package/dist/commands/comments.js +189 -0
- package/dist/commands/create.js +112 -72
- package/dist/commands/creations.d.ts +49 -0
- package/dist/commands/creations.js +657 -0
- package/dist/commands/credits.d.ts +10 -0
- package/dist/commands/credits.js +91 -0
- package/dist/commands/detail.d.ts +2 -2
- package/dist/commands/detail.js +148 -290
- package/dist/commands/dev.js +24 -24
- package/dist/commands/devShared.js +2 -2
- package/dist/commands/documentation.d.ts +4 -1
- package/dist/commands/documentation.js +79 -104
- package/dist/commands/feedback.d.ts +12 -9
- package/dist/commands/feedback.js +125 -257
- package/dist/commands/format.js +6 -13
- package/dist/commands/generation.d.ts +11 -0
- package/dist/commands/generation.js +204 -42
- package/dist/commands/gettingStarted.d.ts +1 -0
- package/dist/commands/gettingStarted.js +26 -0
- package/dist/commands/init.js +26 -24
- package/dist/commands/login.js +9 -8
- package/dist/commands/logout.js +2 -1
- package/dist/commands/notifications.d.ts +14 -0
- package/dist/commands/notifications.js +179 -0
- package/dist/commands/search.d.ts +13 -0
- package/dist/commands/search.js +198 -0
- package/dist/commands/upload.js +20 -17
- package/dist/commands/validate.js +15 -1
- package/dist/commands/versionsBrowse.d.ts +7 -0
- package/dist/commands/versionsBrowse.js +209 -0
- package/dist/commands/whoami.js +9 -8
- package/dist/errors.d.ts +9 -0
- package/dist/errors.js +52 -0
- package/dist/externalAssetPackValidation.d.ts +2 -0
- package/dist/externalAssetPackValidation.js +115 -0
- package/dist/http.js +1 -1
- package/dist/index.js +570 -630
- package/dist/messages.js +11 -11
- package/dist/output.d.ts +5 -0
- package/dist/output.js +45 -0
- package/dist/playwright.js +1 -1
- package/dist/refs.d.ts +18 -0
- package/dist/refs.js +105 -0
- package/node_modules/@playdrop/ai-client/dist/index.d.ts +42 -15
- package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/ai-client/package.json +1 -0
- package/node_modules/@playdrop/api-client/dist/client.d.ts +39 -27
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/client.js +280 -1669
- package/node_modules/@playdrop/api-client/dist/core/errors.d.ts +9 -0
- package/node_modules/@playdrop/api-client/dist/core/errors.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/core/errors.js +46 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts +27 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/core/request.js +122 -0
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts +75 -0
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/admin.js +282 -0
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts +22 -0
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/ai.js +15 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +60 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.js +301 -0
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts +59 -0
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.js +297 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +62 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.js +297 -0
- package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts +28 -0
- package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/auth.js +78 -0
- package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts +29 -0
- package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/comments.js +65 -0
- package/node_modules/@playdrop/api-client/dist/domains/me.d.ts +24 -0
- package/node_modules/@playdrop/api-client/dist/domains/me.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/me.js +35 -0
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts +37 -0
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/payments.js +148 -0
- package/node_modules/@playdrop/api-client/dist/domains/search.d.ts +27 -0
- package/node_modules/@playdrop/api-client/dist/domains/search.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/search.js +65 -0
- package/node_modules/@playdrop/api-client/dist/index.d.ts +33 -56
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +103 -44
- package/node_modules/@playdrop/api-client/package.json +3 -2
- package/node_modules/@playdrop/boxel-core/package.json +1 -1
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +1 -1
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +1 -1
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +1 -1
- package/node_modules/@playdrop/boxel-three/package.json +2 -1
- package/node_modules/@playdrop/config/client-meta.json +5 -5
- package/node_modules/@playdrop/config/dist/src/constants.d.ts +5 -0
- package/node_modules/@playdrop/config/dist/src/constants.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/constants.js +5 -1
- package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@playdrop/config/package.json +1 -1
- package/node_modules/@playdrop/types/dist/api.d.ts +178 -17
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +30 -1
- package/node_modules/@playdrop/types/dist/app.d.ts +0 -14
- package/node_modules/@playdrop/types/dist/app.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/app.js +0 -10
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts +11 -1
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.d.ts +65 -0
- package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/realtime.d.ts +26 -26
- package/node_modules/@playdrop/types/dist/realtime.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.d.ts +5 -0
- package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
- package/package.json +2 -3
- package/bin/playdrop-cli +0 -2
- package/dist/commands/asset-packs.d.ts +0 -27
- package/dist/commands/asset-packs.js +0 -508
- package/dist/commands/assets.d.ts +0 -35
- package/dist/commands/assets.js +0 -668
- package/dist/commands/list.d.ts +0 -7
- package/dist/commands/list.js +0 -347
- package/dist/commands/migrateCatalogueV2.d.ts +0 -1
- package/dist/commands/migrateCatalogueV2.js +0 -142
- package/dist/commands/versions.d.ts +0 -17
- package/dist/commands/versions.js +0 -384
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { AppAccessTokenResponse, AppDetailResponse, AppLogEntryRequest, AppLogEntryResponse, AppSourceBundleResponse, AppType, AppsListResponse, AppVersionDetailResponse, AppVersionVisibility, AppVersionsListResponse, CreateAppRequest, CreateAppResponse, CreateVersionResponse, DeleteAppResponse, DeleteVersionResponse, RemixScaffoldResponse, UpdateAppRequest, UpdateAppResponse, UpdateVersionResponse } from '@playdrop/types';
|
|
2
|
+
import type { UploadAppVersionOptions } from '../client.js';
|
|
3
|
+
type ApiResponseLike<T> = {
|
|
4
|
+
status: number;
|
|
5
|
+
body: T;
|
|
6
|
+
headers: Headers;
|
|
7
|
+
};
|
|
8
|
+
type RequestExecutor = <T>(input: {
|
|
9
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
10
|
+
path: string;
|
|
11
|
+
body?: unknown;
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
}) => Promise<ApiResponseLike<T>>;
|
|
15
|
+
type ErrorHandler = (response: ApiResponseLike<unknown>, defaultMessage: string) => never;
|
|
16
|
+
type ParseResponseBody = <T>(response: Response) => Promise<T>;
|
|
17
|
+
export declare function buildAppsApiClientMethods(input: {
|
|
18
|
+
request: RequestExecutor;
|
|
19
|
+
handleApiError: ErrorHandler;
|
|
20
|
+
fetchImpl: typeof fetch;
|
|
21
|
+
resolveBaseUrl: () => string;
|
|
22
|
+
resolveUrl: (base: string, path: string) => string;
|
|
23
|
+
parseResponseBody: ParseResponseBody;
|
|
24
|
+
resolveToken: () => Promise<string | null>;
|
|
25
|
+
getClientHeaders: () => Record<string, string>;
|
|
26
|
+
buildCreatorAppMutationPath: (creatorUsername: string, name?: string) => string;
|
|
27
|
+
normalizeCreatorItemSlug: (value: string, field: 'creator' | 'name') => string;
|
|
28
|
+
normalizeSemverInput: (version: string) => string;
|
|
29
|
+
parseContentDispositionFilename: (headerValue: string | null) => string | null;
|
|
30
|
+
}): {
|
|
31
|
+
fetchApps(): Promise<AppsListResponse>;
|
|
32
|
+
fetchAppsByType(type: AppType, options?: {
|
|
33
|
+
limit?: number;
|
|
34
|
+
}): Promise<AppsListResponse>;
|
|
35
|
+
fetchAppsByCreator(creatorUsername: string, options?: {
|
|
36
|
+
limit?: number;
|
|
37
|
+
}): Promise<AppsListResponse>;
|
|
38
|
+
fetchAppBySlug(creatorUsername: string, appName: string): Promise<AppDetailResponse>;
|
|
39
|
+
requestAppAccessToken(appId: number): Promise<AppAccessTokenResponse>;
|
|
40
|
+
sendAppLog(appId: number, entry: AppLogEntryRequest): Promise<AppLogEntryResponse>;
|
|
41
|
+
createApp(creatorUsername: string, createRequest: CreateAppRequest): Promise<CreateAppResponse>;
|
|
42
|
+
updateApp(creatorUsername: string, name: string, updateRequest: UpdateAppRequest): Promise<UpdateAppResponse>;
|
|
43
|
+
uploadAppVersion(creatorUsername: string, appName: string, options: UploadAppVersionOptions): Promise<CreateVersionResponse>;
|
|
44
|
+
listAppVersions(creatorUsername: string, appName: string): Promise<AppVersionsListResponse>;
|
|
45
|
+
getAppVersion(creatorUsername: string, appName: string, version: string): Promise<AppVersionDetailResponse>;
|
|
46
|
+
downloadAppSource(creatorUsername: string, appName: string, version: string): Promise<{
|
|
47
|
+
blob: Blob;
|
|
48
|
+
metadata: AppSourceBundleResponse;
|
|
49
|
+
}>;
|
|
50
|
+
updateAppVersion(creatorUsername: string, appName: string, version: string, updates: {
|
|
51
|
+
releaseNotes?: string | null;
|
|
52
|
+
visibility?: AppVersionVisibility;
|
|
53
|
+
setAsCurrent?: boolean;
|
|
54
|
+
}): Promise<UpdateVersionResponse>;
|
|
55
|
+
deleteAppVersion(creatorUsername: string, appName: string, version: string): Promise<DeleteVersionResponse>;
|
|
56
|
+
deleteApp(creatorUsername: string, name: string): Promise<DeleteAppResponse>;
|
|
57
|
+
fetchRemixScaffold(creatorUsername: string, appName: string): Promise<RemixScaffoldResponse>;
|
|
58
|
+
};
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=apps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/domains/apps.ts"],"names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B,CAAC;qCAgHd,MAAM,WACd,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC;mCAehB,MAAM,WACd,MAAM,WACN,MAAM,GACd,OAAO,CAAC,wBAAwB,CAAC;uCAgBjB,MAAM,WACd,MAAM,WACN,MAAM,GACd,OAAO,CAAC;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,QAAQ,EAAE,uBAAuB,CAAA;KAAE,CAAC;sCAwC1C,MAAM,WACd,MAAM,WACN,MAAM,WACN;QAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,UAAU,CAAC,EAAE,oBAAoB,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,GACnG,OAAO,CAAC,qBAAqB,CAAC;sCAgBd,MAAM,WACd,MAAM,WACN,MAAM,GACd,OAAO,CAAC,qBAAqB,CAAC;+BAcA,MAAM,QAAQ,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;wCAaxC,MAAM,WAAW,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;EAarG"}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
export function buildAppsApiClientMethods(input) {
|
|
2
|
+
const { request, handleApiError, fetchImpl, resolveBaseUrl, resolveUrl, parseResponseBody, resolveToken, getClientHeaders, buildCreatorAppMutationPath, normalizeCreatorItemSlug, normalizeSemverInput, parseContentDispositionFilename, } = input;
|
|
3
|
+
return {
|
|
4
|
+
async fetchApps() {
|
|
5
|
+
const response = await request({
|
|
6
|
+
method: 'GET',
|
|
7
|
+
path: '/apps',
|
|
8
|
+
});
|
|
9
|
+
if (response.status !== 200) {
|
|
10
|
+
handleApiError(response, 'fetch_apps');
|
|
11
|
+
}
|
|
12
|
+
return response.body;
|
|
13
|
+
},
|
|
14
|
+
async fetchAppsByType(type, options = {}) {
|
|
15
|
+
const params = new URLSearchParams();
|
|
16
|
+
if (typeof options.limit === 'number' && Number.isFinite(options.limit)) {
|
|
17
|
+
params.set('limit', String(options.limit));
|
|
18
|
+
}
|
|
19
|
+
const query = params.toString();
|
|
20
|
+
const response = await request({
|
|
21
|
+
method: 'GET',
|
|
22
|
+
path: `/apps/types/${encodeURIComponent(type)}` + (query ? `?${query}` : ''),
|
|
23
|
+
});
|
|
24
|
+
if (response.status !== 200) {
|
|
25
|
+
handleApiError(response, 'fetch_apps_by_type');
|
|
26
|
+
}
|
|
27
|
+
return response.body;
|
|
28
|
+
},
|
|
29
|
+
async fetchAppsByCreator(creatorUsername, options = {}) {
|
|
30
|
+
const normalizedCreator = creatorUsername.trim();
|
|
31
|
+
const params = new URLSearchParams();
|
|
32
|
+
if (typeof options.limit === 'number' && Number.isFinite(options.limit)) {
|
|
33
|
+
params.set('limit', String(options.limit));
|
|
34
|
+
}
|
|
35
|
+
const query = params.toString();
|
|
36
|
+
const response = await request({
|
|
37
|
+
method: 'GET',
|
|
38
|
+
path: `/creators/${encodeURIComponent(normalizedCreator)}/apps` + (query ? `?${query}` : ''),
|
|
39
|
+
});
|
|
40
|
+
if (response.status !== 200) {
|
|
41
|
+
handleApiError(response, 'fetch_apps_by_creator');
|
|
42
|
+
}
|
|
43
|
+
return response.body;
|
|
44
|
+
},
|
|
45
|
+
async fetchAppBySlug(creatorUsername, appName) {
|
|
46
|
+
const response = await request({
|
|
47
|
+
method: 'GET',
|
|
48
|
+
path: `/apps/${encodeURIComponent(creatorUsername)}/${encodeURIComponent(appName)}`,
|
|
49
|
+
});
|
|
50
|
+
if (response.status !== 200) {
|
|
51
|
+
handleApiError(response, 'fetch_app');
|
|
52
|
+
}
|
|
53
|
+
return response.body;
|
|
54
|
+
},
|
|
55
|
+
async requestAppAccessToken(appId) {
|
|
56
|
+
const response = await request({
|
|
57
|
+
method: 'POST',
|
|
58
|
+
path: `/apps/${encodeURIComponent(String(appId))}/token`,
|
|
59
|
+
});
|
|
60
|
+
if (response.status !== 200) {
|
|
61
|
+
handleApiError(response, 'request_app_access_token');
|
|
62
|
+
}
|
|
63
|
+
return response.body;
|
|
64
|
+
},
|
|
65
|
+
async sendAppLog(appId, entry) {
|
|
66
|
+
const response = await request({
|
|
67
|
+
method: 'POST',
|
|
68
|
+
path: `/apps/${encodeURIComponent(String(appId))}/logs`,
|
|
69
|
+
body: entry,
|
|
70
|
+
});
|
|
71
|
+
if (response.status !== 200) {
|
|
72
|
+
handleApiError(response, 'send_app_log');
|
|
73
|
+
}
|
|
74
|
+
return response.body;
|
|
75
|
+
},
|
|
76
|
+
async createApp(creatorUsername, createRequest) {
|
|
77
|
+
const response = await request({
|
|
78
|
+
method: 'POST',
|
|
79
|
+
path: buildCreatorAppMutationPath(creatorUsername),
|
|
80
|
+
body: createRequest,
|
|
81
|
+
});
|
|
82
|
+
if (response.status !== 200) {
|
|
83
|
+
handleApiError(response, 'create_app');
|
|
84
|
+
}
|
|
85
|
+
return response.body;
|
|
86
|
+
},
|
|
87
|
+
async updateApp(creatorUsername, name, updateRequest) {
|
|
88
|
+
const response = await request({
|
|
89
|
+
method: 'PATCH',
|
|
90
|
+
path: buildCreatorAppMutationPath(creatorUsername, name),
|
|
91
|
+
body: updateRequest,
|
|
92
|
+
});
|
|
93
|
+
if (response.status !== 200) {
|
|
94
|
+
handleApiError(response, 'update_app');
|
|
95
|
+
}
|
|
96
|
+
return response.body;
|
|
97
|
+
},
|
|
98
|
+
async uploadAppVersion(creatorUsername, appName, options) {
|
|
99
|
+
const base = resolveBaseUrl();
|
|
100
|
+
const form = new FormData();
|
|
101
|
+
form.append('version', options.version);
|
|
102
|
+
if (options.releaseNotes !== undefined) {
|
|
103
|
+
form.append('releaseNotes', options.releaseNotes);
|
|
104
|
+
}
|
|
105
|
+
if (options.visibility !== undefined) {
|
|
106
|
+
form.append('visibility', options.visibility);
|
|
107
|
+
}
|
|
108
|
+
if (options.surfaceTargets && options.surfaceTargets.length > 0) {
|
|
109
|
+
form.append('surfaceTargets', JSON.stringify(options.surfaceTargets));
|
|
110
|
+
}
|
|
111
|
+
if (options.entryPoint !== undefined) {
|
|
112
|
+
form.append('entryPoint', options.entryPoint);
|
|
113
|
+
}
|
|
114
|
+
if (options.setAsCurrent !== undefined) {
|
|
115
|
+
form.append('setAsCurrent', String(options.setAsCurrent));
|
|
116
|
+
}
|
|
117
|
+
if (options.externalUrl !== undefined) {
|
|
118
|
+
form.append('externalUrl', options.externalUrl);
|
|
119
|
+
}
|
|
120
|
+
if (options.displayName !== undefined) {
|
|
121
|
+
form.append('displayName', options.displayName);
|
|
122
|
+
}
|
|
123
|
+
if (options.description !== undefined) {
|
|
124
|
+
form.append('description', options.description);
|
|
125
|
+
}
|
|
126
|
+
if (options.type !== undefined) {
|
|
127
|
+
form.append('type', options.type);
|
|
128
|
+
}
|
|
129
|
+
if (options.emoji !== undefined) {
|
|
130
|
+
form.append('emoji', options.emoji);
|
|
131
|
+
}
|
|
132
|
+
if (options.color !== undefined) {
|
|
133
|
+
form.append('color', options.color);
|
|
134
|
+
}
|
|
135
|
+
if (options.bundle) {
|
|
136
|
+
form.append('bundle', options.bundle);
|
|
137
|
+
}
|
|
138
|
+
if (options.source) {
|
|
139
|
+
form.append('source', options.source);
|
|
140
|
+
}
|
|
141
|
+
if (options.ecs) {
|
|
142
|
+
form.append('ecs', options.ecs);
|
|
143
|
+
}
|
|
144
|
+
if (options.server) {
|
|
145
|
+
form.append('server', options.server);
|
|
146
|
+
}
|
|
147
|
+
if (options.icon) {
|
|
148
|
+
form.append('icon', options.icon);
|
|
149
|
+
}
|
|
150
|
+
if (options.heroPortrait) {
|
|
151
|
+
form.append('heroPortrait', options.heroPortrait);
|
|
152
|
+
}
|
|
153
|
+
if (options.heroLandscape) {
|
|
154
|
+
form.append('heroLandscape', options.heroLandscape);
|
|
155
|
+
}
|
|
156
|
+
if (options.screenshotsPortrait) {
|
|
157
|
+
for (const screenshot of options.screenshotsPortrait) {
|
|
158
|
+
form.append('screenshotsPortrait', screenshot);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (options.screenshotsLandscape) {
|
|
162
|
+
for (const screenshot of options.screenshotsLandscape) {
|
|
163
|
+
form.append('screenshotsLandscape', screenshot);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (options.videosPortrait) {
|
|
167
|
+
for (const video of options.videosPortrait) {
|
|
168
|
+
form.append('videosPortrait', video);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (options.videosLandscape) {
|
|
172
|
+
for (const video of options.videosLandscape) {
|
|
173
|
+
form.append('videosLandscape', video);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const path = `${buildCreatorAppMutationPath(creatorUsername, appName)}/versions`;
|
|
177
|
+
const headers = new Headers();
|
|
178
|
+
for (const [key, value] of Object.entries(getClientHeaders())) {
|
|
179
|
+
headers.set(key, value);
|
|
180
|
+
}
|
|
181
|
+
const token = await resolveToken();
|
|
182
|
+
if (token) {
|
|
183
|
+
headers.set('authorization', `Bearer ${token}`);
|
|
184
|
+
}
|
|
185
|
+
const response = await fetchImpl(resolveUrl(base, path), {
|
|
186
|
+
method: 'POST',
|
|
187
|
+
headers,
|
|
188
|
+
body: form,
|
|
189
|
+
});
|
|
190
|
+
const parsed = await parseResponseBody(response);
|
|
191
|
+
const apiResponse = { status: response.status, body: parsed, headers: response.headers };
|
|
192
|
+
if (response.status !== 201) {
|
|
193
|
+
handleApiError(apiResponse, 'upload_app_version');
|
|
194
|
+
}
|
|
195
|
+
return parsed;
|
|
196
|
+
},
|
|
197
|
+
async listAppVersions(creatorUsername, appName) {
|
|
198
|
+
const path = `/apps/${encodeURIComponent(creatorUsername)}/${encodeURIComponent(appName)}/versions`;
|
|
199
|
+
const response = await request({
|
|
200
|
+
method: 'GET',
|
|
201
|
+
path,
|
|
202
|
+
});
|
|
203
|
+
if (response.status !== 200) {
|
|
204
|
+
handleApiError(response, 'list_app_versions');
|
|
205
|
+
}
|
|
206
|
+
return response.body;
|
|
207
|
+
},
|
|
208
|
+
async getAppVersion(creatorUsername, appName, version) {
|
|
209
|
+
const normalizedVersion = normalizeSemverInput(version);
|
|
210
|
+
const path = `/apps/${encodeURIComponent(creatorUsername)}/${encodeURIComponent(appName)}/versions/${encodeURIComponent(normalizedVersion)}`;
|
|
211
|
+
const response = await request({
|
|
212
|
+
method: 'GET',
|
|
213
|
+
path,
|
|
214
|
+
});
|
|
215
|
+
if (response.status !== 200) {
|
|
216
|
+
handleApiError(response, 'get_app_version');
|
|
217
|
+
}
|
|
218
|
+
return response.body;
|
|
219
|
+
},
|
|
220
|
+
async downloadAppSource(creatorUsername, appName, version) {
|
|
221
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
|
|
222
|
+
const name = normalizeCreatorItemSlug(appName, 'name');
|
|
223
|
+
const normalizedVersion = normalizeSemverInput(version);
|
|
224
|
+
const path = `/apps/${encodeURIComponent(creator)}/${encodeURIComponent(name)}/versions/${encodeURIComponent(normalizedVersion)}/source`;
|
|
225
|
+
const base = resolveBaseUrl();
|
|
226
|
+
const headers = new Headers();
|
|
227
|
+
for (const [key, value] of Object.entries(getClientHeaders())) {
|
|
228
|
+
headers.set(key, value);
|
|
229
|
+
}
|
|
230
|
+
const token = await resolveToken();
|
|
231
|
+
if (token) {
|
|
232
|
+
headers.set('authorization', `Bearer ${token}`);
|
|
233
|
+
}
|
|
234
|
+
const response = await fetchImpl(resolveUrl(base, path), {
|
|
235
|
+
method: 'GET',
|
|
236
|
+
headers,
|
|
237
|
+
});
|
|
238
|
+
if (!response.ok) {
|
|
239
|
+
const parsed = await parseResponseBody(response);
|
|
240
|
+
handleApiError({ status: response.status, body: parsed, headers: response.headers }, 'download_app_source');
|
|
241
|
+
}
|
|
242
|
+
const blob = await response.blob();
|
|
243
|
+
const filename = parseContentDispositionFilename(response.headers.get('content-disposition'))
|
|
244
|
+
?? `${name}-${normalizedVersion}-source.zip`;
|
|
245
|
+
const headerSize = response.headers.get('content-length');
|
|
246
|
+
const parsedSize = headerSize ? Number.parseInt(headerSize, 10) : Number.NaN;
|
|
247
|
+
const checksumHeader = response.headers.get('x-app-source-checksum');
|
|
248
|
+
return {
|
|
249
|
+
blob,
|
|
250
|
+
metadata: {
|
|
251
|
+
filename,
|
|
252
|
+
sizeBytes: Number.isFinite(parsedSize) && parsedSize >= 0 ? parsedSize : blob.size,
|
|
253
|
+
checksum: checksumHeader ?? null,
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
},
|
|
257
|
+
async updateAppVersion(creatorUsername, appName, version, updates) {
|
|
258
|
+
const path = `${buildCreatorAppMutationPath(creatorUsername, appName)}/versions/${encodeURIComponent(version)}`;
|
|
259
|
+
const response = await request({
|
|
260
|
+
method: 'PATCH',
|
|
261
|
+
path,
|
|
262
|
+
body: updates,
|
|
263
|
+
});
|
|
264
|
+
if (response.status !== 200) {
|
|
265
|
+
handleApiError(response, 'update_app_version');
|
|
266
|
+
}
|
|
267
|
+
return response.body;
|
|
268
|
+
},
|
|
269
|
+
async deleteAppVersion(creatorUsername, appName, version) {
|
|
270
|
+
const path = `${buildCreatorAppMutationPath(creatorUsername, appName)}/versions/${encodeURIComponent(version)}`;
|
|
271
|
+
const response = await request({
|
|
272
|
+
method: 'DELETE',
|
|
273
|
+
path,
|
|
274
|
+
});
|
|
275
|
+
if (response.status !== 200) {
|
|
276
|
+
handleApiError(response, 'delete_app_version');
|
|
277
|
+
}
|
|
278
|
+
return response.body;
|
|
279
|
+
},
|
|
280
|
+
async deleteApp(creatorUsername, name) {
|
|
281
|
+
const response = await request({
|
|
282
|
+
method: 'DELETE',
|
|
283
|
+
path: buildCreatorAppMutationPath(creatorUsername, name),
|
|
284
|
+
});
|
|
285
|
+
if (response.status !== 200) {
|
|
286
|
+
handleApiError(response, 'delete_app');
|
|
287
|
+
}
|
|
288
|
+
return response.body;
|
|
289
|
+
},
|
|
290
|
+
async fetchRemixScaffold(creatorUsername, appName) {
|
|
291
|
+
const response = await request({
|
|
292
|
+
method: 'GET',
|
|
293
|
+
path: `${buildCreatorAppMutationPath(creatorUsername, appName)}/remix`,
|
|
294
|
+
});
|
|
295
|
+
if (response.status !== 200) {
|
|
296
|
+
handleApiError(response, 'fetch_remix_scaffold');
|
|
297
|
+
}
|
|
298
|
+
return response.body;
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { AssetCategory, AssetPackDetailResponse, AssetPackListResponse, AssetPackSourceBundleResponse, AssetPackVersionsListResponse, CreateAssetPackVersionRequest, CreateAssetPackVersionResponse, DeleteAssetPackResponse, DeleteAssetPackVersionResponse, UpdateAssetPackRequest, UpdateAssetPackResponse, UpdateAssetPackVersionRequest, UpdateAssetPackVersionResponse } from '@playdrop/types';
|
|
2
|
+
import type { UploadAssetPackVersionOptions } from '../client.js';
|
|
3
|
+
type ApiResponseLike<T> = {
|
|
4
|
+
status: number;
|
|
5
|
+
body: T;
|
|
6
|
+
headers: Headers;
|
|
7
|
+
};
|
|
8
|
+
type RequestExecutor = <T>(input: {
|
|
9
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
10
|
+
path: string;
|
|
11
|
+
body?: unknown;
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
}) => Promise<ApiResponseLike<T>>;
|
|
15
|
+
type ErrorHandler = (response: ApiResponseLike<unknown>, defaultMessage: string) => never;
|
|
16
|
+
type ParseResponseBody = <T>(response: Response) => Promise<T>;
|
|
17
|
+
export declare function buildAssetPacksApiClientMethods(input: {
|
|
18
|
+
request: RequestExecutor;
|
|
19
|
+
handleApiError: ErrorHandler;
|
|
20
|
+
fetchImpl: typeof fetch;
|
|
21
|
+
resolveBaseUrl: () => string;
|
|
22
|
+
resolveUrl: (base: string, path: string) => string;
|
|
23
|
+
parseResponseBody: ParseResponseBody;
|
|
24
|
+
resolveToken: () => Promise<string | null>;
|
|
25
|
+
getClientHeaders: () => Record<string, string>;
|
|
26
|
+
buildCreatorAssetPackMutationPath: (creatorUsername: string, packName?: string, suffix?: string) => string;
|
|
27
|
+
normalizeSemverInput: (version: string) => string;
|
|
28
|
+
parseContentDispositionFilename: (headerValue: string | null) => string | null;
|
|
29
|
+
}): {
|
|
30
|
+
createAssetPackVersion(creatorUsername: string, name: string, body: CreateAssetPackVersionRequest): Promise<CreateAssetPackVersionResponse>;
|
|
31
|
+
uploadAssetPackVersion(creatorUsername: string, name: string, options: UploadAssetPackVersionOptions): Promise<CreateAssetPackVersionResponse>;
|
|
32
|
+
listAssetPacks(options?: {
|
|
33
|
+
limit?: number;
|
|
34
|
+
offset?: number;
|
|
35
|
+
containsCategory?: AssetCategory;
|
|
36
|
+
containsSubcategory?: string;
|
|
37
|
+
}): Promise<AssetPackListResponse>;
|
|
38
|
+
listAssetPacksForCreator(creatorUsername: string, options?: {
|
|
39
|
+
limit?: number;
|
|
40
|
+
offset?: number;
|
|
41
|
+
containsCategory?: AssetCategory;
|
|
42
|
+
containsSubcategory?: string;
|
|
43
|
+
}): Promise<AssetPackListResponse>;
|
|
44
|
+
fetchAssetPackBySlug(creatorUsername: string, packName: string): Promise<AssetPackDetailResponse>;
|
|
45
|
+
downloadAssetPackSource(creatorUsername: string, packName: string, version: string): Promise<{
|
|
46
|
+
blob: Blob;
|
|
47
|
+
metadata: AssetPackSourceBundleResponse;
|
|
48
|
+
}>;
|
|
49
|
+
listAssetPackVersions(creatorUsername: string, packName: string, options?: {
|
|
50
|
+
limit?: number;
|
|
51
|
+
offset?: number;
|
|
52
|
+
}): Promise<AssetPackVersionsListResponse>;
|
|
53
|
+
updateAssetPack(creatorUsername: string, name: string, requestBody: UpdateAssetPackRequest): Promise<UpdateAssetPackResponse>;
|
|
54
|
+
updateAssetPackVersion(creatorUsername: string, name: string, version: string, requestBody: UpdateAssetPackVersionRequest): Promise<UpdateAssetPackVersionResponse>;
|
|
55
|
+
deleteAssetPackVersion(creatorUsername: string, name: string, version: string): Promise<DeleteAssetPackVersionResponse>;
|
|
56
|
+
deleteAssetPack(creatorUsername: string, name: string): Promise<DeleteAssetPackResponse>;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=asset-packs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-packs.d.ts","sourceRoot":"","sources":["../../src/domains/asset-packs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,uBAAuB,EACvB,qBAAqB,EACrB,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,EAC7B,8BAA8B,EAC9B,uBAAuB,EACvB,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,EACvB,6BAA6B,EAC7B,8BAA8B,EAC/B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAElE,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,eAAe,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE;IAChC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;AAElC,KAAK,YAAY,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,cAAc,EAAE,MAAM,KAAK,KAAK,CAAC;AAE1F,KAAK,iBAAiB,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAE/D,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IAC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