MCPcopy Create free account
hub / github.com/callstack/agent-device / normalizeInstallSource

Function normalizeInstallSource

src/commands/management/runtime/admin.ts:222–238  ·  view source on GitHub ↗
(source: BackendInstallSource | undefined)

Source from the content-addressed store, hash-verified

220}
221
222function normalizeInstallSource(source: BackendInstallSource | undefined): BackendInstallSource {
223 if (!source || typeof source !== 'object') {
224 throw new AppError('INVALID_ARGS', 'install source is required');
225 }
226 if (source.kind === 'path') {
227 return { kind: 'path', path: requireText(source.path, 'source.path') };
228 }
229 if (source.kind === 'uploadedArtifact') {
230 return { kind: 'uploadedArtifact', id: requireText(source.id, 'source.id') };
231 }
232 if (source.kind === 'url') {
233 const url = requireText(source.url, 'source.url');
234 assertHttpUrl(url);
235 return { kind: 'url', url };
236 }
237 throw new AppError('INVALID_ARGS', 'install source kind must be path, uploadedArtifact, or url');
238}
239
240function assertHttpUrl(url: string): void {
241 let parsed: URL;

Callers 1

resolveInstallSourceFunction · 0.85

Calls 2

requireTextFunction · 0.90
assertHttpUrlFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…