@solana-mobile/dapp-store-cli 0.16.0 → 1.0.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.
- package/bin/dapp-store.js +3 -1
- package/lib/CliSetup.js +304 -505
- package/lib/CliUtils.js +6 -376
- package/lib/__tests__/CliSetupTest.js +484 -74
- package/lib/cli/__tests__/parseErrors.test.js +25 -0
- package/lib/cli/__tests__/signer.test.js +436 -0
- package/lib/cli/constants.js +23 -0
- package/lib/cli/messages.js +21 -0
- package/lib/cli/parseErrors.js +41 -0
- package/lib/{commands/publish/PublishCliSupport.js → cli/selfUpdate.js} +72 -38
- package/lib/{commands/publish/PublishCliRemove.js → cli/signer.js} +35 -56
- package/lib/index.js +96 -5
- package/lib/package.json +5 -24
- package/lib/portal/__tests__/releaseMetadata.test.js +647 -0
- package/lib/portal/__tests__/translators.test.js +76 -0
- package/lib/portal/__tests__/workflowClient.test.js +457 -0
- package/lib/portal/attestationClient.js +143 -0
- package/lib/portal/files.js +64 -0
- package/lib/portal/http.js +364 -0
- package/lib/portal/records.js +64 -0
- package/lib/portal/releaseMetadata.js +748 -0
- package/lib/portal/translators.js +460 -0
- package/lib/portal/types.js +1 -0
- package/lib/portal/workflowClient.js +704 -0
- package/lib/publication/PublicationProgressReporter.js +1051 -0
- package/lib/publication/__tests__/PublicationProgressReporter.test.js +174 -0
- package/lib/{commands/ValidateCommand.js → publication/__tests__/fundingPreflight.test.js} +90 -66
- package/lib/publication/__tests__/publicationSummary.test.js +26 -0
- package/lib/publication/cliValidation.js +482 -0
- package/lib/publication/fundingPreflight.js +246 -0
- package/lib/publication/publicationSummary.js +99 -0
- package/lib/{commands/utils.js → publication/runPublicationWorkflow.js} +16 -46
- package/package.json +5 -24
- package/src/CliSetup.ts +370 -505
- package/src/CliUtils.ts +9 -233
- package/src/__tests__/CliSetupTest.ts +272 -120
- package/src/cli/__tests__/parseErrors.test.ts +34 -0
- package/src/cli/__tests__/signer.test.ts +359 -0
- package/src/cli/constants.ts +3 -0
- package/src/cli/messages.ts +27 -0
- package/src/cli/parseErrors.ts +62 -0
- package/src/cli/selfUpdate.ts +59 -0
- package/src/cli/signer.ts +38 -0
- package/src/index.ts +31 -4
- package/src/portal/__tests__/releaseMetadata.test.ts +508 -0
- package/src/portal/__tests__/translators.test.ts +82 -0
- package/src/portal/__tests__/workflowClient.test.ts +278 -0
- package/src/portal/attestationClient.ts +19 -0
- package/src/portal/files.ts +73 -0
- package/src/portal/http.ts +170 -0
- package/src/portal/records.ts +38 -0
- package/src/portal/releaseMetadata.ts +489 -0
- package/src/portal/translators.ts +750 -0
- package/src/portal/types.ts +27 -0
- package/src/portal/workflowClient.ts +575 -0
- package/src/publication/PublicationProgressReporter.ts +1026 -0
- package/src/publication/__tests__/PublicationProgressReporter.test.ts +210 -0
- package/src/publication/__tests__/fundingPreflight.test.ts +78 -0
- package/src/publication/__tests__/publicationSummary.test.ts +30 -0
- package/src/publication/cliValidation.ts +264 -0
- package/src/publication/fundingPreflight.ts +123 -0
- package/src/publication/publicationSummary.ts +26 -0
- package/src/publication/runPublicationWorkflow.ts +46 -0
- package/lib/commands/create/CreateCliApp.js +0 -223
- package/lib/commands/create/CreateCliRelease.js +0 -290
- package/lib/commands/create/index.js +0 -40
- package/lib/commands/index.js +0 -3
- package/lib/commands/publish/PublishCliSubmit.js +0 -208
- package/lib/commands/publish/PublishCliUpdate.js +0 -211
- package/lib/commands/publish/index.js +0 -22
- package/lib/commands/scaffolding/ScaffoldInit.js +0 -15
- package/lib/commands/scaffolding/index.js +0 -1
- package/lib/config/EnvVariables.js +0 -59
- package/lib/config/PublishDetails.js +0 -915
- package/lib/config/S3StorageManager.js +0 -93
- package/lib/config/index.js +0 -2
- package/lib/generated/config_obj.json +0 -1
- package/lib/generated/config_schema.json +0 -1
- package/lib/prebuild_schema/publishing_source.yaml +0 -64
- package/lib/prebuild_schema/schemagen.js +0 -25
- package/lib/upload/CachedStorageDriver.js +0 -458
- package/lib/upload/TurboStorageDriver.js +0 -718
- package/lib/upload/__tests__/CachedStorageDriver.test.js +0 -437
- package/lib/upload/__tests__/TurboStorageDriver.test.js +0 -17
- package/lib/upload/__tests__/contentGateway.test.js +0 -17
- package/lib/upload/contentGateway.js +0 -23
- package/lib/upload/index.js +0 -2
- package/src/commands/ValidateCommand.ts +0 -82
- package/src/commands/create/CreateCliApp.ts +0 -93
- package/src/commands/create/CreateCliRelease.ts +0 -149
- package/src/commands/create/index.ts +0 -47
- package/src/commands/index.ts +0 -3
- package/src/commands/publish/PublishCliRemove.ts +0 -66
- package/src/commands/publish/PublishCliSubmit.ts +0 -93
- package/src/commands/publish/PublishCliSupport.ts +0 -66
- package/src/commands/publish/PublishCliUpdate.ts +0 -101
- package/src/commands/publish/index.ts +0 -29
- package/src/commands/scaffolding/ScaffoldInit.ts +0 -20
- package/src/commands/scaffolding/index.ts +0 -1
- package/src/commands/utils.ts +0 -33
- package/src/config/EnvVariables.ts +0 -39
- package/src/config/PublishDetails.ts +0 -456
- package/src/config/S3StorageManager.ts +0 -47
- package/src/config/index.ts +0 -2
- package/src/prebuild_schema/publishing_source.yaml +0 -64
- package/src/prebuild_schema/schemagen.js +0 -31
- package/src/upload/CachedStorageDriver.ts +0 -179
- package/src/upload/TurboStorageDriver.ts +0 -283
- package/src/upload/__tests__/CachedStorageDriver.test.ts +0 -246
- package/src/upload/__tests__/TurboStorageDriver.test.ts +0 -15
- package/src/upload/__tests__/contentGateway.test.ts +0 -31
- package/src/upload/contentGateway.ts +0 -37
- package/src/upload/index.ts +0 -2
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _async_to_generator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
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 _type_of(obj) {
|
|
59
|
+
"@swc/helpers - typeof";
|
|
60
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
61
|
+
}
|
|
62
|
+
function _ts_generator(thisArg, body) {
|
|
63
|
+
var f, y, t, _ = {
|
|
64
|
+
label: 0,
|
|
65
|
+
sent: function() {
|
|
66
|
+
if (t[0] & 1) throw t[1];
|
|
67
|
+
return t[1];
|
|
68
|
+
},
|
|
69
|
+
trys: [],
|
|
70
|
+
ops: []
|
|
71
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
72
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
73
|
+
return this;
|
|
74
|
+
}), g;
|
|
75
|
+
function verb(n) {
|
|
76
|
+
return function(v) {
|
|
77
|
+
return step([
|
|
78
|
+
n,
|
|
79
|
+
v
|
|
80
|
+
]);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function step(op) {
|
|
84
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
85
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
86
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
87
|
+
if (y = 0, t) op = [
|
|
88
|
+
op[0] & 2,
|
|
89
|
+
t.value
|
|
90
|
+
];
|
|
91
|
+
switch(op[0]){
|
|
92
|
+
case 0:
|
|
93
|
+
case 1:
|
|
94
|
+
t = op;
|
|
95
|
+
break;
|
|
96
|
+
case 4:
|
|
97
|
+
_.label++;
|
|
98
|
+
return {
|
|
99
|
+
value: op[1],
|
|
100
|
+
done: false
|
|
101
|
+
};
|
|
102
|
+
case 5:
|
|
103
|
+
_.label++;
|
|
104
|
+
y = op[1];
|
|
105
|
+
op = [
|
|
106
|
+
0
|
|
107
|
+
];
|
|
108
|
+
continue;
|
|
109
|
+
case 7:
|
|
110
|
+
op = _.ops.pop();
|
|
111
|
+
_.trys.pop();
|
|
112
|
+
continue;
|
|
113
|
+
default:
|
|
114
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
115
|
+
_ = 0;
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
119
|
+
_.label = op[1];
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
123
|
+
_.label = t[1];
|
|
124
|
+
t = op;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
if (t && _.label < t[2]) {
|
|
128
|
+
_.label = t[2];
|
|
129
|
+
_.ops.push(op);
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
if (t[2]) _.ops.pop();
|
|
133
|
+
_.trys.pop();
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
op = body.call(thisArg, _);
|
|
137
|
+
} catch (e) {
|
|
138
|
+
op = [
|
|
139
|
+
6,
|
|
140
|
+
e
|
|
141
|
+
];
|
|
142
|
+
y = 0;
|
|
143
|
+
} finally{
|
|
144
|
+
f = t = 0;
|
|
145
|
+
}
|
|
146
|
+
if (op[0] & 5) throw op[1];
|
|
147
|
+
return {
|
|
148
|
+
value: op[0] ? op[1] : void 0,
|
|
149
|
+
done: true
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
import fs from "node:fs";
|
|
154
|
+
import { createHash } from "node:crypto";
|
|
155
|
+
import path from "node:path";
|
|
156
|
+
import { ensureApkFileName, fromBase64, inferFileNameFromUrl, toBase64 } from "./files.js";
|
|
157
|
+
import { callCreateIngestionSessionWithRetry, callPortalProcedure, uploadBytes } from "./http.js";
|
|
158
|
+
import { asRecord, isRecord } from "./records.js";
|
|
159
|
+
import { inferPublicationSourceKind, mapBackendBundleToPublicationBundle, translateBackendIngestionSession, translateBackendPublicationSession } from "./translators.js";
|
|
160
|
+
import { buildReleaseMetadataDocument } from "./releaseMetadata.js";
|
|
161
|
+
function createWorkflowClientState() {
|
|
162
|
+
return {
|
|
163
|
+
metadataUriByReleaseId: new Map(),
|
|
164
|
+
publicationSessionIdByReleaseId: new Map()
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function rememberLinkedPublicationSession(state, releaseId, publicationSessionId) {
|
|
168
|
+
if (releaseId && publicationSessionId) {
|
|
169
|
+
state.publicationSessionIdByReleaseId.set(releaseId, publicationSessionId);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function trackBackendIdentifiers(state, backendResult) {
|
|
173
|
+
if (typeof backendResult.releaseId === "string") {
|
|
174
|
+
state.currentReleaseId = backendResult.releaseId;
|
|
175
|
+
}
|
|
176
|
+
if (typeof backendResult.publicationSessionId === "string") {
|
|
177
|
+
state.currentPublicationSessionId = backendResult.publicationSessionId;
|
|
178
|
+
}
|
|
179
|
+
rememberLinkedPublicationSession(state, state.currentReleaseId, state.currentPublicationSessionId);
|
|
180
|
+
}
|
|
181
|
+
function trackTranslatedIngestionSession(state, session) {
|
|
182
|
+
rememberLinkedPublicationSession(state, session.releaseId, session.publicationSessionId);
|
|
183
|
+
if (session.publicationSessionId) {
|
|
184
|
+
state.currentPublicationSessionId = session.publicationSessionId;
|
|
185
|
+
} else if (session.publicationSession) {
|
|
186
|
+
state.currentPublicationSessionId = session.publicationSession.id;
|
|
187
|
+
}
|
|
188
|
+
if (session.releaseId) {
|
|
189
|
+
state.currentReleaseId = session.releaseId;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function readLocalSourceFileOrThrow(filePath) {
|
|
193
|
+
try {
|
|
194
|
+
return fs.readFileSync(filePath);
|
|
195
|
+
} catch (error) {
|
|
196
|
+
var code = error && (typeof error === "undefined" ? "undefined" : _type_of(error)) === "object" && "code" in error ? String(error.code || "") : "";
|
|
197
|
+
if (code === "EPERM" || code === "EACCES") {
|
|
198
|
+
throw new Error("Cannot read local APK at ".concat(filePath, ". macOS denied access to this location (").concat(code, "). Move the APK out of Downloads into your workspace or another accessible folder, or grant this app Full Disk Access, then retry."));
|
|
199
|
+
}
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
export function createPortalWorkflowClient(config) {
|
|
204
|
+
var state = createWorkflowClientState();
|
|
205
|
+
var createUploadTarget = function(input) {
|
|
206
|
+
return _async_to_generator(function() {
|
|
207
|
+
return _ts_generator(this, function(_state) {
|
|
208
|
+
switch(_state.label){
|
|
209
|
+
case 0:
|
|
210
|
+
return [
|
|
211
|
+
4,
|
|
212
|
+
callPortalProcedure(config, "publication.createUploadTarget", input, "mutation")
|
|
213
|
+
];
|
|
214
|
+
case 1:
|
|
215
|
+
return [
|
|
216
|
+
2,
|
|
217
|
+
_state.sent()
|
|
218
|
+
];
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
})();
|
|
222
|
+
};
|
|
223
|
+
var translateIngestionBackendResult = function(backendResult) {
|
|
224
|
+
var translated = translateBackendIngestionSession(backendResult, asRecord(backendResult.bundle), asRecord(backendResult.publicationSession));
|
|
225
|
+
trackTranslatedIngestionSession(state, translated);
|
|
226
|
+
return translated;
|
|
227
|
+
};
|
|
228
|
+
var uploadReleaseMetadata = function(bundle) {
|
|
229
|
+
return _async_to_generator(function() {
|
|
230
|
+
var releaseId, cached, releaseMetadataClient, metadataDocument, metadataBytes, fileHash, uploadTarget;
|
|
231
|
+
return _ts_generator(this, function(_state) {
|
|
232
|
+
switch(_state.label){
|
|
233
|
+
case 0:
|
|
234
|
+
releaseId = bundle.releaseId;
|
|
235
|
+
cached = state.metadataUriByReleaseId.get(releaseId);
|
|
236
|
+
if (cached) {
|
|
237
|
+
return [
|
|
238
|
+
2,
|
|
239
|
+
cached
|
|
240
|
+
];
|
|
241
|
+
}
|
|
242
|
+
if (typeof bundle.release.releaseMetadataUri === "string" && bundle.release.releaseMetadataUri.length > 0) {
|
|
243
|
+
state.metadataUriByReleaseId.set(releaseId, bundle.release.releaseMetadataUri);
|
|
244
|
+
return [
|
|
245
|
+
2,
|
|
246
|
+
bundle.release.releaseMetadataUri
|
|
247
|
+
];
|
|
248
|
+
}
|
|
249
|
+
releaseMetadataClient = {
|
|
250
|
+
createUploadTarget: createUploadTarget,
|
|
251
|
+
fetchRemoteFile: function fetchRemoteFile(input) {
|
|
252
|
+
return _async_to_generator(function() {
|
|
253
|
+
return _ts_generator(this, function(_state) {
|
|
254
|
+
switch(_state.label){
|
|
255
|
+
case 0:
|
|
256
|
+
return [
|
|
257
|
+
4,
|
|
258
|
+
callPortalProcedure(config, "fetchRemoteFile", input, "query")
|
|
259
|
+
];
|
|
260
|
+
case 1:
|
|
261
|
+
return [
|
|
262
|
+
2,
|
|
263
|
+
_state.sent()
|
|
264
|
+
];
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
})();
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
return [
|
|
271
|
+
4,
|
|
272
|
+
buildReleaseMetadataDocument(releaseMetadataClient, bundle, inferPublicationSourceKind(bundle.metadata.installFile.origin === "external" ? "externalUrl" : "portalUpload"))
|
|
273
|
+
];
|
|
274
|
+
case 1:
|
|
275
|
+
metadataDocument = _state.sent();
|
|
276
|
+
delete metadataDocument.__origin;
|
|
277
|
+
metadataBytes = Buffer.from(JSON.stringify(metadataDocument), "utf8");
|
|
278
|
+
fileHash = createHash("sha256").update(metadataBytes).digest("hex");
|
|
279
|
+
return [
|
|
280
|
+
4,
|
|
281
|
+
createUploadTarget({
|
|
282
|
+
fileHash: fileHash,
|
|
283
|
+
fileExtension: "json",
|
|
284
|
+
contentType: "application/json"
|
|
285
|
+
})
|
|
286
|
+
];
|
|
287
|
+
case 2:
|
|
288
|
+
uploadTarget = _state.sent();
|
|
289
|
+
return [
|
|
290
|
+
4,
|
|
291
|
+
uploadBytes(uploadTarget.uploadUrl, metadataBytes, "application/json")
|
|
292
|
+
];
|
|
293
|
+
case 3:
|
|
294
|
+
_state.sent();
|
|
295
|
+
state.metadataUriByReleaseId.set(releaseId, uploadTarget.publicUrl);
|
|
296
|
+
return [
|
|
297
|
+
2,
|
|
298
|
+
uploadTarget.publicUrl
|
|
299
|
+
];
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
})();
|
|
303
|
+
};
|
|
304
|
+
return {
|
|
305
|
+
createUploadTarget: function createUploadTarget1(input) {
|
|
306
|
+
return _async_to_generator(function() {
|
|
307
|
+
return _ts_generator(this, function(_state) {
|
|
308
|
+
switch(_state.label){
|
|
309
|
+
case 0:
|
|
310
|
+
return [
|
|
311
|
+
4,
|
|
312
|
+
createUploadTarget(input)
|
|
313
|
+
];
|
|
314
|
+
case 1:
|
|
315
|
+
return [
|
|
316
|
+
2,
|
|
317
|
+
_state.sent()
|
|
318
|
+
];
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
})();
|
|
322
|
+
},
|
|
323
|
+
createIngestionSession: function createIngestionSession(input) {
|
|
324
|
+
return _async_to_generator(function() {
|
|
325
|
+
var dappId, idempotencyKey, source, uploadTarget, backendResult, backendSource, backendResult1;
|
|
326
|
+
return _ts_generator(this, function(_state) {
|
|
327
|
+
switch(_state.label){
|
|
328
|
+
case 0:
|
|
329
|
+
dappId = input.dappId || config.dappId;
|
|
330
|
+
idempotencyKey = input.idempotencyKey || "".concat(Date.now());
|
|
331
|
+
if (!(input.source.kind === "apk-file")) return [
|
|
332
|
+
3,
|
|
333
|
+
4
|
|
334
|
+
];
|
|
335
|
+
source = function() {
|
|
336
|
+
var filePath = path.resolve(input.source.filePath);
|
|
337
|
+
var fileName = ensureApkFileName(input.source.fileName || path.basename(filePath));
|
|
338
|
+
var fileBytes = readLocalSourceFileOrThrow(filePath);
|
|
339
|
+
var fileHash = input.source.sha256 || createHash("sha256").update(fileBytes).digest("hex");
|
|
340
|
+
var _input_source_size;
|
|
341
|
+
return {
|
|
342
|
+
filePath: filePath,
|
|
343
|
+
fileName: fileName,
|
|
344
|
+
fileBytes: fileBytes,
|
|
345
|
+
fileHash: fileHash,
|
|
346
|
+
fileExtension: "apk",
|
|
347
|
+
contentType: input.source.mimeType || "application/vnd.android.package-archive",
|
|
348
|
+
releaseFileSize: (_input_source_size = input.source.size) !== null && _input_source_size !== void 0 ? _input_source_size : fileBytes.byteLength
|
|
349
|
+
};
|
|
350
|
+
}();
|
|
351
|
+
return [
|
|
352
|
+
4,
|
|
353
|
+
createUploadTarget({
|
|
354
|
+
fileHash: source.fileHash,
|
|
355
|
+
fileExtension: source.fileExtension,
|
|
356
|
+
contentType: source.contentType
|
|
357
|
+
})
|
|
358
|
+
];
|
|
359
|
+
case 1:
|
|
360
|
+
uploadTarget = _state.sent();
|
|
361
|
+
return [
|
|
362
|
+
4,
|
|
363
|
+
uploadBytes(uploadTarget.uploadUrl, fromBase64(toBase64(source.fileBytes)), source.contentType)
|
|
364
|
+
];
|
|
365
|
+
case 2:
|
|
366
|
+
_state.sent();
|
|
367
|
+
return [
|
|
368
|
+
4,
|
|
369
|
+
callCreateIngestionSessionWithRetry(config, _object_spread({
|
|
370
|
+
source: {
|
|
371
|
+
kind: "portalUpload",
|
|
372
|
+
releaseFileUrl: uploadTarget.publicUrl,
|
|
373
|
+
releaseFileName: source.fileName,
|
|
374
|
+
releaseFileSize: source.releaseFileSize
|
|
375
|
+
},
|
|
376
|
+
whatsNew: input.whatsNew,
|
|
377
|
+
idempotencyKey: idempotencyKey
|
|
378
|
+
}, dappId ? {
|
|
379
|
+
dappId: dappId
|
|
380
|
+
} : {}))
|
|
381
|
+
];
|
|
382
|
+
case 3:
|
|
383
|
+
backendResult = _state.sent();
|
|
384
|
+
trackBackendIdentifiers(state, backendResult);
|
|
385
|
+
return [
|
|
386
|
+
2,
|
|
387
|
+
translateIngestionBackendResult(backendResult)
|
|
388
|
+
];
|
|
389
|
+
case 4:
|
|
390
|
+
backendSource = input.source.kind === "portalUpload" ? {
|
|
391
|
+
kind: "portalUpload",
|
|
392
|
+
releaseFileUrl: input.source.releaseFileUrl,
|
|
393
|
+
releaseFileName: input.source.releaseFileName,
|
|
394
|
+
releaseFileSize: input.source.releaseFileSize
|
|
395
|
+
} : input.source.kind === "existingRelease" ? {
|
|
396
|
+
kind: "existingRelease",
|
|
397
|
+
sourceReleaseId: input.source.sourceReleaseId
|
|
398
|
+
} : {
|
|
399
|
+
kind: "externalUrl",
|
|
400
|
+
apkUrl: input.source.kind === "externalUrl" ? input.source.apkUrl : input.source.url,
|
|
401
|
+
releaseFileName: input.source.kind === "externalUrl" ? input.source.releaseFileName || inferFileNameFromUrl(input.source.apkUrl) : input.source.fileName || inferFileNameFromUrl(input.source.url)
|
|
402
|
+
};
|
|
403
|
+
return [
|
|
404
|
+
4,
|
|
405
|
+
callCreateIngestionSessionWithRetry(config, _object_spread({
|
|
406
|
+
source: backendSource,
|
|
407
|
+
whatsNew: input.whatsNew,
|
|
408
|
+
idempotencyKey: idempotencyKey
|
|
409
|
+
}, dappId ? {
|
|
410
|
+
dappId: dappId
|
|
411
|
+
} : {}))
|
|
412
|
+
];
|
|
413
|
+
case 5:
|
|
414
|
+
backendResult1 = _state.sent();
|
|
415
|
+
trackBackendIdentifiers(state, backendResult1);
|
|
416
|
+
return [
|
|
417
|
+
2,
|
|
418
|
+
translateIngestionBackendResult(backendResult1)
|
|
419
|
+
];
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
})();
|
|
423
|
+
},
|
|
424
|
+
getIngestionSession: function getIngestionSession(input) {
|
|
425
|
+
return _async_to_generator(function() {
|
|
426
|
+
var resolvedSessionId, backendResult;
|
|
427
|
+
return _ts_generator(this, function(_state) {
|
|
428
|
+
switch(_state.label){
|
|
429
|
+
case 0:
|
|
430
|
+
resolvedSessionId = input.sessionId || ("ingestionSessionId" in input && typeof input.ingestionSessionId === "string" && input.ingestionSessionId.length > 0 ? input.ingestionSessionId : undefined);
|
|
431
|
+
if (!resolvedSessionId) {
|
|
432
|
+
throw new Error("publication.getIngestionSession requires a session id");
|
|
433
|
+
}
|
|
434
|
+
return [
|
|
435
|
+
4,
|
|
436
|
+
callPortalProcedure(config, "publication.getIngestionSession", {
|
|
437
|
+
sessionId: resolvedSessionId
|
|
438
|
+
}, "query")
|
|
439
|
+
];
|
|
440
|
+
case 1:
|
|
441
|
+
backendResult = _state.sent();
|
|
442
|
+
trackBackendIdentifiers(state, backendResult);
|
|
443
|
+
return [
|
|
444
|
+
2,
|
|
445
|
+
translateIngestionBackendResult(backendResult)
|
|
446
|
+
];
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
})();
|
|
450
|
+
},
|
|
451
|
+
getPublicationBundle: function getPublicationBundle(input) {
|
|
452
|
+
return _async_to_generator(function() {
|
|
453
|
+
var backendBundle, linkedPublicationSessionId, linkedPublicationSession, _tmp, releaseMetadataUri, _tmp1, _tmp2, translated;
|
|
454
|
+
return _ts_generator(this, function(_state) {
|
|
455
|
+
switch(_state.label){
|
|
456
|
+
case 0:
|
|
457
|
+
return [
|
|
458
|
+
4,
|
|
459
|
+
callPortalProcedure(config, "publication.getPublicationBundle", {
|
|
460
|
+
releaseId: input.releaseId
|
|
461
|
+
}, "query")
|
|
462
|
+
];
|
|
463
|
+
case 1:
|
|
464
|
+
backendBundle = _state.sent();
|
|
465
|
+
linkedPublicationSessionId = state.publicationSessionIdByReleaseId.get(input.releaseId) || state.currentPublicationSessionId;
|
|
466
|
+
if (!linkedPublicationSessionId) return [
|
|
467
|
+
3,
|
|
468
|
+
3
|
|
469
|
+
];
|
|
470
|
+
return [
|
|
471
|
+
4,
|
|
472
|
+
callPortalProcedure(config, "publication.getPublicationSession", {
|
|
473
|
+
publicationSessionId: linkedPublicationSessionId,
|
|
474
|
+
releaseId: input.releaseId
|
|
475
|
+
}, "query")
|
|
476
|
+
];
|
|
477
|
+
case 2:
|
|
478
|
+
_tmp = translateBackendPublicationSession.apply(void 0, [
|
|
479
|
+
_state.sent()
|
|
480
|
+
]);
|
|
481
|
+
return [
|
|
482
|
+
3,
|
|
483
|
+
4
|
|
484
|
+
];
|
|
485
|
+
case 3:
|
|
486
|
+
_tmp = undefined;
|
|
487
|
+
_state.label = 4;
|
|
488
|
+
case 4:
|
|
489
|
+
linkedPublicationSession = _tmp;
|
|
490
|
+
_tmp1 = state.metadataUriByReleaseId.get(input.releaseId);
|
|
491
|
+
if (_tmp1) return [
|
|
492
|
+
3,
|
|
493
|
+
8
|
|
494
|
+
];
|
|
495
|
+
if (!(isRecord(backendBundle.release) && typeof backendBundle.release.nftMetadataUri === "string" && backendBundle.release.nftMetadataUri.length > 0)) return [
|
|
496
|
+
3,
|
|
497
|
+
5
|
|
498
|
+
];
|
|
499
|
+
_tmp2 = backendBundle.release.nftMetadataUri;
|
|
500
|
+
return [
|
|
501
|
+
3,
|
|
502
|
+
7
|
|
503
|
+
];
|
|
504
|
+
case 5:
|
|
505
|
+
return [
|
|
506
|
+
4,
|
|
507
|
+
uploadReleaseMetadata(mapBackendBundleToPublicationBundle(backendBundle, "", "portal"))
|
|
508
|
+
];
|
|
509
|
+
case 6:
|
|
510
|
+
_tmp2 = _state.sent();
|
|
511
|
+
_state.label = 7;
|
|
512
|
+
case 7:
|
|
513
|
+
_tmp1 = _tmp2;
|
|
514
|
+
_state.label = 8;
|
|
515
|
+
case 8:
|
|
516
|
+
releaseMetadataUri = _tmp1;
|
|
517
|
+
state.metadataUriByReleaseId.set(input.releaseId, releaseMetadataUri);
|
|
518
|
+
translated = mapBackendBundleToPublicationBundle(backendBundle, releaseMetadataUri, inferPublicationSourceKind(state.currentReleaseId && state.publicationSessionIdByReleaseId.has(state.currentReleaseId) ? "portalUpload" : "externalUrl"));
|
|
519
|
+
translated.releaseId = translated.releaseId || input.releaseId;
|
|
520
|
+
translated.publicationSessionId = translated.publicationSessionId || (linkedPublicationSession === null || linkedPublicationSession === void 0 ? void 0 : linkedPublicationSession.id) || state.publicationSessionIdByReleaseId.get(input.releaseId) || state.currentPublicationSessionId || "";
|
|
521
|
+
translated.ingestionSessionId = translated.ingestionSessionId || (linkedPublicationSession === null || linkedPublicationSession === void 0 ? void 0 : linkedPublicationSession.ingestionSessionId) || "";
|
|
522
|
+
state.currentReleaseId = translated.releaseId || state.currentReleaseId;
|
|
523
|
+
state.currentPublicationSessionId = translated.publicationSessionId || state.currentPublicationSessionId;
|
|
524
|
+
rememberLinkedPublicationSession(state, translated.releaseId, translated.publicationSessionId);
|
|
525
|
+
return [
|
|
526
|
+
2,
|
|
527
|
+
translated
|
|
528
|
+
];
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
})();
|
|
532
|
+
},
|
|
533
|
+
getPublicationSession: function getPublicationSession(input) {
|
|
534
|
+
return _async_to_generator(function() {
|
|
535
|
+
var backendResult, translated;
|
|
536
|
+
return _ts_generator(this, function(_state) {
|
|
537
|
+
switch(_state.label){
|
|
538
|
+
case 0:
|
|
539
|
+
return [
|
|
540
|
+
4,
|
|
541
|
+
callPortalProcedure(config, "publication.getPublicationSession", {
|
|
542
|
+
publicationSessionId: input.publicationSessionId || (input.releaseId ? state.publicationSessionIdByReleaseId.get(input.releaseId) : undefined),
|
|
543
|
+
releaseId: input.releaseId
|
|
544
|
+
}, "query")
|
|
545
|
+
];
|
|
546
|
+
case 1:
|
|
547
|
+
backendResult = _state.sent();
|
|
548
|
+
translated = translateBackendPublicationSession(backendResult);
|
|
549
|
+
state.currentPublicationSessionId = translated.id;
|
|
550
|
+
state.currentReleaseId = translated.releaseId || state.currentReleaseId;
|
|
551
|
+
rememberLinkedPublicationSession(state, translated.releaseId, translated.id);
|
|
552
|
+
return [
|
|
553
|
+
2,
|
|
554
|
+
translated
|
|
555
|
+
];
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
})();
|
|
559
|
+
},
|
|
560
|
+
cleanupRelease: function cleanupRelease(input) {
|
|
561
|
+
return _async_to_generator(function() {
|
|
562
|
+
return _ts_generator(this, function(_state) {
|
|
563
|
+
switch(_state.label){
|
|
564
|
+
case 0:
|
|
565
|
+
return [
|
|
566
|
+
4,
|
|
567
|
+
callPortalProcedure(config, "publication.cleanupRelease", input, "mutation")
|
|
568
|
+
];
|
|
569
|
+
case 1:
|
|
570
|
+
return [
|
|
571
|
+
2,
|
|
572
|
+
_state.sent()
|
|
573
|
+
];
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
})();
|
|
577
|
+
},
|
|
578
|
+
prepareReleaseNftTransaction: function prepareReleaseNftTransaction(input) {
|
|
579
|
+
return _async_to_generator(function() {
|
|
580
|
+
return _ts_generator(this, function(_state) {
|
|
581
|
+
switch(_state.label){
|
|
582
|
+
case 0:
|
|
583
|
+
return [
|
|
584
|
+
4,
|
|
585
|
+
callPortalProcedure(config, "publication.prepareReleaseNftTransaction", input, "mutation")
|
|
586
|
+
];
|
|
587
|
+
case 1:
|
|
588
|
+
return [
|
|
589
|
+
2,
|
|
590
|
+
_state.sent()
|
|
591
|
+
];
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
})();
|
|
595
|
+
},
|
|
596
|
+
submitSignedTransaction: function submitSignedTransaction(input) {
|
|
597
|
+
return _async_to_generator(function() {
|
|
598
|
+
return _ts_generator(this, function(_state) {
|
|
599
|
+
switch(_state.label){
|
|
600
|
+
case 0:
|
|
601
|
+
return [
|
|
602
|
+
4,
|
|
603
|
+
callPortalProcedure(config, "publication.submitSignedTransaction", {
|
|
604
|
+
signedTransaction: input.signedTransaction,
|
|
605
|
+
publicationSessionId: input.publicationSessionId || state.currentPublicationSessionId
|
|
606
|
+
}, "mutation")
|
|
607
|
+
];
|
|
608
|
+
case 1:
|
|
609
|
+
return [
|
|
610
|
+
2,
|
|
611
|
+
_state.sent()
|
|
612
|
+
];
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
})();
|
|
616
|
+
},
|
|
617
|
+
saveReleaseNftData: function saveReleaseNftData(input) {
|
|
618
|
+
return _async_to_generator(function() {
|
|
619
|
+
return _ts_generator(this, function(_state) {
|
|
620
|
+
switch(_state.label){
|
|
621
|
+
case 0:
|
|
622
|
+
return [
|
|
623
|
+
4,
|
|
624
|
+
callPortalProcedure(config, "publication.saveReleaseNftData", input, "mutation")
|
|
625
|
+
];
|
|
626
|
+
case 1:
|
|
627
|
+
return [
|
|
628
|
+
2,
|
|
629
|
+
_state.sent()
|
|
630
|
+
];
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
})();
|
|
634
|
+
},
|
|
635
|
+
prepareVerifyCollectionTransaction: function prepareVerifyCollectionTransaction(input) {
|
|
636
|
+
return _async_to_generator(function() {
|
|
637
|
+
return _ts_generator(this, function(_state) {
|
|
638
|
+
switch(_state.label){
|
|
639
|
+
case 0:
|
|
640
|
+
return [
|
|
641
|
+
4,
|
|
642
|
+
callPortalProcedure(config, "publication.prepareVerifyCollectionTransaction", input, "mutation")
|
|
643
|
+
];
|
|
644
|
+
case 1:
|
|
645
|
+
return [
|
|
646
|
+
2,
|
|
647
|
+
_state.sent()
|
|
648
|
+
];
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
})();
|
|
652
|
+
},
|
|
653
|
+
markReleaseCollectionAsVerified: function markReleaseCollectionAsVerified(input) {
|
|
654
|
+
return _async_to_generator(function() {
|
|
655
|
+
return _ts_generator(this, function(_state) {
|
|
656
|
+
switch(_state.label){
|
|
657
|
+
case 0:
|
|
658
|
+
return [
|
|
659
|
+
4,
|
|
660
|
+
callPortalProcedure(config, "publication.markReleaseCollectionAsVerified", input, "mutation")
|
|
661
|
+
];
|
|
662
|
+
case 1:
|
|
663
|
+
return [
|
|
664
|
+
2,
|
|
665
|
+
_state.sent()
|
|
666
|
+
];
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
})();
|
|
670
|
+
},
|
|
671
|
+
submitToStore: function submitToStore(input) {
|
|
672
|
+
return _async_to_generator(function() {
|
|
673
|
+
var attestation, payload, requestUniqueId;
|
|
674
|
+
return _ts_generator(this, function(_state) {
|
|
675
|
+
switch(_state.label){
|
|
676
|
+
case 0:
|
|
677
|
+
attestation = isRecord(input.attestation) ? input.attestation : undefined;
|
|
678
|
+
payload = typeof (attestation === null || attestation === void 0 ? void 0 : attestation.payload) === "string" && attestation.payload.length > 0 ? attestation.payload : typeof (attestation === null || attestation === void 0 ? void 0 : attestation.attestationPayload) === "string" && attestation.attestationPayload.length > 0 ? attestation.attestationPayload : typeof input.attestationPayload === "string" ? String(input.attestationPayload) : "";
|
|
679
|
+
requestUniqueId = typeof (attestation === null || attestation === void 0 ? void 0 : attestation.requestUniqueId) === "string" ? attestation.requestUniqueId : typeof input.requestUniqueId === "string" ? String(input.requestUniqueId) : "";
|
|
680
|
+
return [
|
|
681
|
+
4,
|
|
682
|
+
callPortalProcedure(config, "publication.submitToStore", {
|
|
683
|
+
releaseId: input.releaseId,
|
|
684
|
+
whatsNew: input.whatsNew,
|
|
685
|
+
criticalUpdate: input.criticalUpdate,
|
|
686
|
+
testingInstructions: input.testingInstructions,
|
|
687
|
+
isResubmission: input.isResubmission,
|
|
688
|
+
attestation: {
|
|
689
|
+
payload: payload,
|
|
690
|
+
requestUniqueId: requestUniqueId
|
|
691
|
+
}
|
|
692
|
+
}, "mutation")
|
|
693
|
+
];
|
|
694
|
+
case 1:
|
|
695
|
+
return [
|
|
696
|
+
2,
|
|
697
|
+
_state.sent()
|
|
698
|
+
];
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
})();
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
}
|