@playdrop/playdrop-cli 0.5.0 → 0.5.2
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 +7 -7
- package/dist/apps/upload.js +6 -0
- package/dist/clientInfo.js +19 -3
- package/dist/commands/captureRemote.js +33 -0
- package/dist/commands/generation.d.ts +2 -0
- package/dist/commands/generation.js +1 -0
- package/dist/sessionCookie.d.ts +3 -3
- package/dist/sessionCookie.js +15 -0
- package/node_modules/@playdrop/ai-client/package.json +1 -1
- package/node_modules/@playdrop/api-client/package.json +1 -1
- package/node_modules/@playdrop/boxel-core/package.json +1 -1
- package/node_modules/@playdrop/boxel-three/package.json +1 -1
- package/node_modules/@playdrop/config/client-meta.json +7 -7
- package/node_modules/@playdrop/config/package.json +1 -1
- package/node_modules/@playdrop/types/package.json +1 -1
- package/node_modules/@playdrop/vox-three/package.json +1 -1
- package/package.json +1 -1
package/config/client-meta.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.5.
|
|
3
|
-
"build":
|
|
2
|
+
"version": "0.5.1",
|
|
3
|
+
"build": 1,
|
|
4
4
|
"platforms": {
|
|
5
5
|
"ios": {
|
|
6
6
|
"minimumVersion": "16.0"
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
},
|
|
27
27
|
"clients": {
|
|
28
28
|
"web": {
|
|
29
|
-
"minimumVersion": "0.5.
|
|
30
|
-
"minimumBuild":
|
|
29
|
+
"minimumVersion": "0.5.1",
|
|
30
|
+
"minimumBuild": 1
|
|
31
31
|
},
|
|
32
32
|
"admin": {
|
|
33
|
-
"minimumVersion": "0.5.
|
|
34
|
-
"minimumBuild":
|
|
33
|
+
"minimumVersion": "0.5.1",
|
|
34
|
+
"minimumBuild": 1
|
|
35
35
|
},
|
|
36
36
|
"apple": {
|
|
37
37
|
"minimumVersion": "0.3.10",
|
|
38
38
|
"minimumBuild": 1
|
|
39
39
|
},
|
|
40
40
|
"cli": {
|
|
41
|
-
"minimumVersion": "0.5.
|
|
41
|
+
"minimumVersion": "0.5.1"
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
package/dist/apps/upload.js
CHANGED
|
@@ -151,6 +151,12 @@ async function uploadAppVersion(client, task, artifacts, options) {
|
|
|
151
151
|
}
|
|
152
152
|
if (unknownError instanceof types_1.ApiError) {
|
|
153
153
|
const detail = unknownError.message?.trim();
|
|
154
|
+
if (unknownError.code === 'version_limit_reached') {
|
|
155
|
+
const appRef = `${creatorUsername}/app/${task.name}`;
|
|
156
|
+
throw new Error(`${detail || `App "${task.name}" has reached the maximum version count.`}\n`
|
|
157
|
+
+ `Review versions: playdrop versions browse ${appRef}\n`
|
|
158
|
+
+ `Delete one old version: playdrop creations apps versions delete ${task.name} <version>`);
|
|
159
|
+
}
|
|
154
160
|
// Handle duplicate version error with helpful message
|
|
155
161
|
if (unknownError.status === 409) {
|
|
156
162
|
throw new Error(`Version ${task.version} already exists for app "${task.name}".\n` +
|
package/dist/clientInfo.js
CHANGED
|
@@ -9,7 +9,23 @@ exports.getCliVersion = getCliVersion;
|
|
|
9
9
|
exports.getCliBuild = getCliBuild;
|
|
10
10
|
exports.getRuntimeInfo = getRuntimeInfo;
|
|
11
11
|
const os_1 = __importDefault(require("os"));
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
const fs_1 = require("fs");
|
|
12
14
|
const config_1 = require("@playdrop/config");
|
|
15
|
+
let cachedCliPackageVersion = null;
|
|
16
|
+
function readCliPackageVersion() {
|
|
17
|
+
if (cachedCliPackageVersion) {
|
|
18
|
+
return cachedCliPackageVersion;
|
|
19
|
+
}
|
|
20
|
+
const packageJsonPath = path_1.default.resolve(__dirname, '..', 'package.json');
|
|
21
|
+
const packageJson = JSON.parse((0, fs_1.readFileSync)(packageJsonPath, 'utf8'));
|
|
22
|
+
const version = typeof packageJson.version === 'string' ? packageJson.version.trim() : '';
|
|
23
|
+
if (!/^\d+\.\d+\.\d+$/.test(version)) {
|
|
24
|
+
throw new Error(`invalid_cli_package_version:${version}`);
|
|
25
|
+
}
|
|
26
|
+
cachedCliPackageVersion = version;
|
|
27
|
+
return version;
|
|
28
|
+
}
|
|
13
29
|
function mapPlatform(platform) {
|
|
14
30
|
switch (platform) {
|
|
15
31
|
case 'aix':
|
|
@@ -42,7 +58,7 @@ function detectPlatformVersion() {
|
|
|
42
58
|
function buildRuntimeInfo() {
|
|
43
59
|
return {
|
|
44
60
|
client: 'cli',
|
|
45
|
-
clientVersion: (
|
|
61
|
+
clientVersion: readCliPackageVersion(),
|
|
46
62
|
clientBuild: (0, config_1.getClientBuild)(),
|
|
47
63
|
platform: mapPlatform(os_1.default.platform()),
|
|
48
64
|
platformVersion: detectPlatformVersion()
|
|
@@ -52,10 +68,10 @@ function createClientHeaders() {
|
|
|
52
68
|
return (0, config_1.createClientHeaderRecord)(buildRuntimeInfo());
|
|
53
69
|
}
|
|
54
70
|
function getCliVersionLabel() {
|
|
55
|
-
return (0, config_1.
|
|
71
|
+
return `${readCliPackageVersion()} (build ${(0, config_1.getClientBuild)()})`;
|
|
56
72
|
}
|
|
57
73
|
function getCliVersion() {
|
|
58
|
-
return (
|
|
74
|
+
return readCliPackageVersion();
|
|
59
75
|
}
|
|
60
76
|
function getCliBuild() {
|
|
61
77
|
return (0, config_1.getClientBuild)();
|
|
@@ -9,6 +9,29 @@ const http_1 = require("../http");
|
|
|
9
9
|
const messages_1 = require("../messages");
|
|
10
10
|
const devShared_1 = require("./devShared");
|
|
11
11
|
const captureRuntime_1 = require("../captureRuntime");
|
|
12
|
+
function readUnsupportedPlaydropCaptureMessage(targetUrl) {
|
|
13
|
+
let parsed;
|
|
14
|
+
try {
|
|
15
|
+
parsed = new URL(targetUrl);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const hostname = parsed.hostname.toLowerCase();
|
|
21
|
+
const isPlaydropHost = hostname === 'www.playdrop.ai'
|
|
22
|
+
|| hostname === 'playdrop.ai'
|
|
23
|
+
|| hostname === 'localhost'
|
|
24
|
+
|| hostname === '127.0.0.1';
|
|
25
|
+
if (!isPlaydropHost) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const pathname = parsed.pathname.replace(/\/+$/, '') || '/';
|
|
29
|
+
const matchesCreatorAppRoute = /^\/(?:_auth\/)?creators\/[^/]+\/apps\/[^/]+\/[^/]+(?:\/.*)?$/i.test(pathname);
|
|
30
|
+
if (!matchesCreatorAppRoute || pathname.endsWith('/play')) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return `Only Playdrop /play URLs are supported for remote capture. Use ${parsed.origin}${pathname}/play instead.`;
|
|
34
|
+
}
|
|
12
35
|
function parseTimeout(raw) {
|
|
13
36
|
if (raw === undefined) {
|
|
14
37
|
return 10;
|
|
@@ -70,6 +93,10 @@ function parseOptions(url, options = {}) {
|
|
|
70
93
|
if (expectedUrl) {
|
|
71
94
|
assertValidUrl(expectedUrl, 'invalid_expected_url');
|
|
72
95
|
}
|
|
96
|
+
const unsupportedPlaydropCaptureMessage = readUnsupportedPlaydropCaptureMessage(trimmedUrl);
|
|
97
|
+
if (unsupportedPlaydropCaptureMessage) {
|
|
98
|
+
throw new Error(`unsupported_playdrop_capture_target:${unsupportedPlaydropCaptureMessage}`);
|
|
99
|
+
}
|
|
73
100
|
const { username, password } = parseCredentialPair(options);
|
|
74
101
|
return {
|
|
75
102
|
targetUrl: trimmedUrl,
|
|
@@ -92,6 +119,12 @@ async function captureRemote(url, options = {}) {
|
|
|
92
119
|
parsed = parseOptions(url, options);
|
|
93
120
|
}
|
|
94
121
|
catch (error) {
|
|
122
|
+
if (error instanceof Error && error.message.startsWith('unsupported_playdrop_capture_target:')) {
|
|
123
|
+
const detail = error.message.slice('unsupported_playdrop_capture_target:'.length).trim();
|
|
124
|
+
(0, messages_1.printErrorWithHelp)(detail, [], { command: 'project capture remote' });
|
|
125
|
+
process.exitCode = 1;
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
95
128
|
if (error instanceof Error && error.message === 'invalid_expected_url') {
|
|
96
129
|
(0, messages_1.printErrorWithHelp)('The --expected-url value must be a valid URL.', [], { command: 'project capture remote' });
|
|
97
130
|
process.exitCode = 1;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ImageAttachment } from '@playdrop/ai-client';
|
|
1
2
|
type AiGenerateOptions = {
|
|
2
3
|
subcategory?: string;
|
|
3
4
|
assetName?: string;
|
|
@@ -28,6 +29,7 @@ type AiListOptions = {
|
|
|
28
29
|
offset?: string | number;
|
|
29
30
|
format?: string;
|
|
30
31
|
};
|
|
32
|
+
export declare function resolveImageAttachment(value: string | undefined, optionName: 'image1' | 'image2'): ImageAttachment | undefined;
|
|
31
33
|
export declare function generate(typeInput: string, promptInput: string, options?: AiGenerateOptions): Promise<void>;
|
|
32
34
|
type AiJobBrowseOptions = {
|
|
33
35
|
type?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveImageAttachment = resolveImageAttachment;
|
|
3
4
|
exports.generate = generate;
|
|
4
5
|
exports.browseGenerationJobs = browseGenerationJobs;
|
|
5
6
|
exports.showGenerationJob = showGenerationJob;
|
package/dist/sessionCookie.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export declare function resolveCaptureSessionCookieDomain(hostname: string): string | null;
|
|
2
2
|
export declare function shouldUseSecureCaptureSessionCookie(hostname: string): boolean;
|
|
3
|
-
export declare function buildCaptureAccessTokenCookies(targetUrl: string, accessToken: string): {
|
|
3
|
+
export declare function buildCaptureAccessTokenCookies(targetUrl: string, accessToken: string): ({
|
|
4
4
|
name: string;
|
|
5
5
|
value: string;
|
|
6
6
|
url: string;
|
|
7
7
|
httpOnly: boolean;
|
|
8
8
|
sameSite: "Lax";
|
|
9
9
|
secure: boolean;
|
|
10
|
-
}
|
|
10
|
+
} | {
|
|
11
11
|
name: string;
|
|
12
12
|
value: string;
|
|
13
13
|
domain: string;
|
|
@@ -15,4 +15,4 @@ export declare function buildCaptureAccessTokenCookies(targetUrl: string, access
|
|
|
15
15
|
httpOnly: boolean;
|
|
16
16
|
sameSite: "Lax";
|
|
17
17
|
secure: boolean;
|
|
18
|
-
}[];
|
|
18
|
+
})[];
|
package/dist/sessionCookie.js
CHANGED
|
@@ -59,6 +59,13 @@ function resolveLocalCaptureCookieHosts(hostname) {
|
|
|
59
59
|
function buildOrigin(protocol, hostname, port) {
|
|
60
60
|
return `${protocol}//${hostname}${port ? `:${port}` : ''}`;
|
|
61
61
|
}
|
|
62
|
+
function resolveSharedCaptureCookieHosts(hostname, sharedDomain) {
|
|
63
|
+
return Array.from(new Set([
|
|
64
|
+
hostname,
|
|
65
|
+
`www.${sharedDomain}`,
|
|
66
|
+
`api.${sharedDomain}`,
|
|
67
|
+
]));
|
|
68
|
+
}
|
|
62
69
|
function buildCaptureAccessTokenCookies(targetUrl, accessToken) {
|
|
63
70
|
const parsedUrl = new URL(targetUrl);
|
|
64
71
|
const hostname = normalizeHostname(parsedUrl.hostname);
|
|
@@ -75,6 +82,14 @@ function buildCaptureAccessTokenCookies(targetUrl, accessToken) {
|
|
|
75
82
|
sameSite: 'Lax',
|
|
76
83
|
secure,
|
|
77
84
|
},
|
|
85
|
+
...resolveSharedCaptureCookieHosts(hostname, sharedDomain).map((cookieHostname) => ({
|
|
86
|
+
name: ACCESS_TOKEN_COOKIE_NAME,
|
|
87
|
+
value: accessToken,
|
|
88
|
+
url: buildOrigin(parsedUrl.protocol, cookieHostname, parsedUrl.port),
|
|
89
|
+
httpOnly: true,
|
|
90
|
+
sameSite: 'Lax',
|
|
91
|
+
secure,
|
|
92
|
+
})),
|
|
78
93
|
];
|
|
79
94
|
}
|
|
80
95
|
return resolveLocalCaptureCookieHosts(hostname).map((cookieHostname) => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.5.
|
|
3
|
-
"build":
|
|
2
|
+
"version": "0.5.1",
|
|
3
|
+
"build": 1,
|
|
4
4
|
"platforms": {
|
|
5
5
|
"ios": {
|
|
6
6
|
"minimumVersion": "16.0"
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
},
|
|
27
27
|
"clients": {
|
|
28
28
|
"web": {
|
|
29
|
-
"minimumVersion": "0.5.
|
|
30
|
-
"minimumBuild":
|
|
29
|
+
"minimumVersion": "0.5.1",
|
|
30
|
+
"minimumBuild": 1
|
|
31
31
|
},
|
|
32
32
|
"admin": {
|
|
33
|
-
"minimumVersion": "0.5.
|
|
34
|
-
"minimumBuild":
|
|
33
|
+
"minimumVersion": "0.5.1",
|
|
34
|
+
"minimumBuild": 1
|
|
35
35
|
},
|
|
36
36
|
"apple": {
|
|
37
37
|
"minimumVersion": "0.3.10",
|
|
38
38
|
"minimumBuild": 1
|
|
39
39
|
},
|
|
40
40
|
"cli": {
|
|
41
|
-
"minimumVersion": "0.5.
|
|
41
|
+
"minimumVersion": "0.5.1"
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playdrop/playdrop-cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Official Playdrop CLI for publishing browser games, creator apps, and AI-generated game assets on playdrop.ai",
|
|
5
5
|
"homepage": "https://www.playdrop.ai",
|
|
6
6
|
"repository": {
|