npm package diff

Package: @forge/runtime

Versions: 6.0.0-next.0-experimental-97e4b11 - 6.0.0-next.1

File: package/out/app-manifest.js

Index: package/out/app-manifest.js
===================================================================
--- package/out/app-manifest.js
+++ package/out/app-manifest.js
@@ -1,83 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.AppManifest = void 0;
-const tslib_1 = require("tslib");
-const fs_1 = require("fs");
-const t = tslib_1.__importStar(require("io-ts"));
-const yaml_1 = tslib_1.__importDefault(require("yaml"));
-const path_1 = tslib_1.__importDefault(require("path"));
-const url_1 = require("url");
-const bearerMethodShorthands = t.union([
-    t.literal('authorization-header'),
-    t.literal('form-encoded'),
-    t.literal('uri-query')
-]);
-const bearerMethodOptions = t.intersection([
-    t.type({
-        type: bearerMethodShorthands
-    }),
-    t.partial({
-        parameter: t.string,
-        prefix: t.string
-    })
-]);
-const bearerMethodFields = t.union([bearerMethodShorthands, bearerMethodOptions]);
-const AuthProviderCheckedType = t.type({
-    key: t.string,
-    bearerMethod: bearerMethodFields,
-    remotes: t.array(t.string)
-});
-const urlString = new t.Type('string', (input) => typeof input === 'string' && new url_1.URL(input) && true, (input, context) => (typeof input === 'string' ? t.success(input) : t.failure(input, context)), t.identity);
-const AppManifestOptionalFields = t.partial({
-    egress: t.array(t.string),
-    remotes: t.array(t.type({
-        key: t.string,
-        baseUrl: urlString
-    })),
-    providers: t.type({
-        auth: t.array(AuthProviderCheckedType)
-    })
-});
-const AppManifestRequiredFields = t.type({
-    app: t.type({
-        id: t.string
-    })
-});
-const AppManifestType = t.intersection([AppManifestRequiredFields, AppManifestOptionalFields]);
-class AppManifest {
-    static FILE_NAME = 'manifest.yml';
-    static async fromFile(filePath) {
-        const fullPath = path_1.default.join(filePath, AppManifest.FILE_NAME);
-        const manifestContents = (0, fs_1.readFileSync)(fullPath, 'utf-8');
-        const manifest = yaml_1.default.parse(manifestContents);
-        return new AppManifest(manifest);
-    }
-    manifest;
-    constructor(manifest) {
-        if (!AppManifestType.is(manifest)) {
-            throw new Error('invalid manifest');
-        }
-        else {
-            this.manifest = manifest;
-        }
-    }
-    getHostForRemote(remote) {
-        const found = this.manifest.remotes?.find(({ key }) => key === remote);
-        return found?.baseUrl;
-    }
-    getDefaultRemoteForProvider(provider) {
-        const providerConfig = this.getExternalAuthProviderConfig(provider);
-        const remotes = providerConfig?.remotes;
-        if (remotes && remotes.length > 0) {
-            return remotes[0];
-        }
-        return undefined;
-    }
-    getExternalAuthProviderConfig(provider) {
-        return this.manifest.providers?.auth.find((v) => v.key === provider);
-    }
-    getEgressAllowlist() {
-        return this.manifest.egress || [];
-    }
-}
-exports.AppManifest = AppManifest;