@solana-mobile/dapp-store-cli 0.16.0 → 0.16.1

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 (113) hide show
  1. package/bin/dapp-store.js +3 -1
  2. package/lib/CliSetup.js +304 -505
  3. package/lib/CliUtils.js +6 -376
  4. package/lib/__tests__/CliSetupTest.js +484 -74
  5. package/lib/cli/__tests__/parseErrors.test.js +25 -0
  6. package/lib/cli/__tests__/signer.test.js +436 -0
  7. package/lib/cli/constants.js +23 -0
  8. package/lib/cli/messages.js +21 -0
  9. package/lib/cli/parseErrors.js +41 -0
  10. package/lib/{commands/publish/PublishCliSupport.js → cli/selfUpdate.js} +72 -38
  11. package/lib/{commands/publish/PublishCliRemove.js → cli/signer.js} +35 -56
  12. package/lib/index.js +96 -5
  13. package/lib/package.json +5 -24
  14. package/lib/portal/__tests__/releaseMetadata.test.js +647 -0
  15. package/lib/portal/__tests__/translators.test.js +76 -0
  16. package/lib/portal/__tests__/workflowClient.test.js +457 -0
  17. package/lib/portal/attestationClient.js +143 -0
  18. package/lib/portal/files.js +64 -0
  19. package/lib/portal/http.js +364 -0
  20. package/lib/portal/records.js +64 -0
  21. package/lib/portal/releaseMetadata.js +748 -0
  22. package/lib/portal/translators.js +460 -0
  23. package/lib/portal/types.js +1 -0
  24. package/lib/portal/workflowClient.js +704 -0
  25. package/lib/publication/PublicationProgressReporter.js +1051 -0
  26. package/lib/publication/__tests__/PublicationProgressReporter.test.js +174 -0
  27. package/lib/{commands/ValidateCommand.js → publication/__tests__/fundingPreflight.test.js} +90 -66
  28. package/lib/publication/__tests__/publicationSummary.test.js +26 -0
  29. package/lib/publication/cliValidation.js +482 -0
  30. package/lib/publication/fundingPreflight.js +246 -0
  31. package/lib/publication/publicationSummary.js +99 -0
  32. package/lib/{commands/utils.js → publication/runPublicationWorkflow.js} +16 -46
  33. package/package.json +5 -24
  34. package/src/CliSetup.ts +370 -505
  35. package/src/CliUtils.ts +9 -233
  36. package/src/__tests__/CliSetupTest.ts +272 -120
  37. package/src/cli/__tests__/parseErrors.test.ts +34 -0
  38. package/src/cli/__tests__/signer.test.ts +359 -0
  39. package/src/cli/constants.ts +3 -0
  40. package/src/cli/messages.ts +27 -0
  41. package/src/cli/parseErrors.ts +62 -0
  42. package/src/cli/selfUpdate.ts +59 -0
  43. package/src/cli/signer.ts +38 -0
  44. package/src/index.ts +31 -4
  45. package/src/portal/__tests__/releaseMetadata.test.ts +508 -0
  46. package/src/portal/__tests__/translators.test.ts +82 -0
  47. package/src/portal/__tests__/workflowClient.test.ts +278 -0
  48. package/src/portal/attestationClient.ts +19 -0
  49. package/src/portal/files.ts +73 -0
  50. package/src/portal/http.ts +170 -0
  51. package/src/portal/records.ts +38 -0
  52. package/src/portal/releaseMetadata.ts +489 -0
  53. package/src/portal/translators.ts +750 -0
  54. package/src/portal/types.ts +27 -0
  55. package/src/portal/workflowClient.ts +575 -0
  56. package/src/publication/PublicationProgressReporter.ts +1026 -0
  57. package/src/publication/__tests__/PublicationProgressReporter.test.ts +210 -0
  58. package/src/publication/__tests__/fundingPreflight.test.ts +78 -0
  59. package/src/publication/__tests__/publicationSummary.test.ts +30 -0
  60. package/src/publication/cliValidation.ts +264 -0
  61. package/src/publication/fundingPreflight.ts +123 -0
  62. package/src/publication/publicationSummary.ts +26 -0
  63. package/src/publication/runPublicationWorkflow.ts +46 -0
  64. package/lib/commands/create/CreateCliApp.js +0 -223
  65. package/lib/commands/create/CreateCliRelease.js +0 -290
  66. package/lib/commands/create/index.js +0 -40
  67. package/lib/commands/index.js +0 -3
  68. package/lib/commands/publish/PublishCliSubmit.js +0 -208
  69. package/lib/commands/publish/PublishCliUpdate.js +0 -211
  70. package/lib/commands/publish/index.js +0 -22
  71. package/lib/commands/scaffolding/ScaffoldInit.js +0 -15
  72. package/lib/commands/scaffolding/index.js +0 -1
  73. package/lib/config/EnvVariables.js +0 -59
  74. package/lib/config/PublishDetails.js +0 -915
  75. package/lib/config/S3StorageManager.js +0 -93
  76. package/lib/config/index.js +0 -2
  77. package/lib/generated/config_obj.json +0 -1
  78. package/lib/generated/config_schema.json +0 -1
  79. package/lib/prebuild_schema/publishing_source.yaml +0 -64
  80. package/lib/prebuild_schema/schemagen.js +0 -25
  81. package/lib/upload/CachedStorageDriver.js +0 -458
  82. package/lib/upload/TurboStorageDriver.js +0 -718
  83. package/lib/upload/__tests__/CachedStorageDriver.test.js +0 -437
  84. package/lib/upload/__tests__/TurboStorageDriver.test.js +0 -17
  85. package/lib/upload/__tests__/contentGateway.test.js +0 -17
  86. package/lib/upload/contentGateway.js +0 -23
  87. package/lib/upload/index.js +0 -2
  88. package/src/commands/ValidateCommand.ts +0 -82
  89. package/src/commands/create/CreateCliApp.ts +0 -93
  90. package/src/commands/create/CreateCliRelease.ts +0 -149
  91. package/src/commands/create/index.ts +0 -47
  92. package/src/commands/index.ts +0 -3
  93. package/src/commands/publish/PublishCliRemove.ts +0 -66
  94. package/src/commands/publish/PublishCliSubmit.ts +0 -93
  95. package/src/commands/publish/PublishCliSupport.ts +0 -66
  96. package/src/commands/publish/PublishCliUpdate.ts +0 -101
  97. package/src/commands/publish/index.ts +0 -29
  98. package/src/commands/scaffolding/ScaffoldInit.ts +0 -20
  99. package/src/commands/scaffolding/index.ts +0 -1
  100. package/src/commands/utils.ts +0 -33
  101. package/src/config/EnvVariables.ts +0 -39
  102. package/src/config/PublishDetails.ts +0 -456
  103. package/src/config/S3StorageManager.ts +0 -47
  104. package/src/config/index.ts +0 -2
  105. package/src/prebuild_schema/publishing_source.yaml +0 -64
  106. package/src/prebuild_schema/schemagen.js +0 -31
  107. package/src/upload/CachedStorageDriver.ts +0 -179
  108. package/src/upload/TurboStorageDriver.ts +0 -283
  109. package/src/upload/__tests__/CachedStorageDriver.test.ts +0 -246
  110. package/src/upload/__tests__/TurboStorageDriver.test.ts +0 -15
  111. package/src/upload/__tests__/contentGateway.test.ts +0 -31
  112. package/src/upload/contentGateway.ts +0 -37
  113. package/src/upload/index.ts +0 -2
@@ -118,63 +118,42 @@ function _ts_generator(thisArg, body) {
118
118
  };
119
119
  }
120
120
  }
121
- import { Connection } from "@solana/web3.js";
122
- import { publishRemove } from "@solana-mobile/dapp-store-publishing-tools";
123
- import { checkMintedStatus } from "../../CliUtils.js";
124
- import nacl from "tweetnacl";
125
- import { loadPublishDetailsWithChecks } from "../../config/PublishDetails.js";
126
- export var publishRemoveCommand = function(param) {
127
- var appMintAddress = param.appMintAddress, releaseMintAddress = param.releaseMintAddress, signer = param.signer, url = param.url, _param_dryRun = param.dryRun, dryRun = _param_dryRun === void 0 ? false : _param_dryRun, _param_requestorIsAuthorized = param.requestorIsAuthorized, requestorIsAuthorized = _param_requestorIsAuthorized === void 0 ? false : _param_requestorIsAuthorized, _param_critical = param.critical, critical = _param_critical === void 0 ? false : _param_critical;
128
- return _async_to_generator(function() {
129
- var connection, _ref, publisherDetails, appDetails, releaseDetails, sign, appAddr, releaseAddr;
130
- return _ts_generator(this, function(_state) {
131
- switch(_state.label){
132
- case 0:
133
- if (!requestorIsAuthorized) {
134
- console.error("ERROR: Cannot submit a request for which the requestor does not attest they are authorized to do so");
135
- return [
136
- 2
137
- ];
138
- }
139
- connection = new Connection(url, {
140
- commitment: "confirmed"
141
- });
142
- return [
143
- 4,
144
- loadPublishDetailsWithChecks()
145
- ];
146
- case 1:
147
- _ref = _state.sent(), publisherDetails = _ref.publisher, appDetails = _ref.app, releaseDetails = _ref.release;
148
- sign = function(buf) {
149
- return nacl.sign(buf, signer.secretKey);
150
- };
151
- appAddr = appMintAddress !== null && appMintAddress !== void 0 ? appMintAddress : appDetails.address;
152
- releaseAddr = releaseMintAddress !== null && releaseMintAddress !== void 0 ? releaseMintAddress : releaseDetails.address;
153
- return [
154
- 4,
155
- checkMintedStatus(connection, appAddr, releaseAddr)
156
- ];
157
- case 2:
158
- _state.sent();
121
+ import fs from 'node:fs';
122
+ import { Keypair } from '@solana/web3.js';
123
+ import nacl from 'tweetnacl';
124
+ import { createPublicationSigner } from '@solana-mobile/dapp-store-publishing-tools';
125
+ import { showMessage } from './messages.js';
126
+ export var parseKeypair = function(pathToKeypairFile) {
127
+ try {
128
+ var keypairFile = fs.readFileSync(pathToKeypairFile, 'utf-8');
129
+ return Keypair.fromSecretKey(Buffer.from(JSON.parse(keypairFile)));
130
+ } catch (e) {
131
+ showMessage('KeyPair Error', 'Something went wrong when attempting to retrieve the keypair at ' + pathToKeypairFile, 'error');
132
+ }
133
+ };
134
+ export function createPublicationSignerFromKeypair(keypair) {
135
+ return createPublicationSigner({
136
+ publicKey: keypair.publicKey.toBase58(),
137
+ signTransaction: function(transaction) {
138
+ return _async_to_generator(function() {
139
+ return _ts_generator(this, function(_state) {
140
+ transaction.partialSign(keypair);
159
141
  return [
160
- 4,
161
- publishRemove({
162
- connection: connection,
163
- sign: sign
164
- }, {
165
- appMintAddress: appMintAddress !== null && appMintAddress !== void 0 ? appMintAddress : appDetails.address,
166
- releaseMintAddress: releaseMintAddress !== null && releaseMintAddress !== void 0 ? releaseMintAddress : releaseDetails.address,
167
- publisherDetails: publisherDetails,
168
- requestorIsAuthorized: requestorIsAuthorized,
169
- criticalUpdate: critical
170
- }, dryRun)
142
+ 2,
143
+ transaction
171
144
  ];
172
- case 3:
173
- _state.sent();
145
+ });
146
+ })();
147
+ },
148
+ signMessage: function(message) {
149
+ return _async_to_generator(function() {
150
+ return _ts_generator(this, function(_state) {
174
151
  return [
175
- 2
152
+ 2,
153
+ nacl.sign.detached(message, keypair.secretKey)
176
154
  ];
177
- }
178
- });
179
- })();
180
- };
155
+ });
156
+ })();
157
+ }
158
+ });
159
+ }
package/lib/index.js CHANGED
@@ -27,6 +27,58 @@ function _async_to_generator(fn) {
27
27
  });
28
28
  };
29
29
  }
30
+ function _define_property(obj, key, value) {
31
+ if (key in obj) {
32
+ Object.defineProperty(obj, key, {
33
+ value: value,
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true
37
+ });
38
+ } else {
39
+ obj[key] = value;
40
+ }
41
+ return obj;
42
+ }
43
+ function _object_spread(target) {
44
+ for(var i = 1; i < arguments.length; i++){
45
+ var source = arguments[i] != null ? arguments[i] : {};
46
+ var ownKeys = Object.keys(source);
47
+ if (typeof Object.getOwnPropertySymbols === "function") {
48
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
49
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
50
+ }));
51
+ }
52
+ ownKeys.forEach(function(key) {
53
+ _define_property(target, key, source[key]);
54
+ });
55
+ }
56
+ return target;
57
+ }
58
+ function ownKeys(object, enumerableOnly) {
59
+ var keys = Object.keys(object);
60
+ if (Object.getOwnPropertySymbols) {
61
+ var symbols = Object.getOwnPropertySymbols(object);
62
+ if (enumerableOnly) {
63
+ symbols = symbols.filter(function(sym) {
64
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
65
+ });
66
+ }
67
+ keys.push.apply(keys, symbols);
68
+ }
69
+ return keys;
70
+ }
71
+ function _object_spread_props(target, source) {
72
+ source = source != null ? source : {};
73
+ if (Object.getOwnPropertyDescriptors) {
74
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
75
+ } else {
76
+ ownKeys(Object(source)).forEach(function(key) {
77
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
78
+ });
79
+ }
80
+ return target;
81
+ }
30
82
  function _ts_generator(thisArg, body) {
31
83
  var f, y, t, _ = {
32
84
  label: 0,
@@ -118,23 +170,62 @@ function _ts_generator(thisArg, body) {
118
170
  };
119
171
  }
120
172
  }
173
+ import { showMessage } from "./CliUtils.js";
121
174
  import { mainCli } from "./CliSetup.js";
122
- function main() {
175
+ import { getCommanderUserFacingError, isCommanderLifecycleExit } from "./cli/parseErrors.js";
176
+ export function main() {
123
177
  return _async_to_generator(function() {
178
+ var argv, outputConfig, error, userFacingError;
179
+ var _arguments = arguments;
124
180
  return _ts_generator(this, function(_state) {
125
181
  switch(_state.label){
126
182
  case 0:
183
+ argv = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : process.argv;
184
+ mainCli.showHelpAfterError(false);
185
+ mainCli.exitOverride();
186
+ outputConfig = mainCli.configureOutput();
187
+ mainCli.configureOutput(_object_spread_props(_object_spread({}, outputConfig), {
188
+ outputError: function outputError() {}
189
+ }));
190
+ _state.label = 1;
191
+ case 1:
192
+ _state.trys.push([
193
+ 1,
194
+ 3,
195
+ ,
196
+ 4
197
+ ]);
127
198
  return [
128
199
  4,
129
- mainCli.parseAsync(process.argv)
200
+ mainCli.parseAsync(argv)
130
201
  ];
131
- case 1:
202
+ case 2:
132
203
  _state.sent();
204
+ return [
205
+ 3,
206
+ 4
207
+ ];
208
+ case 3:
209
+ error = _state.sent();
210
+ if (isCommanderLifecycleExit(error)) {
211
+ return [
212
+ 2
213
+ ];
214
+ }
215
+ userFacingError = getCommanderUserFacingError(error);
216
+ if (userFacingError) {
217
+ showMessage("Error", userFacingError.message, "error");
218
+ process.exitCode = userFacingError.exitCode;
219
+ return [
220
+ 2
221
+ ];
222
+ }
223
+ throw error;
224
+ case 4:
133
225
  return [
134
226
  2
135
227
  ];
136
228
  }
137
229
  });
138
- })();
230
+ }).apply(this, arguments);
139
231
  }
140
- main();
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana-mobile/dapp-store-cli",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -28,49 +28,30 @@
28
28
  },
29
29
  "scripts": {
30
30
  "clean": "shx mkdir -p lib && shx rm -rf lib",
31
- "prebuild": "pnpm run clean && node src/prebuild_schema/schemagen.js",
31
+ "prebuild": "pnpm run clean",
32
32
  "build": "swc src -d lib --copy-files",
33
33
  "watch": "swc src --out-dir lib -w",
34
34
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@jest/globals": "^29.5.0",
38
- "@jest/types": "^29.5.0",
39
- "@metaplex-foundation/js": "0.20.0",
38
+ "@metaplex-foundation/mpl-token-metadata": "2.13.0",
40
39
  "@swc/jest": "^0.2.26",
41
- "@types/commander": "^2.12.2",
42
- "@types/debug": "^4.1.7",
43
40
  "@types/jest": "^29.5.1",
44
- "@types/js-yaml": "^4.0.5",
45
- "@types/terminal-link": "^1.2.0",
46
41
  "@types/update-notifier": "^6.0.1",
47
42
  "jest": "^29.5.0",
48
- "jest-transform-stub": "^2.0.0",
49
- "shx": "^0.3.4",
50
- "ts-jest": "^29.1.0",
51
- "ts-node": "^10.9.1"
43
+ "shx": "^0.3.4"
52
44
  },
53
45
  "dependencies": {
54
- "@ardrive/turbo-sdk": "^1.41.0",
55
- "@aws-sdk/client-s3": "^3.321.1",
56
- "@metaplex-foundation/js-plugin-aws": "^0.20.0",
57
- "@solana-mobile/dapp-store-publishing-tools": "workspace:0.16.0",
46
+ "@solana-mobile/dapp-store-publishing-tools": "workspace:0.16.1",
58
47
  "@solana/web3.js": "1.92.1",
59
48
  "@types/semver": "^7.3.13",
60
- "ajv": "^8.11.0",
61
49
  "boxen": "^7.0.1",
62
- "bs58": "^5.0.0",
63
- "chokidar": "^3.5.3",
64
50
  "commander": "^9.4.1",
65
- "debug": "^4.3.4",
66
51
  "dotenv": "^16.0.3",
67
- "esm": "^3.2.25",
68
- "generate-schema": "^2.6.0",
69
52
  "get-video-dimensions": "^1.0.0",
70
53
  "image-size": "^1.0.2",
71
- "js-yaml": "^4.1.0",
72
54
  "semver": "^7.3.8",
73
- "terminal-link": "^3.0.0",
74
55
  "tweetnacl": "1.0.3",
75
56
  "update-notifier": "^6.0.2"
76
57
  }