@playdrop/playdrop-cli 0.11.9 → 0.12.0

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.
Files changed (72) hide show
  1. package/config/client-meta.json +2 -2
  2. package/dist/apps/build.js +2 -3
  3. package/dist/apps/index.d.ts +4 -5
  4. package/dist/apps/index.js +14 -16
  5. package/dist/apps/loadCheck.d.ts +76 -0
  6. package/dist/apps/loadCheck.js +874 -0
  7. package/dist/apps/upload.d.ts +3 -2
  8. package/dist/apps/upload.js +110 -6
  9. package/dist/catalogue-utils.d.ts +1 -0
  10. package/dist/catalogue-utils.js +1 -0
  11. package/dist/catalogue.d.ts +2 -0
  12. package/dist/catalogue.js +17 -0
  13. package/dist/commands/build.js +4 -1
  14. package/dist/commands/captureListing.d.ts +30 -1
  15. package/dist/commands/captureListing.js +305 -120
  16. package/dist/commands/check.d.ts +8 -0
  17. package/dist/commands/check.js +188 -0
  18. package/dist/commands/review.d.ts +20 -0
  19. package/dist/commands/review.js +112 -0
  20. package/dist/commands/upload-content.d.ts +1 -1
  21. package/dist/commands/upload.d.ts +2 -1
  22. package/dist/commands/upload.js +9 -52
  23. package/dist/commands/validate.js +0 -155
  24. package/dist/commands/worker/runtime.d.ts +1 -0
  25. package/dist/commands/worker/runtime.js +43 -3
  26. package/dist/commands/worker.d.ts +1 -1
  27. package/dist/commands/worker.js +22 -44
  28. package/dist/index.js +33 -49
  29. package/dist/playwright.d.ts +5 -0
  30. package/dist/playwright.js +60 -1
  31. package/node_modules/@playdrop/api-client/dist/client.d.ts +4 -2
  32. package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
  33. package/node_modules/@playdrop/api-client/dist/client.js +0 -10
  34. package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +2 -1
  35. package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -1
  36. package/node_modules/@playdrop/api-client/dist/domains/apps.js +11 -0
  37. package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts +3 -1
  38. package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts.map +1 -1
  39. package/node_modules/@playdrop/api-client/dist/domains/auth.js +22 -0
  40. package/node_modules/@playdrop/api-client/dist/index.d.ts +4 -3
  41. package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
  42. package/node_modules/@playdrop/api-client/dist/index.js +10 -5
  43. package/node_modules/@playdrop/config/client-meta.json +2 -2
  44. package/node_modules/@playdrop/config/dist/src/client-meta.d.ts +8 -0
  45. package/node_modules/@playdrop/config/dist/src/client-meta.d.ts.map +1 -0
  46. package/node_modules/@playdrop/config/dist/src/client-meta.js +51 -0
  47. package/node_modules/@playdrop/config/dist/src/deployment.d.ts.map +1 -1
  48. package/node_modules/@playdrop/config/dist/src/deployment.js +2 -32
  49. package/node_modules/@playdrop/config/dist/src/index.d.ts.map +1 -1
  50. package/node_modules/@playdrop/config/dist/src/index.js +2 -28
  51. package/node_modules/@playdrop/config/dist/src/runtime-service-origins.d.ts +0 -1
  52. package/node_modules/@playdrop/config/dist/src/runtime-service-origins.d.ts.map +1 -1
  53. package/node_modules/@playdrop/config/dist/src/runtime-service-origins.js +21 -5
  54. package/node_modules/@playdrop/config/dist/test/runtime-service-origins.test.js +8 -0
  55. package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
  56. package/node_modules/@playdrop/types/dist/api.d.ts +19 -14
  57. package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
  58. package/node_modules/@playdrop/types/dist/api.js +5 -10
  59. package/node_modules/@playdrop/types/dist/version.d.ts +14 -0
  60. package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
  61. package/package.json +1 -1
  62. package/dist/apps/launchCheck.d.ts +0 -39
  63. package/dist/apps/launchCheck.js +0 -414
  64. package/dist/captureRuntime.d.ts +0 -73
  65. package/dist/captureRuntime.js +0 -1021
  66. package/dist/commands/capture.d.ts +0 -14
  67. package/dist/commands/capture.js +0 -548
  68. package/dist/commands/captureRemote.d.ts +0 -17
  69. package/dist/commands/captureRemote.js +0 -394
  70. package/node_modules/@playdrop/types/dist/entity.d.ts +0 -31
  71. package/node_modules/@playdrop/types/dist/entity.d.ts.map +0 -1
  72. package/node_modules/@playdrop/types/dist/entity.js +0 -67
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.11.9",
3
- "build": 1,
2
+ "version": "0.12.0",
3
+ "build": 4,
4
4
  "runtimeSdkVersion": "0.10.0",
5
5
  "clients": {
6
6
  "all": {
@@ -222,7 +222,6 @@ function appendIncludedProjectFile(rootDir, includePath, excludedRelativeFiles,
222
222
  const record = {
223
223
  absolutePath,
224
224
  relativePath: normalizedIncludePath,
225
- mtime: stats.mtime,
226
225
  };
227
226
  results.push(record);
228
227
  fileByRelativePath.set(record.relativePath, record);
@@ -278,7 +277,6 @@ function collectProjectFiles(rootDir, rules, options) {
278
277
  const record = {
279
278
  absolutePath,
280
279
  relativePath: relativePath.split('/').join('/'),
281
- mtime: stats.mtime,
282
280
  };
283
281
  results.push(record);
284
282
  fileByRelativePath.set(record.relativePath, record);
@@ -378,6 +376,7 @@ const CRC32_TABLE = (() => {
378
376
  return table;
379
377
  })();
380
378
  const ZIP_REGULAR_FILE_MODE = 0o100644;
379
+ const ZIP_STABLE_TIMESTAMP = new Date(Date.UTC(1980, 0, 1, 0, 0, 0));
381
380
  function crc32(buffer) {
382
381
  let crc = 0 ^ -1;
383
382
  for (let i = 0; i < buffer.length; i += 1) {
@@ -404,7 +403,7 @@ function createZipArchive(entries) {
404
403
  const data = (0, node_fs_1.readFileSync)(entry.absolutePath);
405
404
  const compressed = (0, node_zlib_1.deflateRawSync)(data);
406
405
  const crc = crc32(data);
407
- const { dosDate, dosTime } = toDosDateTime(entry.mtime);
406
+ const { dosDate, dosTime } = toDosDateTime(ZIP_STABLE_TIMESTAMP);
408
407
  const fileNameBuffer = Buffer.from(entry.relativePath, 'utf8');
409
408
  const localHeader = Buffer.alloc(30);
410
409
  let cursor = 0;
@@ -4,7 +4,6 @@ import type { AppTask } from '../catalogue';
4
4
  import { collectAppValidationWarnings, validateAppTask, runFormatScript } from './validate';
5
5
  import { buildApp, type AppBuildArtifacts } from './build';
6
6
  import { uploadApp, type AppUploadResult } from './upload';
7
- import { formatHostedLaunchCheckFailure, runLocalHostedLaunchCheck, runUploadedHostedLaunchCheck, type HostedLaunchCheckResult } from './launchCheck';
8
7
  export type AppPipelineResult = {
9
8
  artifacts: AppBuildArtifacts | null;
10
9
  upload: AppUploadResult;
@@ -18,12 +17,12 @@ export type AppPipelineOptions = {
18
17
  webBase?: string | null;
19
18
  token?: string | null;
20
19
  user?: UserResponse | null;
21
- runLocalLaunchCheck?: boolean;
22
- runStagedUploadLaunchCheck?: boolean;
23
- launchCheckTimeoutMs?: number;
20
+ runLocalLoadCheck?: boolean;
21
+ runStagedUploadLoadCheck?: boolean;
22
+ loadCheckTimeoutMs?: number;
24
23
  ensureRegisteredAppShell?: boolean;
25
24
  agentTaskId?: number;
25
+ mediaCaptureRequired?: boolean;
26
26
  };
27
27
  export declare function runAppPipeline(client: ApiClient, task: AppTask, options?: AppPipelineOptions): Promise<AppPipelineResult>;
28
28
  export { collectAppValidationWarnings, validateAppTask, buildApp, uploadApp, runFormatScript };
29
- export { formatHostedLaunchCheckFailure, runLocalHostedLaunchCheck, runUploadedHostedLaunchCheck, type HostedLaunchCheckResult, };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runUploadedHostedLaunchCheck = exports.runLocalHostedLaunchCheck = exports.formatHostedLaunchCheckFailure = exports.runFormatScript = exports.uploadApp = exports.buildApp = exports.validateAppTask = exports.collectAppValidationWarnings = void 0;
3
+ exports.runFormatScript = exports.uploadApp = exports.buildApp = exports.validateAppTask = exports.collectAppValidationWarnings = void 0;
4
4
  exports.runAppPipeline = runAppPipeline;
5
5
  const validate_1 = require("./validate");
6
6
  Object.defineProperty(exports, "collectAppValidationWarnings", { enumerable: true, get: function () { return validate_1.collectAppValidationWarnings; } });
@@ -10,11 +10,8 @@ const build_1 = require("./build");
10
10
  Object.defineProperty(exports, "buildApp", { enumerable: true, get: function () { return build_1.buildApp; } });
11
11
  const upload_1 = require("./upload");
12
12
  Object.defineProperty(exports, "uploadApp", { enumerable: true, get: function () { return upload_1.uploadApp; } });
13
- const launchCheck_1 = require("./launchCheck");
14
- Object.defineProperty(exports, "formatHostedLaunchCheckFailure", { enumerable: true, get: function () { return launchCheck_1.formatHostedLaunchCheckFailure; } });
15
- Object.defineProperty(exports, "runLocalHostedLaunchCheck", { enumerable: true, get: function () { return launchCheck_1.runLocalHostedLaunchCheck; } });
16
- Object.defineProperty(exports, "runUploadedHostedLaunchCheck", { enumerable: true, get: function () { return launchCheck_1.runUploadedHostedLaunchCheck; } });
17
13
  const registration_1 = require("./registration");
14
+ const loadCheck_1 = require("./loadCheck");
18
15
  async function runAppPipeline(client, task, options) {
19
16
  await (0, validate_1.validateAppTask)(task);
20
17
  // External apps don't need to be built - they're hosted elsewhere
@@ -32,40 +29,41 @@ async function runAppPipeline(client, task, options) {
32
29
  agentTaskId: options.agentTaskId,
33
30
  });
34
31
  }
35
- if (!isExternal && options?.runLocalLaunchCheck) {
32
+ const artifacts = isExternal ? null : await (0, build_1.buildApp)(task);
33
+ const warnings = (0, validate_1.collectAppValidationWarnings)(task, isExternal ? 'source' : 'bundle');
34
+ if (!isExternal && options?.runLocalLoadCheck) {
36
35
  const creatorUsername = typeof options.creatorUsername === 'string' ? options.creatorUsername.trim() : '';
37
36
  if (!creatorUsername) {
38
- throw new Error(`Missing creator username for local hosted launch-check of "${task.name}".`);
37
+ throw new Error(`Missing creator username for local hosted load-check of "${task.name}".`);
39
38
  }
40
39
  const apiBase = typeof options.apiBase === 'string' ? options.apiBase.trim() : '';
41
40
  if (!apiBase) {
42
- throw new Error(`Missing API base URL for local hosted launch-check of "${task.name}".`);
41
+ throw new Error(`Missing API base URL for local hosted load-check of "${task.name}".`);
43
42
  }
44
- const launchCheck = await (0, launchCheck_1.runLocalHostedLaunchCheck)({
43
+ const loadCheck = await (0, loadCheck_1.runLocalHostedLoadCheck)({
45
44
  client,
46
45
  apiBase,
47
46
  webBase: options.webBase,
48
47
  creatorUsername,
49
48
  task,
50
- timeoutMs: options.launchCheckTimeoutMs,
49
+ timeoutMs: options.loadCheckTimeoutMs,
51
50
  token: options.token ?? null,
52
51
  currentUser: options.user ?? null,
53
52
  });
54
- if (launchCheck.status !== 'PASSED') {
55
- throw new Error((0, launchCheck_1.formatHostedLaunchCheckFailure)(task.name, launchCheck, 'local'));
53
+ if (loadCheck.status !== 'PASSED') {
54
+ throw new Error((0, loadCheck_1.formatHostedLoadCheckFailure)(task.name, loadCheck, 'local'));
56
55
  }
57
56
  }
58
- const artifacts = isExternal ? null : await (0, build_1.buildApp)(task);
59
- const warnings = (0, validate_1.collectAppValidationWarnings)(task, isExternal ? 'source' : 'bundle');
60
57
  const uploadOptions = {
61
58
  skipReview: options?.skipReview,
62
59
  clearTags: options?.clearTags,
63
60
  creatorUsername: options?.creatorUsername,
64
61
  token: options?.token,
65
62
  user: options?.user ?? null,
66
- runStagedUploadLaunchCheck: options?.runStagedUploadLaunchCheck,
67
- launchCheckTimeoutMs: options?.launchCheckTimeoutMs,
63
+ runStagedUploadLoadCheck: options?.runStagedUploadLoadCheck,
64
+ loadCheckTimeoutMs: options?.loadCheckTimeoutMs,
68
65
  agentTaskId: options?.agentTaskId,
66
+ mediaCaptureRequired: options?.mediaCaptureRequired,
69
67
  };
70
68
  const upload = await (0, upload_1.uploadApp)(client, task, artifacts, uploadOptions);
71
69
  return { artifacts, upload, warnings };
@@ -0,0 +1,76 @@
1
+ import type { ApiClient } from '@playdrop/api-client';
2
+ import type { UserResponse } from '@playdrop/types';
3
+ import type { Frame, Page } from 'playwright-core';
4
+ import type { AppTask } from '../catalogue';
5
+ export type HostedLoadCheckResult = {
6
+ status: 'PASSED' | 'FAILED';
7
+ errorCode: string | null;
8
+ message: string | null;
9
+ checkedAt: string;
10
+ artifactFingerprint: string | null;
11
+ screenshotPath?: string | null;
12
+ webglRenderer?: string | null;
13
+ targetUrl?: string | null;
14
+ errors?: string[];
15
+ warnings?: string[];
16
+ };
17
+ export type HostedLaunchExpectedState = 'ready' | 'login_required' | 'controller_required' | 'surface_unsupported';
18
+ export type HostedLaunchState = {
19
+ state: 'ready';
20
+ } | {
21
+ state: 'login_required';
22
+ } | {
23
+ state: 'controller_required';
24
+ } | {
25
+ state: 'surface_unsupported';
26
+ } | {
27
+ state: 'error';
28
+ errorCode: string | null;
29
+ message: string | null;
30
+ };
31
+ export type ProjectCheckAction = {
32
+ type: 'click';
33
+ x: number;
34
+ y: number;
35
+ button?: 'left' | 'right' | 'middle';
36
+ } | {
37
+ type: 'press';
38
+ key: string;
39
+ } | {
40
+ type: 'wait';
41
+ ms: number;
42
+ };
43
+ export declare function isSoftwareWebGlRenderer(renderer: string | null | undefined): boolean;
44
+ export declare function normalizeProjectCheckActions(value: unknown): ProjectCheckAction[];
45
+ export declare function focusProjectCheckGameFrame(page: Pick<Page, 'mouse'>, frame: Frame): Promise<{
46
+ x: number;
47
+ y: number;
48
+ width: number;
49
+ height: number;
50
+ }>;
51
+ export declare function dispatchProjectCheckActionsToFrame(page: Page, frame: Frame, actions: readonly ProjectCheckAction[]): Promise<void>;
52
+ export declare function formatHostedLoadCheckFailure(taskName: string, result: HostedLoadCheckResult, scope?: 'local' | 'staged' | 'final'): string;
53
+ export declare function runLocalHostedLoadCheck(input: {
54
+ client: ApiClient;
55
+ apiBase: string;
56
+ webBase: string | null | undefined;
57
+ creatorUsername: string;
58
+ task: AppTask;
59
+ devRouterPort?: number;
60
+ timeoutMs?: number;
61
+ token?: string | null;
62
+ currentUser?: UserResponse | null;
63
+ allowUnregisteredViewerLaunch?: boolean;
64
+ screenshotPath?: string | null;
65
+ actions?: ProjectCheckAction[];
66
+ }): Promise<HostedLoadCheckResult>;
67
+ export declare function runUploadedHostedLoadCheck(input: {
68
+ client: ApiClient;
69
+ creatorUsername: string;
70
+ task: AppTask;
71
+ sessionId: string;
72
+ timeoutMs?: number;
73
+ token?: string | null;
74
+ currentUser?: UserResponse | null;
75
+ screenshotPath?: string | null;
76
+ }): Promise<HostedLoadCheckResult>;