@vibegameengine/shipit 0.1.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.
Files changed (142) hide show
  1. package/README.md +86 -0
  2. package/dist/app/build-cli.d.ts +5 -0
  3. package/dist/app/build-cli.d.ts.map +1 -0
  4. package/dist/app/build-cli.js +70 -0
  5. package/dist/app/build-cli.js.map +1 -0
  6. package/dist/bin.d.ts +3 -0
  7. package/dist/bin.d.ts.map +1 -0
  8. package/dist/bin.js +19 -0
  9. package/dist/bin.js.map +1 -0
  10. package/dist/entities/credentials/api/credentials-store.d.ts +12 -0
  11. package/dist/entities/credentials/api/credentials-store.d.ts.map +1 -0
  12. package/dist/entities/credentials/api/credentials-store.js +21 -0
  13. package/dist/entities/credentials/api/credentials-store.js.map +1 -0
  14. package/dist/entities/credentials/index.d.ts +4 -0
  15. package/dist/entities/credentials/index.d.ts.map +1 -0
  16. package/dist/entities/credentials/index.js +6 -0
  17. package/dist/entities/credentials/index.js.map +1 -0
  18. package/dist/entities/credentials/model/credentials.d.ts +4 -0
  19. package/dist/entities/credentials/model/credentials.d.ts.map +1 -0
  20. package/dist/entities/credentials/model/credentials.js +3 -0
  21. package/dist/entities/credentials/model/credentials.js.map +1 -0
  22. package/dist/entities/gamefeed-config/api/gamefeed-config-store.d.ts +15 -0
  23. package/dist/entities/gamefeed-config/api/gamefeed-config-store.d.ts.map +1 -0
  24. package/dist/entities/gamefeed-config/api/gamefeed-config-store.js +32 -0
  25. package/dist/entities/gamefeed-config/api/gamefeed-config-store.js.map +1 -0
  26. package/dist/entities/gamefeed-config/index.d.ts +6 -0
  27. package/dist/entities/gamefeed-config/index.d.ts.map +1 -0
  28. package/dist/entities/gamefeed-config/index.js +10 -0
  29. package/dist/entities/gamefeed-config/index.js.map +1 -0
  30. package/dist/entities/gamefeed-config/lib/default-config.d.ts +4 -0
  31. package/dist/entities/gamefeed-config/lib/default-config.d.ts.map +1 -0
  32. package/dist/entities/gamefeed-config/lib/default-config.js +21 -0
  33. package/dist/entities/gamefeed-config/lib/default-config.js.map +1 -0
  34. package/dist/entities/gamefeed-config/model/gamefeed-config.d.ts +52 -0
  35. package/dist/entities/gamefeed-config/model/gamefeed-config.d.ts.map +1 -0
  36. package/dist/entities/gamefeed-config/model/gamefeed-config.js +23 -0
  37. package/dist/entities/gamefeed-config/model/gamefeed-config.js.map +1 -0
  38. package/dist/features/init/index.d.ts +3 -0
  39. package/dist/features/init/index.d.ts.map +1 -0
  40. package/dist/features/init/index.js +6 -0
  41. package/dist/features/init/index.js.map +1 -0
  42. package/dist/features/init/model/init-command.d.ts +15 -0
  43. package/dist/features/init/model/init-command.d.ts.map +1 -0
  44. package/dist/features/init/model/init-command.js +72 -0
  45. package/dist/features/init/model/init-command.js.map +1 -0
  46. package/dist/features/login/index.d.ts +3 -0
  47. package/dist/features/login/index.d.ts.map +1 -0
  48. package/dist/features/login/index.js +6 -0
  49. package/dist/features/login/index.js.map +1 -0
  50. package/dist/features/login/model/login-command.d.ts +16 -0
  51. package/dist/features/login/model/login-command.d.ts.map +1 -0
  52. package/dist/features/login/model/login-command.js +24 -0
  53. package/dist/features/login/model/login-command.js.map +1 -0
  54. package/dist/features/publish/index.d.ts +3 -0
  55. package/dist/features/publish/index.d.ts.map +1 -0
  56. package/dist/features/publish/index.js +6 -0
  57. package/dist/features/publish/index.js.map +1 -0
  58. package/dist/features/publish/model/publish-command.d.ts +19 -0
  59. package/dist/features/publish/model/publish-command.d.ts.map +1 -0
  60. package/dist/features/publish/model/publish-command.js +85 -0
  61. package/dist/features/publish/model/publish-command.js.map +1 -0
  62. package/dist/features/register/index.d.ts +3 -0
  63. package/dist/features/register/index.d.ts.map +1 -0
  64. package/dist/features/register/index.js +6 -0
  65. package/dist/features/register/index.js.map +1 -0
  66. package/dist/features/register/model/register-command.d.ts +14 -0
  67. package/dist/features/register/model/register-command.d.ts.map +1 -0
  68. package/dist/features/register/model/register-command.js +17 -0
  69. package/dist/features/register/model/register-command.js.map +1 -0
  70. package/dist/features/validate/index.d.ts +2 -0
  71. package/dist/features/validate/index.d.ts.map +1 -0
  72. package/dist/features/validate/index.js +6 -0
  73. package/dist/features/validate/index.js.map +1 -0
  74. package/dist/features/validate/model/validate-command.d.ts +10 -0
  75. package/dist/features/validate/model/validate-command.d.ts.map +1 -0
  76. package/dist/features/validate/model/validate-command.js +41 -0
  77. package/dist/features/validate/model/validate-command.js.map +1 -0
  78. package/dist/features/version/index.d.ts +2 -0
  79. package/dist/features/version/index.d.ts.map +1 -0
  80. package/dist/features/version/index.js +6 -0
  81. package/dist/features/version/index.js.map +1 -0
  82. package/dist/features/version/model/version-command.d.ts +18 -0
  83. package/dist/features/version/model/version-command.d.ts.map +1 -0
  84. package/dist/features/version/model/version-command.js +54 -0
  85. package/dist/features/version/model/version-command.js.map +1 -0
  86. package/dist/shared/api/http-client/api-client.d.ts +22 -0
  87. package/dist/shared/api/http-client/api-client.d.ts.map +1 -0
  88. package/dist/shared/api/http-client/api-client.js +73 -0
  89. package/dist/shared/api/http-client/api-client.js.map +1 -0
  90. package/dist/shared/api/http-client/index.d.ts +4 -0
  91. package/dist/shared/api/http-client/index.d.ts.map +1 -0
  92. package/dist/shared/api/http-client/index.js +6 -0
  93. package/dist/shared/api/http-client/index.js.map +1 -0
  94. package/dist/shared/api/http-client/platform-api.d.ts +11 -0
  95. package/dist/shared/api/http-client/platform-api.d.ts.map +1 -0
  96. package/dist/shared/api/http-client/platform-api.js +3 -0
  97. package/dist/shared/api/http-client/platform-api.js.map +1 -0
  98. package/dist/shared/config/config.d.ts +7 -0
  99. package/dist/shared/config/config.d.ts.map +1 -0
  100. package/dist/shared/config/config.js +17 -0
  101. package/dist/shared/config/config.js.map +1 -0
  102. package/dist/shared/config/index.d.ts +3 -0
  103. package/dist/shared/config/index.d.ts.map +1 -0
  104. package/dist/shared/config/index.js +6 -0
  105. package/dist/shared/config/index.js.map +1 -0
  106. package/dist/shared/contracts.d.ts +112 -0
  107. package/dist/shared/contracts.d.ts.map +1 -0
  108. package/dist/shared/contracts.js +34 -0
  109. package/dist/shared/contracts.js.map +1 -0
  110. package/dist/shared/lib/archive/create-archive.d.ts +8 -0
  111. package/dist/shared/lib/archive/create-archive.d.ts.map +1 -0
  112. package/dist/shared/lib/archive/create-archive.js +17 -0
  113. package/dist/shared/lib/archive/create-archive.js.map +1 -0
  114. package/dist/shared/lib/archive/index.d.ts +3 -0
  115. package/dist/shared/lib/archive/index.d.ts.map +1 -0
  116. package/dist/shared/lib/archive/index.js +6 -0
  117. package/dist/shared/lib/archive/index.js.map +1 -0
  118. package/dist/shared/lib/console/index.d.ts +3 -0
  119. package/dist/shared/lib/console/index.d.ts.map +1 -0
  120. package/dist/shared/lib/console/index.js +6 -0
  121. package/dist/shared/lib/console/index.js.map +1 -0
  122. package/dist/shared/lib/console/reporter.d.ts +12 -0
  123. package/dist/shared/lib/console/reporter.d.ts.map +1 -0
  124. package/dist/shared/lib/console/reporter.js +23 -0
  125. package/dist/shared/lib/console/reporter.js.map +1 -0
  126. package/dist/shared/lib/errors/cli-error.d.ts +6 -0
  127. package/dist/shared/lib/errors/cli-error.d.ts.map +1 -0
  128. package/dist/shared/lib/errors/cli-error.js +14 -0
  129. package/dist/shared/lib/errors/cli-error.js.map +1 -0
  130. package/dist/shared/lib/errors/index.d.ts +2 -0
  131. package/dist/shared/lib/errors/index.d.ts.map +1 -0
  132. package/dist/shared/lib/errors/index.js +6 -0
  133. package/dist/shared/lib/errors/index.js.map +1 -0
  134. package/dist/shared/lib/fs/fs.d.ts +6 -0
  135. package/dist/shared/lib/fs/fs.d.ts.map +1 -0
  136. package/dist/shared/lib/fs/fs.js +32 -0
  137. package/dist/shared/lib/fs/fs.js.map +1 -0
  138. package/dist/shared/lib/fs/index.d.ts +2 -0
  139. package/dist/shared/lib/fs/index.d.ts.map +1 -0
  140. package/dist/shared/lib/fs/index.js +10 -0
  141. package/dist/shared/lib/fs/index.js.map +1 -0
  142. package/package.json +47 -0
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoginCommand = void 0;
4
+ var login_command_1 = require("./model/login-command");
5
+ Object.defineProperty(exports, "LoginCommand", { enumerable: true, get: function () { return login_command_1.LoginCommand; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/login/index.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAA5C,6GAAA,YAAY,OAAA"}
@@ -0,0 +1,16 @@
1
+ import type { CredentialsStore } from '../../../entities/credentials';
2
+ import type { PlatformApi } from '../../../shared/api/http-client';
3
+ import type { Reporter } from '../../../shared/lib/console';
4
+ export interface LoginInput {
5
+ email: string;
6
+ password: string;
7
+ name?: string;
8
+ }
9
+ export declare class LoginCommand {
10
+ private readonly api;
11
+ private readonly credentials;
12
+ private readonly reporter;
13
+ constructor(api: PlatformApi, credentials: CredentialsStore, reporter: Reporter);
14
+ execute(input: LoginInput): Promise<void>;
15
+ }
16
+ //# sourceMappingURL=login-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login-command.d.ts","sourceRoot":"","sources":["../../../../src/features/login/model/login-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,YAAY;IAErB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAFR,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,gBAAgB,EAC7B,QAAQ,EAAE,QAAQ;IAG/B,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAShD"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoginCommand = void 0;
4
+ class LoginCommand {
5
+ api;
6
+ credentials;
7
+ reporter;
8
+ constructor(api, credentials, reporter) {
9
+ this.api = api;
10
+ this.credentials = credentials;
11
+ this.reporter = reporter;
12
+ }
13
+ async execute(input) {
14
+ const { token } = await this.api.issueToken({
15
+ email: input.email,
16
+ password: input.password,
17
+ name: input.name ?? 'cli',
18
+ });
19
+ await this.credentials.write({ token });
20
+ this.reporter.success('Logged in. Token saved.');
21
+ }
22
+ }
23
+ exports.LoginCommand = LoginCommand;
24
+ //# sourceMappingURL=login-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login-command.js","sourceRoot":"","sources":["../../../../src/features/login/model/login-command.ts"],"names":[],"mappings":";;;AAUA,MAAa,YAAY;IAEJ;IACA;IACA;IAHnB,YACmB,GAAgB,EAChB,WAA6B,EAC7B,QAAkB;QAFlB,QAAG,GAAH,GAAG,CAAa;QAChB,gBAAW,GAAX,WAAW,CAAkB;QAC7B,aAAQ,GAAR,QAAQ,CAAU;IAClC,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,KAAiB;QAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC;YAC1C,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,KAAK;SAC1B,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACnD,CAAC;CACF;AAhBD,oCAgBC"}
@@ -0,0 +1,3 @@
1
+ export { PublishCommand } from './model/publish-command';
2
+ export type { PublishInput } from './model/publish-command';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/publish/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PublishCommand = void 0;
4
+ var publish_command_1 = require("./model/publish-command");
5
+ Object.defineProperty(exports, "PublishCommand", { enumerable: true, get: function () { return publish_command_1.PublishCommand; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/publish/index.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAAhD,iHAAA,cAAc,OAAA"}
@@ -0,0 +1,19 @@
1
+ import type { CredentialsStore } from '../../../entities/credentials';
2
+ import type { GamefeedConfigStore } from '../../../entities/gamefeed-config';
3
+ import type { AuthedApiFactory } from '../../../shared/api/http-client';
4
+ import type { Reporter } from '../../../shared/lib/console';
5
+ export interface PublishInput {
6
+ releaseName?: string;
7
+ }
8
+ export declare class PublishCommand {
9
+ private readonly config;
10
+ private readonly credentials;
11
+ private readonly createApi;
12
+ private readonly reporter;
13
+ private readonly projectDir;
14
+ constructor(config: GamefeedConfigStore, credentials: CredentialsStore, createApi: AuthedApiFactory, reporter: Reporter, projectDir: string);
15
+ execute(input: PublishInput): Promise<void>;
16
+ private readDescriptions;
17
+ private readPreview;
18
+ }
19
+ //# sourceMappingURL=publish-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish-command.d.ts","sourceRoot":"","sources":["../../../../src/features/publish/model/publish-command.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAI5D,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAJV,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,gBAAgB,EAC7B,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,MAAM;IAG/B,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;YA2CnC,gBAAgB;YAqBhB,WAAW;CAO1B"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PublishCommand = void 0;
4
+ const promises_1 = require("node:fs/promises");
5
+ const node_path_1 = require("node:path");
6
+ const contracts_1 = require("../../../shared/contracts");
7
+ const archive_1 = require("../../../shared/lib/archive");
8
+ const errors_1 = require("../../../shared/lib/errors");
9
+ const fs_1 = require("../../../shared/lib/fs");
10
+ class PublishCommand {
11
+ config;
12
+ credentials;
13
+ createApi;
14
+ reporter;
15
+ projectDir;
16
+ constructor(config, credentials, createApi, reporter, projectDir) {
17
+ this.config = config;
18
+ this.credentials = credentials;
19
+ this.createApi = createApi;
20
+ this.reporter = reporter;
21
+ this.projectDir = projectDir;
22
+ }
23
+ async execute(input) {
24
+ const config = await this.config.read();
25
+ const credentials = await this.credentials.read();
26
+ if (!credentials) {
27
+ throw new errors_1.CliError('Not logged in. Run "shipit login" first.');
28
+ }
29
+ const buildDir = (0, node_path_1.join)(this.projectDir, config.buildDir);
30
+ if (!(await (0, fs_1.pathExists)(buildDir))) {
31
+ throw new errors_1.CliError(`buildDir "${config.buildDir}" does not exist. Build the game first.`);
32
+ }
33
+ const entryPath = (0, node_path_1.join)(buildDir, config.entry);
34
+ if (!(await (0, fs_1.pathExists)(entryPath))) {
35
+ throw new errors_1.CliError(`entry "${config.entry}" does not exist inside buildDir "${config.buildDir}".`);
36
+ }
37
+ this.reporter.info(`Packing "${config.buildDir}"...`);
38
+ const archive = await (0, archive_1.createTarGz)(buildDir);
39
+ const releaseName = contracts_1.releaseNameSchema.parse(input.releaseName ?? config.nextVersion);
40
+ const descriptions = await this.readDescriptions(releaseName);
41
+ const preview = process.env.SHIPIT_SKIP_PREVIEW === '1'
42
+ ? undefined
43
+ : await this.readPreview(config.previews.wide);
44
+ const metadata = {
45
+ releaseName,
46
+ title: config.title,
47
+ orientation: config.orientation[0] ?? 'portrait',
48
+ tags: config.tags,
49
+ entry: config.entry,
50
+ descriptions,
51
+ buildHash: archive.hash,
52
+ };
53
+ const api = this.createApi(credentials.token);
54
+ const result = await api.publishVersion(config.gameId, metadata, archive.data, preview);
55
+ await this.config.write({ ...config, nextVersion: releaseName });
56
+ this.reporter.success(`Published ${result.game.slug} ${releaseName} (${result.version.sizeBytes} bytes, ${result.version.status})`);
57
+ }
58
+ async readDescriptions(releaseName) {
59
+ const dir = (0, node_path_1.join)(this.projectDir, '.shipit', 'versions', releaseName, 'description');
60
+ if (!(await (0, fs_1.pathExists)(dir))) {
61
+ throw new errors_1.CliError(`Descriptions not found at ${dir}. Run "shipit version ${releaseName}" first.`);
62
+ }
63
+ const descriptions = await Promise.all((await (0, promises_1.readdir)(dir))
64
+ .filter((file) => (0, node_path_1.extname)(file) === '.md')
65
+ .map(async (file) => {
66
+ const locale = (0, node_path_1.basename)(file, '.md');
67
+ const body = (await (0, promises_1.readFile)((0, node_path_1.join)(dir, file), 'utf8')).trim();
68
+ return { locale, body };
69
+ }));
70
+ const nonEmpty = descriptions.filter((description) => description.body);
71
+ if (nonEmpty.length === 0) {
72
+ throw new errors_1.CliError(`Descriptions are empty at ${dir}.`);
73
+ }
74
+ return nonEmpty;
75
+ }
76
+ async readPreview(path) {
77
+ const fullPath = (0, node_path_1.join)(this.projectDir, path);
78
+ if (!(await (0, fs_1.pathExists)(fullPath))) {
79
+ throw new errors_1.CliError(`Preview not found at ${path}.`);
80
+ }
81
+ return (0, promises_1.readFile)(fullPath);
82
+ }
83
+ }
84
+ exports.PublishCommand = PublishCommand;
85
+ //# sourceMappingURL=publish-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish-command.js","sourceRoot":"","sources":["../../../../src/features/publish/model/publish-command.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AACrD,yCAAoD;AACpD,yDAA0F;AAI1F,yDAA0D;AAE1D,uDAAsD;AACtD,+CAAoD;AAMpD,MAAa,cAAc;IAEN;IACA;IACA;IACA;IACA;IALnB,YACmB,MAA2B,EAC3B,WAA6B,EAC7B,SAA2B,EAC3B,QAAkB,EAClB,UAAkB;QAJlB,WAAM,GAAN,MAAM,CAAqB;QAC3B,gBAAW,GAAX,WAAW,CAAkB;QAC7B,cAAS,GAAT,SAAS,CAAkB;QAC3B,aAAQ,GAAR,QAAQ,CAAU;QAClB,eAAU,GAAV,UAAU,CAAQ;IAClC,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,KAAmB;QAC/B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAExC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAClD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAA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AE,IAAI,EAAE,EAAE;YAClB,MAAM,MAAM,GAAG,IAAA,oBAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACrC,MAAM,IAAI,GAAG,CAAC,MAAM,IAAA,mBAAQ,EAAC,IAAA,gBAAI,EAAC,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC9D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAC1B,CAAC,CAAC,CACL,CAAC;QACF,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACxE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,iBAAQ,CAAC,6BAA6B,GAAG,GAAG,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,IAAY;QACpC,MAAM,QAAQ,GAAG,IAAA,gBAAI,EAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,CAAC,MAAM,IAAA,eAAU,EAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,iBAAQ,CAAC,wBAAwB,IAAI,GAAG,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,IAAA,mBAAQ,EAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;CACF;AAhFD,wCAgFC"}
@@ -0,0 +1,3 @@
1
+ export { RegisterCommand } from './model/register-command';
2
+ export type { RegisterInput } from './model/register-command';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/register/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RegisterCommand = void 0;
4
+ var register_command_1 = require("./model/register-command");
5
+ Object.defineProperty(exports, "RegisterCommand", { enumerable: true, get: function () { return register_command_1.RegisterCommand; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/register/index.ts"],"names":[],"mappings":";;;AAAA,6DAA2D;AAAlD,mHAAA,eAAe,OAAA"}
@@ -0,0 +1,14 @@
1
+ import type { PlatformApi } from '../../../shared/api/http-client';
2
+ import type { Reporter } from '../../../shared/lib/console';
3
+ export interface RegisterInput {
4
+ email: string;
5
+ password: string;
6
+ name: string;
7
+ }
8
+ export declare class RegisterCommand {
9
+ private readonly api;
10
+ private readonly reporter;
11
+ constructor(api: PlatformApi, reporter: Reporter);
12
+ execute(input: RegisterInput): Promise<void>;
13
+ }
14
+ //# sourceMappingURL=register-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-command.d.ts","sourceRoot":"","sources":["../../../../src/features/register/model/register-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADR,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,QAAQ;IAG/B,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAInD"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RegisterCommand = void 0;
4
+ class RegisterCommand {
5
+ api;
6
+ reporter;
7
+ constructor(api, reporter) {
8
+ this.api = api;
9
+ this.reporter = reporter;
10
+ }
11
+ async execute(input) {
12
+ const creator = await this.api.registerCreator(input);
13
+ this.reporter.success(`Registered ${creator.email}. Now run "shipit login".`);
14
+ }
15
+ }
16
+ exports.RegisterCommand = RegisterCommand;
17
+ //# sourceMappingURL=register-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-command.js","sourceRoot":"","sources":["../../../../src/features/register/model/register-command.ts"],"names":[],"mappings":";;;AASA,MAAa,eAAe;IAEP;IACA;IAFnB,YACmB,GAAgB,EAChB,QAAkB;QADlB,QAAG,GAAH,GAAG,CAAa;QAChB,aAAQ,GAAR,QAAQ,CAAU;IAClC,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,KAAoB;QAChC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACtD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,OAAO,CAAC,KAAK,2BAA2B,CAAC,CAAC;IAChF,CAAC;CACF;AAVD,0CAUC"}
@@ -0,0 +1,2 @@
1
+ export { ValidateCommand } from './model/validate-command';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/validate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidateCommand = void 0;
4
+ var validate_command_1 = require("./model/validate-command");
5
+ Object.defineProperty(exports, "ValidateCommand", { enumerable: true, get: function () { return validate_command_1.ValidateCommand; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/validate/index.ts"],"names":[],"mappings":";;;AAAA,6DAA2D;AAAlD,mHAAA,eAAe,OAAA"}
@@ -0,0 +1,10 @@
1
+ import type { GamefeedConfigStore } from '../../../entities/gamefeed-config';
2
+ import type { Reporter } from '../../../shared/lib/console';
3
+ export declare class ValidateCommand {
4
+ private readonly config;
5
+ private readonly reporter;
6
+ private readonly projectDir;
7
+ constructor(config: GamefeedConfigStore, reporter: Reporter, projectDir: string);
8
+ execute(): Promise<void>;
9
+ }
10
+ //# sourceMappingURL=validate-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-command.d.ts","sourceRoot":"","sources":["../../../../src/features/validate/model/validate-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAI5D,qBAAa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAFV,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,MAAM;IAG/B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CA0B/B"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidateCommand = void 0;
4
+ const node_path_1 = require("node:path");
5
+ const errors_1 = require("../../../shared/lib/errors");
6
+ const fs_1 = require("../../../shared/lib/fs");
7
+ class ValidateCommand {
8
+ config;
9
+ reporter;
10
+ projectDir;
11
+ constructor(config, reporter, projectDir) {
12
+ this.config = config;
13
+ this.reporter = reporter;
14
+ this.projectDir = projectDir;
15
+ }
16
+ async execute() {
17
+ const config = await this.config.read();
18
+ const problems = [];
19
+ if (!(await (0, fs_1.pathExists)((0, node_path_1.join)(this.projectDir, config.buildDir)))) {
20
+ problems.push(`buildDir "${config.buildDir}" does not exist`);
21
+ }
22
+ const entryPath = (0, node_path_1.join)(this.projectDir, config.buildDir, config.entry);
23
+ if (!(await (0, fs_1.pathExists)(entryPath))) {
24
+ problems.push(`entry "${config.entry}" does not exist`);
25
+ }
26
+ else if ((await (0, fs_1.fileSize)(entryPath)) === 0) {
27
+ problems.push(`entry "${config.entry}" is empty`);
28
+ }
29
+ for (const [slot, path] of Object.entries(config.previews)) {
30
+ if (!(await (0, fs_1.pathExists)((0, node_path_1.join)(this.projectDir, path)))) {
31
+ problems.push(`preview.${slot} "${path}" does not exist`);
32
+ }
33
+ }
34
+ if (problems.length > 0) {
35
+ throw new errors_1.CliError(`Validation failed:\n - ${problems.join('\n - ')}`);
36
+ }
37
+ this.reporter.success('.shipit/shipit.json looks valid');
38
+ }
39
+ }
40
+ exports.ValidateCommand = ValidateCommand;
41
+ //# sourceMappingURL=validate-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-command.js","sourceRoot":"","sources":["../../../../src/features/validate/model/validate-command.ts"],"names":[],"mappings":";;;AAAA,yCAAiC;AAGjC,uDAAsD;AACtD,+CAA8D;AAE9D,MAAa,eAAe;IAEP;IACA;IACA;IAHnB,YACmB,MAA2B,EAC3B,QAAkB,EAClB,UAAkB;QAFlB,WAAM,GAAN,MAAM,CAAqB;QAC3B,aAAQ,GAAR,QAAQ,CAAU;QAClB,eAAU,GAAV,UAAU,CAAQ;IAClC,CAAC;IAEJ,KAAK,CAAC,OAAO;QACX,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,IAAI,CAAC,CAAC,MAAM,IAAA,eAAU,EAAC,IAAA,gBAAI,EAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,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ingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/version/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VersionCommand = void 0;
4
+ var version_command_1 = require("./model/version-command");
5
+ Object.defineProperty(exports, "VersionCommand", { enumerable: true, get: function () { return version_command_1.VersionCommand; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/version/index.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAAhD,iHAAA,cAAc,OAAA"}
@@ -0,0 +1,18 @@
1
+ import type { CredentialsStore } from '../../../entities/credentials';
2
+ import type { GamefeedConfigStore } from '../../../entities/gamefeed-config';
3
+ import type { AuthedApiFactory } from '../../../shared/api/http-client';
4
+ import type { Reporter } from '../../../shared/lib/console';
5
+ export interface VersionInput {
6
+ releaseName?: string;
7
+ }
8
+ export declare class VersionCommand {
9
+ private readonly config;
10
+ private readonly credentials;
11
+ private readonly createApi;
12
+ private readonly reporter;
13
+ private readonly projectDir;
14
+ constructor(config: GamefeedConfigStore, credentials: CredentialsStore, createApi: AuthedApiFactory, reporter: Reporter, projectDir: string);
15
+ execute(input: VersionInput): Promise<void>;
16
+ private ensureVersionTemplate;
17
+ }
18
+ //# sourceMappingURL=version-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-command.d.ts","sourceRoot":"","sources":["../../../../src/features/version/model/version-command.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAI5D,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAJV,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,gBAAgB,EAC7B,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,MAAM;IAG/B,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;YAyBnC,qBAAqB;CAQpC"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VersionCommand = void 0;
4
+ const promises_1 = require("node:fs/promises");
5
+ const node_path_1 = require("node:path");
6
+ const contracts_1 = require("../../../shared/contracts");
7
+ const errors_1 = require("../../../shared/lib/errors");
8
+ const fs_1 = require("../../../shared/lib/fs");
9
+ class VersionCommand {
10
+ config;
11
+ credentials;
12
+ createApi;
13
+ reporter;
14
+ projectDir;
15
+ constructor(config, credentials, createApi, reporter, projectDir) {
16
+ this.config = config;
17
+ this.credentials = credentials;
18
+ this.createApi = createApi;
19
+ this.reporter = reporter;
20
+ this.projectDir = projectDir;
21
+ }
22
+ async execute(input) {
23
+ if (input.releaseName) {
24
+ const releaseName = contracts_1.releaseNameSchema.parse(input.releaseName);
25
+ await this.ensureVersionTemplate(releaseName);
26
+ const config = await this.config.read();
27
+ await this.config.write({ ...config, nextVersion: releaseName });
28
+ this.reporter.success(`Next version: ${releaseName}`);
29
+ return;
30
+ }
31
+ const config = await this.config.read();
32
+ const credentials = await this.credentials.read();
33
+ if (!credentials) {
34
+ throw new errors_1.CliError('Not logged in. Run "shipit login" first.');
35
+ }
36
+ const response = await this.createApi(credentials.token).listVersions(config.gameId);
37
+ const latest = response.versions[0];
38
+ if (!latest) {
39
+ this.reporter.info('No published versions yet.');
40
+ return;
41
+ }
42
+ this.reporter.info(`Current version: ${latest.releaseName ?? `v${latest.version}`}`);
43
+ }
44
+ async ensureVersionTemplate(releaseName) {
45
+ const path = (0, node_path_1.join)(this.projectDir, '.shipit', 'versions', releaseName, 'description', 'en.md');
46
+ if (await (0, fs_1.pathExists)(path)) {
47
+ return;
48
+ }
49
+ await (0, fs_1.ensureDir)((0, node_path_1.dirname)(path));
50
+ await (0, promises_1.writeFile)(path, `# ${releaseName}\n\nDescribe this version.\n`, 'utf8');
51
+ }
52
+ }
53
+ exports.VersionCommand = VersionCommand;
54
+ //# sourceMappingURL=version-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-command.js","sourceRoot":"","sources":["../../../../src/features/version/model/version-command.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAC7C,yCAA0C;AAC1C,yDAA8D;AAK9D,uDAAsD;AACtD,+CAA+D;AAM/D,MAAa,cAAc;IAEN;IACA;IACA;IACA;IACA;IALnB,YACmB,MAA2B,EAC3B,WAA6B,EAC7B,SAA2B,EAC3B,QAAkB,EAClB,UAAkB;QAJlB,WAAM,GAAN,MAAM,CAAqB;QAC3B,gBAAW,GAAX,WAAW,CAAkB;QAC7B,cAAS,GAAT,SAAS,CAAkB;QAC3B,aAAQ,GAAR,QAAQ,CAAU;QAClB,eAAU,GAAV,UAAU,CAAQ;IAClC,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,KAAmB;QAC/B,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,WAAW,GAAG,6BAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC/D,MAAM,IAAI,CAAC,qBAAqB,CAAC,WAAW,C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AO;QACT,CAAC;QACD,MAAM,IAAA,cAAS,EAAC,IAAA,mBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;QAC/B,MAAM,IAAA,oBAAS,EAAC,IAAI,EAAE,KAAK,WAAW,8BAA8B,EAAE,MAAM,CAAC,CAAC;IAChF,CAAC;CACF;AA1CD,wCA0CC"}
@@ -0,0 +1,22 @@
1
+ import type { CreatorResponse, IssueTokenRequest, ListVersionsResponse, PublishVersionRequest, PublishVersionResponse, RegisterCreatorRequest, TokenResponse } from '../../contracts';
2
+ import type { PlatformApi } from './platform-api';
3
+ export type FetchFn = typeof fetch;
4
+ export interface ApiClientOptions {
5
+ baseUrl: string;
6
+ token?: string;
7
+ }
8
+ /** fetch-based PlatformApi implementation. fetchFn is injectable for tests. */
9
+ export declare class ApiClient implements PlatformApi {
10
+ private readonly options;
11
+ private readonly fetchFn;
12
+ constructor(options: ApiClientOptions, fetchFn?: FetchFn);
13
+ registerCreator(input: RegisterCreatorRequest): Promise<CreatorResponse>;
14
+ issueToken(input: IssueTokenRequest): Promise<TokenResponse>;
15
+ publishVersion(slug: string, metadata: PublishVersionRequest, build: Buffer, preview?: Buffer): Promise<PublishVersionResponse>;
16
+ listVersions(slug: string): Promise<ListVersionsResponse>;
17
+ private postJson;
18
+ private authHeaders;
19
+ private url;
20
+ private handle;
21
+ }
22
+ //# sourceMappingURL=api-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../../../src/shared/api/http-client/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,MAAM,OAAO,GAAG,OAAO,KAAK,CAAC;AAEnC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,+EAA+E;AAC/E,qBAAa,SAAU,YAAW,WAAW;IAEzC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE,OAAe;IAG3C,eAAe,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,eAAe,CAAC;IAIxE,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IAItD,cAAc,CAClB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,qBAAqB,EAC/B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,sBAAsB,CAAC;IAe5B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;YAQjD,QAAQ;IAStB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,GAAG;YAIG,MAAM;CAQrB"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiClient = void 0;
4
+ const errors_1 = require("../../lib/errors");
5
+ /** fetch-based PlatformApi implementation. fetchFn is injectable for tests. */
6
+ class ApiClient {
7
+ options;
8
+ fetchFn;
9
+ constructor(options, fetchFn = fetch) {
10
+ this.options = options;
11
+ this.fetchFn = fetchFn;
12
+ }
13
+ registerCreator(input) {
14
+ return this.postJson('/v1/creators', input);
15
+ }
16
+ issueToken(input) {
17
+ return this.postJson('/v1/auth/tokens', input);
18
+ }
19
+ async publishVersion(slug, metadata, build, preview) {
20
+ const form = new FormData();
21
+ form.append('metadata', JSON.stringify(metadata));
22
+ form.append('build', new Blob([build]), 'build.tar.gz');
23
+ if (preview) {
24
+ form.append('preview', new Blob([preview], { type: 'image/svg+xml' }), 'preview.svg');
25
+ }
26
+ const response = await this.fetchFn(this.url(`/v1/games/${slug}/versions`), {
27
+ method: 'POST',
28
+ body: form,
29
+ headers: this.authHeaders(),
30
+ });
31
+ return this.handle(response);
32
+ }
33
+ async listVersions(slug) {
34
+ const response = await this.fetchFn(this.url(`/v1/games/${slug}/versions`), {
35
+ method: 'GET',
36
+ headers: this.authHeaders(),
37
+ });
38
+ return this.handle(response);
39
+ }
40
+ async postJson(path, body) {
41
+ const response = await this.fetchFn(this.url(path), {
42
+ method: 'POST',
43
+ body: JSON.stringify(body),
44
+ headers: { 'content-type': 'application/json', ...this.authHeaders() },
45
+ });
46
+ return this.handle(response);
47
+ }
48
+ authHeaders() {
49
+ return this.options.token ? { authorization: `Bearer ${this.options.token}` } : {};
50
+ }
51
+ url(path) {
52
+ return `${this.options.baseUrl}${path}`;
53
+ }
54
+ async handle(response) {
55
+ const text = await response.text();
56
+ const data = text ? JSON.parse(text) : {};
57
+ if (!response.ok) {
58
+ throw new errors_1.CliError(describeError(data, response.status));
59
+ }
60
+ return data;
61
+ }
62
+ }
63
+ exports.ApiClient = ApiClient;
64
+ function describeError(data, status) {
65
+ if (typeof data === 'object' && data !== null && 'error' in data) {
66
+ const error = data.error;
67
+ if (error?.message) {
68
+ return error.code ? `${error.message} [${error.code}]` : error.message;
69
+ }
70
+ }
71
+ return `Request failed (${status})`;
72
+ }
73
+ //# sourceMappingURL=api-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../../../src/shared/api/http-client/api-client.ts"],"names":[],"mappings":";;;AASA,6CAA4C;AAU5C,+EAA+E;AAC/E,MAAa,SAAS;IAED;IACA;IAFnB,YACmB,OAAyB,EACzB,UAAmB,KAAK;QADxB,YAAO,GAAP,OAAO,CAAkB;QACzB,YAAO,GAAP,OAAO,CAAiB;IACxC,CAAC;IAEJ,eAAe,CAAC,KAA6B;QAC3C,OAAO,IAAI,CAAC,QAAQ,CAAkB,cAAc,EAAE,KAAK,CAAC,CA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;QACjE,MAAM,KAAK,GAAI,IAAwD,CAAC,KAAK,CAAC;QAC9E,IAAI,KAAK,EAAE,OAAO,EAAE,CAAC;YACnB,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;QACzE,CAAC;IACH,CAAC;IACD,OAAO,mBAAmB,MAAM,GAAG,CAAC;AACtC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { ApiClient } from './api-client';
2
+ export type { ApiClientOptions, FetchFn } from './api-client';
3
+ export type { AuthedApiFactory, PlatformApi } from './platform-api';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/api/http-client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC9D,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiClient = void 0;
4
+ var api_client_1 = require("./api-client");
5
+ Object.defineProperty(exports, "ApiClient", { enumerable: true, get: function () { return api_client_1.ApiClient; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/shared/api/http-client/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,uGAAA,SAAS,OAAA"}
@@ -0,0 +1,11 @@
1
+ import type { CreatorResponse, IssueTokenRequest, ListVersionsResponse, PublishVersionRequest, PublishVersionResponse, RegisterCreatorRequest, TokenResponse } from '../../contracts';
2
+ /** The slice of the platform HTTP API the CLI talks to. Commands depend on this
3
+ * abstraction (not the concrete client) so they can be tested with a fake. */
4
+ export interface PlatformApi {
5
+ registerCreator(input: RegisterCreatorRequest): Promise<CreatorResponse>;
6
+ issueToken(input: IssueTokenRequest): Promise<TokenResponse>;
7
+ publishVersion(slug: string, metadata: PublishVersionRequest, build: Buffer, preview?: Buffer): Promise<PublishVersionResponse>;
8
+ listVersions(slug: string): Promise<ListVersionsResponse>;
9
+ }
10
+ export type AuthedApiFactory = (token: string) => PlatformApi;
11
+ //# sourceMappingURL=platform-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-api.d.ts","sourceRoot":"","sources":["../../../../src/shared/api/http-client/platform-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB;8EAC8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,eAAe,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACzE,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC7D,cAAc,CACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,qBAAqB,EAC/B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACnC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAC3D;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=platform-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-api.js","sourceRoot":"","sources":["../../../../src/shared/api/http-client/platform-api.ts"],"names":[],"mappings":""}