prices export --json reads the current prices without writing; inspect --declarations gives Data safety, the App Privacy answers it suggests, app info, export compliance and App Review details with every question only the owner can answer; play data-safety keeps the uploaded CSV in .storebound/ so changes since the upload show (Play cannot read the form back); shots gallery --json carries the renders folder; inspect --render returns one render as a data: URL from inside the renders folder only.
26 lines
1.6 KiB
TypeScript
26 lines
1.6 KiB
TypeScript
// Play Data safety form through applications.dataSafety (CSV import; replaces every earlier answer).
|
|
// storebound play data-safety [--csv out.csv] [--dry]
|
|
// Answers come from `dataSafety` in storebound.config.ts. --dry only writes / prints the CSV.
|
|
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
import type { Ctx } from '../lib/ctx';
|
|
import { need } from '../lib/ctx';
|
|
import { dataSafetyCsv } from '../lib/data-safety';
|
|
import { DATA_SAFETY_UPLOADED } from '../lib/declarations';
|
|
import { done, log } from '../lib/log';
|
|
import { playClient } from './client';
|
|
|
|
export async function run(ctx: Ctx): Promise<void> {
|
|
const { config, root, resolve } = ctx.loaded;
|
|
const csv = dataSafetyCsv(need(config.dataSafety, 'dataSafety'));
|
|
const out = ctx.args.get('csv');
|
|
if (out) { writeFileSync(resolve(out), csv); log('play', `wrote ${out}`); }
|
|
const types = Object.keys(config.dataSafety!.data);
|
|
log('play', `data safety: ${types.length} data types declared (${types.join(', ') || 'none'})`);
|
|
if (ctx.args.has('dry')) { if (!out) process.stdout.write(csv); return; }
|
|
const play = await playClient(root, need(config.play?.packageName, 'play.packageName'));
|
|
await play.call('POST', `${play.API}/dataSafety`, { safetyLabels: csv });
|
|
// Play cannot read the form back: keep what went up, so the desktop app can show what changed since (gitignored).
|
|
try { mkdirSync(join(root, '.storebound'), { recursive: true }); writeFileSync(join(root, DATA_SAFETY_UPLOADED), csv); } catch { /* the upload itself worked */ }
|
|
done('play', `data safety updated (${csv.split('\n').length - 2} rows)`);
|
|
}
|