@playdrop/playdrop-cli 0.5.1 → 0.5.3
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/build.js +49 -6
- package/dist/apps/index.d.ts +2 -0
- package/dist/apps/index.js +2 -0
- package/dist/apps/upload.d.ts +2 -0
- package/dist/apps/upload.js +132 -28
- package/dist/assetSpecs.d.ts +16 -0
- package/dist/assetSpecs.js +263 -0
- package/dist/assets/model-artifacts.js +3 -0
- package/dist/catalogue.d.ts +57 -3
- package/dist/catalogue.js +342 -16
- package/dist/clientInfo.js +19 -3
- package/dist/commands/ads.d.ts +8 -0
- package/dist/commands/ads.js +124 -0
- package/dist/commands/boosts.d.ts +25 -0
- package/dist/commands/boosts.js +209 -0
- package/dist/commands/browse.d.ts +6 -1
- package/dist/commands/browse.js +365 -124
- package/dist/commands/captureListing.d.ts +53 -0
- package/dist/commands/captureListing.js +804 -0
- package/dist/commands/captureRemote.js +33 -0
- package/dist/commands/create.d.ts +1 -0
- package/dist/commands/create.js +183 -3
- package/dist/commands/credits.d.ts +6 -0
- package/dist/commands/credits.js +47 -1
- package/dist/commands/detail.js +38 -4
- package/dist/commands/devServer.js +10 -5
- package/dist/commands/generation.d.ts +2 -0
- package/dist/commands/generation.js +1 -0
- package/dist/commands/search.d.ts +5 -0
- package/dist/commands/search.js +139 -17
- package/dist/commands/tags.d.ts +7 -0
- package/dist/commands/tags.js +63 -0
- package/dist/commands/upload-content.d.ts +13 -3
- package/dist/commands/upload-content.js +86 -20
- package/dist/commands/upload.d.ts +2 -0
- package/dist/commands/upload.js +187 -11
- package/dist/commands/validate.js +163 -2
- package/dist/commands/versionsBrowse.js +128 -91
- package/dist/index.js +145 -3
- package/dist/refs.d.ts +2 -2
- package/dist/refs.js +13 -1
- package/dist/taskSelection.js +6 -3
- package/dist/taskUtils.d.ts +2 -2
- package/dist/taskUtils.js +1 -0
- package/dist/uploadLog.d.ts +1 -1
- package/dist/uploadLog.js +2 -2
- package/node_modules/@playdrop/ai-client/package.json +1 -1
- package/node_modules/@playdrop/api-client/dist/client.d.ts +131 -10
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/client.js +6 -0
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts +9 -1
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/admin.js +45 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +3 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/apps.js +27 -0
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts +2 -0
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.js +16 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +44 -2
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/assets.js +260 -3
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts +17 -1
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/payments.js +173 -0
- package/node_modules/@playdrop/api-client/dist/domains/search.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/search.js +39 -11
- package/node_modules/@playdrop/api-client/dist/domains/tags.d.ts +34 -0
- package/node_modules/@playdrop/api-client/dist/domains/tags.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/tags.js +111 -0
- package/node_modules/@playdrop/api-client/dist/index.d.ts +61 -1
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +50 -0
- package/node_modules/@playdrop/api-client/package.json +1 -1
- package/node_modules/@playdrop/boxel-core/dist/test/entity-utils.test.d.ts +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/entity-utils.test.js +92 -0
- package/node_modules/@playdrop/boxel-core/dist/test/entity-utils.test.js.map +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/greedy-mesher.test.d.ts +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/greedy-mesher.test.js +48 -0
- package/node_modules/@playdrop/boxel-core/dist/test/greedy-mesher.test.js.map +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/humanoid/humanoid-builders.test.d.ts +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/humanoid/humanoid-builders.test.js +270 -0
- package/node_modules/@playdrop/boxel-core/dist/test/humanoid/humanoid-builders.test.js.map +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/index.test.d.ts +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/index.test.js +48 -0
- package/node_modules/@playdrop/boxel-core/dist/test/index.test.js.map +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/layer-mode.test.d.ts +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/layer-mode.test.js +67 -0
- package/node_modules/@playdrop/boxel-core/dist/test/layer-mode.test.js.map +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/materials.test.d.ts +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/materials.test.js +55 -0
- package/node_modules/@playdrop/boxel-core/dist/test/materials.test.js.map +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/palette-tools.test.d.ts +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/palette-tools.test.js +124 -0
- package/node_modules/@playdrop/boxel-core/dist/test/palette-tools.test.js.map +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/serialization.test.d.ts +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/serialization.test.js +35 -0
- package/node_modules/@playdrop/boxel-core/dist/test/serialization.test.js.map +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/textures.test.d.ts +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/textures.test.js +120 -0
- package/node_modules/@playdrop/boxel-core/dist/test/textures.test.js.map +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/types.test.d.ts +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/types.test.js +32 -0
- package/node_modules/@playdrop/boxel-core/dist/test/types.test.js.map +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/upscale.test.d.ts +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/upscale.test.js +100 -0
- package/node_modules/@playdrop/boxel-core/dist/test/upscale.test.js.map +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/validation.test.d.ts +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/validation.test.js +61 -0
- package/node_modules/@playdrop/boxel-core/dist/test/validation.test.js.map +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/voxels.test.d.ts +1 -0
- package/node_modules/@playdrop/boxel-core/dist/test/voxels.test.js +51 -0
- package/node_modules/@playdrop/boxel-core/dist/test/voxels.test.js.map +1 -0
- 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/dist/src/constants.d.ts +11 -0
- package/node_modules/@playdrop/config/dist/src/constants.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/constants.js +12 -1
- package/node_modules/@playdrop/config/dist/src/creator-docs.d.ts +24 -0
- package/node_modules/@playdrop/config/dist/src/creator-docs.d.ts.map +1 -0
- package/node_modules/@playdrop/config/dist/src/creator-docs.js +253 -0
- package/node_modules/@playdrop/config/dist/src/creator-faq.d.ts +17 -0
- package/node_modules/@playdrop/config/dist/src/creator-faq.d.ts.map +1 -0
- package/node_modules/@playdrop/config/dist/src/creator-faq.js +141 -0
- package/node_modules/@playdrop/config/dist/test/creator-docs.test.d.ts +2 -0
- package/node_modules/@playdrop/config/dist/test/creator-docs.test.d.ts.map +1 -0
- package/node_modules/@playdrop/config/dist/test/creator-docs.test.js +36 -0
- 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 +346 -6
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +52 -1
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts +7 -1
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset-spec-contract-meta-schema.json +86 -0
- package/node_modules/@playdrop/types/dist/asset-spec.d.ts +163 -0
- package/node_modules/@playdrop/types/dist/asset-spec.d.ts.map +1 -0
- package/node_modules/@playdrop/types/dist/asset-spec.js +101 -0
- package/node_modules/@playdrop/types/dist/asset.d.ts +23 -6
- package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.js +4 -1
- package/node_modules/@playdrop/types/dist/graph.d.ts +4 -2
- package/node_modules/@playdrop/types/dist/graph.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/graph.js +9 -2
- package/node_modules/@playdrop/types/dist/index.d.ts +1 -0
- package/node_modules/@playdrop/types/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/index.js +1 -0
- package/node_modules/@playdrop/types/dist/version.d.ts +13 -0
- package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.js +21 -0
- package/node_modules/@playdrop/types/package.json +6 -1
- package/node_modules/@playdrop/vox-three/package.json +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.showAdsEarnings = showAdsEarnings;
|
|
4
|
+
exports.showAdsReport = showAdsReport;
|
|
5
|
+
const commandContext_1 = require("../commandContext");
|
|
6
|
+
const errors_1 = require("../errors");
|
|
7
|
+
const messages_1 = require("../messages");
|
|
8
|
+
const output_1 = require("../output");
|
|
9
|
+
const refs_1 = require("../refs");
|
|
10
|
+
function parsePositiveInteger(raw, command) {
|
|
11
|
+
if (raw === undefined) {
|
|
12
|
+
return 30;
|
|
13
|
+
}
|
|
14
|
+
const parsed = typeof raw === 'number' ? raw : Number.parseInt(String(raw), 10);
|
|
15
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
16
|
+
(0, messages_1.printErrorWithHelp)('The --days value must be a positive integer.', ['Example: --days 30'], { command });
|
|
17
|
+
process.exitCode = 1;
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return parsed;
|
|
21
|
+
}
|
|
22
|
+
async function resolveOptionalAppId(client, rawAppRef) {
|
|
23
|
+
if (!rawAppRef) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const ref = (0, refs_1.parseContentRef)(rawAppRef);
|
|
27
|
+
if (ref.kind !== 'app') {
|
|
28
|
+
throw new Error('invalid_app_ref');
|
|
29
|
+
}
|
|
30
|
+
const detail = await client.fetchAppBySlug(ref.creator, ref.name);
|
|
31
|
+
return Number(detail.app.id);
|
|
32
|
+
}
|
|
33
|
+
async function showAdsEarnings(options = {}) {
|
|
34
|
+
const days = parsePositiveInteger(options.days, 'ads earnings');
|
|
35
|
+
if (days === null) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
await (0, commandContext_1.withEnvironment)('ads earnings', 'Checking creator ad earnings', async ({ client }) => {
|
|
39
|
+
try {
|
|
40
|
+
const appId = await resolveOptionalAppId(client, options.app);
|
|
41
|
+
const response = await client.fetchCreatorEarnings({
|
|
42
|
+
days,
|
|
43
|
+
...(typeof appId === 'number' && appId > 0 ? { appId } : {}),
|
|
44
|
+
});
|
|
45
|
+
if (options.json) {
|
|
46
|
+
(0, output_1.printJson)(response);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const aggregateRows = new Map();
|
|
50
|
+
for (const day of response.days) {
|
|
51
|
+
for (const row of day.apps) {
|
|
52
|
+
const key = `${row.appId}:${row.format}`;
|
|
53
|
+
const current = aggregateRows.get(key) ?? {
|
|
54
|
+
appName: row.appName,
|
|
55
|
+
format: row.format,
|
|
56
|
+
amount: 0,
|
|
57
|
+
servedCount: 0,
|
|
58
|
+
creditedCount: 0,
|
|
59
|
+
};
|
|
60
|
+
current.amount += row.amount;
|
|
61
|
+
current.servedCount += row.servedCount;
|
|
62
|
+
current.creditedCount += row.creditedCount;
|
|
63
|
+
aggregateRows.set(key, current);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
console.log(`Today provisional: ${response.summary.provisionalToday}`);
|
|
67
|
+
console.log(`Last 7 days settled: ${response.summary.settledLast7Days}`);
|
|
68
|
+
console.log(`Last 30 days settled: ${response.summary.settledLast30Days}`);
|
|
69
|
+
if (aggregateRows.size === 0) {
|
|
70
|
+
console.log('\nNo ad earnings found for the selected window.');
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
console.log('\nBy app and format:\n');
|
|
74
|
+
for (const row of aggregateRows.values()) {
|
|
75
|
+
console.log(`${row.appName} | ${row.format} | earnings ${row.amount} | served ${row.servedCount} | credited ${row.creditedCount}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
const handled = (0, errors_1.handleCommandFailure)(error, 'ads earnings', 'Ad earnings lookup', {
|
|
80
|
+
apiMessage: (apiError) => ({
|
|
81
|
+
problem: `Ad earnings lookup failed with status ${apiError.status}.`,
|
|
82
|
+
suggestions: ['Run "playdrop auth login" and retry.'],
|
|
83
|
+
}),
|
|
84
|
+
});
|
|
85
|
+
if (!handled) {
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
async function showAdsReport(options = {}) {
|
|
92
|
+
const days = parsePositiveInteger(options.days, 'ads report');
|
|
93
|
+
if (days === null) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
await (0, commandContext_1.withEnvironment)('ads report', 'Checking creator ad report', async ({ client }) => {
|
|
97
|
+
try {
|
|
98
|
+
const appId = await resolveOptionalAppId(client, options.app);
|
|
99
|
+
const response = await client.fetchCreatorEarnings({
|
|
100
|
+
days,
|
|
101
|
+
...(typeof appId === 'number' && appId > 0 ? { appId } : {}),
|
|
102
|
+
});
|
|
103
|
+
if (options.json) {
|
|
104
|
+
(0, output_1.printJson)(response);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
console.log('Daily ad report:\n');
|
|
108
|
+
for (const row of response.days) {
|
|
109
|
+
console.log(`${row.dateUtc} | total ${row.totalAmount} | interstitial ${row.interstitialAmount} | rewarded ${row.rewardedAmount} | served ${row.servedCount} | credited ${row.creditedCount}${row.provisional ? ' | provisional' : ''}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
const handled = (0, errors_1.handleCommandFailure)(error, 'ads report', 'Ad report lookup', {
|
|
114
|
+
apiMessage: (apiError) => ({
|
|
115
|
+
problem: `Ad report lookup failed with status ${apiError.status}.`,
|
|
116
|
+
suggestions: ['Run "playdrop auth login" and retry.'],
|
|
117
|
+
}),
|
|
118
|
+
});
|
|
119
|
+
if (!handled) {
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare function showBoostBalance(options?: {
|
|
2
|
+
json?: boolean;
|
|
3
|
+
}): Promise<void>;
|
|
4
|
+
export declare function browseBoostOffers(options?: {
|
|
5
|
+
json?: boolean;
|
|
6
|
+
}): Promise<void>;
|
|
7
|
+
export declare function buyBoostPack(sku: string, options?: {
|
|
8
|
+
quantity?: string | number;
|
|
9
|
+
json?: boolean;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
export declare function activateBoost(rawRef: string, options?: {
|
|
12
|
+
units?: string | number;
|
|
13
|
+
json?: boolean;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
export declare function showBoostStatus(rawRef: string, options?: {
|
|
16
|
+
json?: boolean;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
export declare function showBoostHistory(rawRef: string, options?: {
|
|
19
|
+
limit?: string | number;
|
|
20
|
+
json?: boolean;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
export declare function showBoostReport(rawRef: string, options?: {
|
|
23
|
+
days?: string | number;
|
|
24
|
+
json?: boolean;
|
|
25
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.showBoostBalance = showBoostBalance;
|
|
4
|
+
exports.browseBoostOffers = browseBoostOffers;
|
|
5
|
+
exports.buyBoostPack = buyBoostPack;
|
|
6
|
+
exports.activateBoost = activateBoost;
|
|
7
|
+
exports.showBoostStatus = showBoostStatus;
|
|
8
|
+
exports.showBoostHistory = showBoostHistory;
|
|
9
|
+
exports.showBoostReport = showBoostReport;
|
|
10
|
+
const commandContext_1 = require("../commandContext");
|
|
11
|
+
const errors_1 = require("../errors");
|
|
12
|
+
const messages_1 = require("../messages");
|
|
13
|
+
const output_1 = require("../output");
|
|
14
|
+
const refs_1 = require("../refs");
|
|
15
|
+
function parsePositiveInteger(raw, label, fallback) {
|
|
16
|
+
if (raw === undefined) {
|
|
17
|
+
return fallback;
|
|
18
|
+
}
|
|
19
|
+
const parsed = typeof raw === 'number' ? raw : Number.parseInt(String(raw), 10);
|
|
20
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return parsed;
|
|
24
|
+
}
|
|
25
|
+
async function resolveAppForBoost(client, rawRef) {
|
|
26
|
+
const ref = (0, refs_1.parseContentRef)(rawRef);
|
|
27
|
+
if (ref.kind !== 'app') {
|
|
28
|
+
throw new Error('invalid_app_ref');
|
|
29
|
+
}
|
|
30
|
+
const detail = await client.fetchAppBySlug(ref.creator, ref.name);
|
|
31
|
+
return {
|
|
32
|
+
ref,
|
|
33
|
+
app: detail.app,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function formatReportRow(row) {
|
|
37
|
+
return [
|
|
38
|
+
row.dateUtc,
|
|
39
|
+
`impressions ${row.interstitialImpressions + row.rewardedImpressions}`,
|
|
40
|
+
`views ${row.regularDetailViews} regular / ${row.promotedDetailViews} boosted`,
|
|
41
|
+
`plays ${row.regularPlays} regular / ${row.promotedPlays} boosted`,
|
|
42
|
+
`earnings ${row.adEarnings}`,
|
|
43
|
+
].join(' | ');
|
|
44
|
+
}
|
|
45
|
+
function formatRunDuration(startedAt, endsAt) {
|
|
46
|
+
const totalHours = Math.max(1, Math.round((new Date(endsAt).getTime() - new Date(startedAt).getTime()) / (60 * 60 * 1000)));
|
|
47
|
+
const days = Math.floor(totalHours / 24);
|
|
48
|
+
const hours = totalHours % 24;
|
|
49
|
+
if (days > 0 && hours > 0) {
|
|
50
|
+
return `${days}d ${hours}h`;
|
|
51
|
+
}
|
|
52
|
+
if (days > 0) {
|
|
53
|
+
return `${days}d`;
|
|
54
|
+
}
|
|
55
|
+
return `${hours}h`;
|
|
56
|
+
}
|
|
57
|
+
function formatUtcDate(value) {
|
|
58
|
+
return value.toISOString().slice(0, 10);
|
|
59
|
+
}
|
|
60
|
+
function resolveReportRangeFromDays(days, now = new Date()) {
|
|
61
|
+
const end = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()));
|
|
62
|
+
const start = new Date(end.getTime() - ((days - 1) * 24 * 60 * 60 * 1000));
|
|
63
|
+
return {
|
|
64
|
+
startDateUtc: formatUtcDate(start),
|
|
65
|
+
endDateUtc: formatUtcDate(end),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
async function showBoostBalance(options = {}) {
|
|
69
|
+
await (0, commandContext_1.withEnvironment)('boosts balance', 'Checking your boost balance', async ({ client }) => {
|
|
70
|
+
const response = await client.fetchBoostBalance();
|
|
71
|
+
if (options.json) {
|
|
72
|
+
(0, output_1.printJson)(response);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
(0, output_1.printSuccess)(`Boost balance: ${response.balance}`, ['Next: run "playdrop boosts offers" or "playdrop boosts buy boost_1".']);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
async function browseBoostOffers(options = {}) {
|
|
79
|
+
await (0, commandContext_1.withEnvironment)('boosts offers', 'Checking available boost packs', async ({ client }) => {
|
|
80
|
+
const response = await client.fetchBoostBalance();
|
|
81
|
+
if (options.json) {
|
|
82
|
+
(0, output_1.printJson)({ offers: response.offers });
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
console.log('Boost offers:\n');
|
|
86
|
+
for (const offer of response.offers) {
|
|
87
|
+
console.log(`${offer.sku} | ${offer.units} units | ${offer.priceCredits} credits`);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
async function buyBoostPack(sku, options = {}) {
|
|
92
|
+
const normalizedSku = sku.trim().toLowerCase();
|
|
93
|
+
if (!['boost_1', 'boost_3', 'boost_7', 'boost_14', 'boost_31'].includes(normalizedSku)) {
|
|
94
|
+
(0, messages_1.printErrorWithHelp)('Boost SKU must be one of boost_1, boost_3, boost_7, boost_14, or boost_31.', ['Example: playdrop boosts buy boost_1'], { command: 'boosts buy' });
|
|
95
|
+
process.exitCode = 1;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const quantity = parsePositiveInteger(options.quantity, 'quantity', 1);
|
|
99
|
+
if (quantity === null) {
|
|
100
|
+
(0, messages_1.printErrorWithHelp)('The --quantity value must be a positive integer.', ['Example: --quantity 2'], { command: 'boosts buy' });
|
|
101
|
+
process.exitCode = 1;
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
await (0, commandContext_1.withEnvironment)('boosts buy', 'Buying boost pack', async ({ client }) => {
|
|
105
|
+
try {
|
|
106
|
+
const response = await client.purchaseBoostPack({ sku: normalizedSku, quantity });
|
|
107
|
+
if (options.json) {
|
|
108
|
+
(0, output_1.printJson)(response);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
(0, output_1.printSuccess)(`Purchased ${response.offer.displayName}${response.quantity > 1 ? ` x ${response.quantity}` : ''}. Added ${response.unitsAdded} boost${response.unitsAdded === 1 ? '' : 's'}. Boost balance: ${response.boostBalance}. Credit balance: ${response.creditBalance}.`, ['Next: run "playdrop boosts activate <creator>/app/<name>".']);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
const handled = (0, errors_1.handleCommandFailure)(error, 'boosts buy', 'Boost purchase', {
|
|
115
|
+
apiMessage: (apiError) => ({
|
|
116
|
+
problem: `Boost purchase failed with status ${apiError.status}.`,
|
|
117
|
+
suggestions: ['Check your credit balance with "playdrop credits balance".'],
|
|
118
|
+
}),
|
|
119
|
+
});
|
|
120
|
+
if (!handled) {
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
async function activateBoost(rawRef, options = {}) {
|
|
127
|
+
const units = parsePositiveInteger(options.units, 'units', 1);
|
|
128
|
+
if (units === null) {
|
|
129
|
+
(0, messages_1.printErrorWithHelp)('The --units value must be a positive integer.', ['Example: --units 2'], { command: 'boosts activate' });
|
|
130
|
+
process.exitCode = 1;
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
await (0, commandContext_1.withEnvironment)('boosts activate', 'Activating boost', async ({ client }) => {
|
|
134
|
+
const { app } = await resolveAppForBoost(client, rawRef);
|
|
135
|
+
const response = await client.activateAppBoost(app.id, { units });
|
|
136
|
+
if (options.json) {
|
|
137
|
+
(0, output_1.printJson)(response);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
(0, output_1.printSuccess)(`Boost active until ${response.boostedUntil ?? 'unknown'}. Remaining inventory: ${response.boostsAvailable}.`);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
async function showBoostStatus(rawRef, options = {}) {
|
|
144
|
+
await (0, commandContext_1.withEnvironment)('boosts status', 'Checking boost status', async ({ client }) => {
|
|
145
|
+
const { app } = await resolveAppForBoost(client, rawRef);
|
|
146
|
+
const response = await client.fetchAppBoostStatus(app.id);
|
|
147
|
+
if (options.json) {
|
|
148
|
+
(0, output_1.printJson)(response);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
console.log(`${response.app.displayName || response.app.name}`);
|
|
152
|
+
console.log(`Status: ${response.isActive ? 'boosted' : 'inactive'}`);
|
|
153
|
+
console.log(`Boosts available: ${response.boostsAvailable}`);
|
|
154
|
+
console.log(`Boosted until: ${response.boostedUntil ?? 'none'}`);
|
|
155
|
+
if (response.currentRun) {
|
|
156
|
+
console.log(`Current run started: ${(0, output_1.formatTimestamp)(response.currentRun.startedAt)}`);
|
|
157
|
+
console.log(`Current run ends: ${(0, output_1.formatTimestamp)(response.currentRun.endsAt)}`);
|
|
158
|
+
console.log(`Current run units: ${response.currentRun.consumedUnits}`);
|
|
159
|
+
console.log(`Current run impressions: ${response.currentRun.deliveredImpressionCount}`);
|
|
160
|
+
console.log(`Current run views: ${response.currentRun.promotedDetailViewCount}`);
|
|
161
|
+
console.log(`Current run plays: ${response.currentRun.promotedPlayCount}`);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
async function showBoostHistory(rawRef, options = {}) {
|
|
166
|
+
const limit = parsePositiveInteger(options.limit, 'limit', 30);
|
|
167
|
+
if (limit === null) {
|
|
168
|
+
(0, messages_1.printErrorWithHelp)('The --limit value must be a positive integer.', ['Example: --limit 20'], { command: 'boosts history' });
|
|
169
|
+
process.exitCode = 1;
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
await (0, commandContext_1.withEnvironment)('boosts history', 'Checking boost history', async ({ client }) => {
|
|
173
|
+
const { app } = await resolveAppForBoost(client, rawRef);
|
|
174
|
+
const response = await client.fetchAppBoostHistory(app.id, { limit });
|
|
175
|
+
if (options.json) {
|
|
176
|
+
(0, output_1.printJson)(response);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (response.runs.length === 0) {
|
|
180
|
+
console.log('No boost runs found.');
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
console.log('Boost history:\n');
|
|
184
|
+
for (const run of response.runs) {
|
|
185
|
+
console.log(`#${run.id} | ${run.status.toLowerCase()} | ${(0, output_1.formatTimestamp)(run.startedAt)} -> ${(0, output_1.formatTimestamp)(run.endsAt)}`);
|
|
186
|
+
console.log(` duration ${formatRunDuration(run.startedAt, run.endsAt)} | units ${run.consumedUnits} | impressions ${run.deliveredImpressionCount} | views ${run.promotedDetailViewCount} | plays ${run.promotedPlayCount}`);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
async function showBoostReport(rawRef, options = {}) {
|
|
191
|
+
const days = parsePositiveInteger(options.days, 'days', 30);
|
|
192
|
+
if (days === null) {
|
|
193
|
+
(0, messages_1.printErrorWithHelp)('The --days value must be a positive integer.', ['Example: --days 30'], { command: 'boosts report' });
|
|
194
|
+
process.exitCode = 1;
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
await (0, commandContext_1.withEnvironment)('boosts report', 'Checking boost report', async ({ client }) => {
|
|
198
|
+
const { app } = await resolveAppForBoost(client, rawRef);
|
|
199
|
+
const response = await client.fetchAppBoostReport(app.id, resolveReportRangeFromDays(days));
|
|
200
|
+
if (options.json) {
|
|
201
|
+
(0, output_1.printJson)(response);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
console.log(`Boost report for ${app.displayName || app.name}:\n`);
|
|
205
|
+
for (const row of response.days) {
|
|
206
|
+
console.log(formatReportRow(row));
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type BrowseKind = 'app' | 'asset' | 'asset-pack' | 'all';
|
|
1
|
+
export type BrowseKind = 'app' | 'asset' | 'asset-pack' | 'asset-spec' | 'all';
|
|
2
2
|
export type BrowseCreator = 'all' | 'me' | string;
|
|
3
3
|
export type BrowseOptions = {
|
|
4
4
|
kind?: string;
|
|
@@ -6,8 +6,13 @@ export type BrowseOptions = {
|
|
|
6
6
|
appType?: string;
|
|
7
7
|
assetCategory?: string;
|
|
8
8
|
assetSubcategory?: string;
|
|
9
|
+
assetSpec?: string;
|
|
10
|
+
assetSpecOwner?: string;
|
|
11
|
+
assetSpecName?: string;
|
|
12
|
+
sort?: string;
|
|
9
13
|
limit?: string | number;
|
|
10
14
|
offset?: string | number;
|
|
15
|
+
tag?: string[];
|
|
11
16
|
json?: boolean;
|
|
12
17
|
};
|
|
13
18
|
export declare function browse(options?: BrowseOptions): Promise<void>;
|