@blinkk/editor
Version:
Structured content editor with live previews.
123 lines • 3.83 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UrlLevel = exports.PublishStatus = exports.PingStatus = exports.ProjectTypes = exports.RemoteMediaProviders = exports.catchError = void 0;
const notifications_1 = require("./parts/notifications");
/**
* Catch and announce an api error.
*
* @param error Error from api.
*/
function catchError(error, callback) {
const handler = callback || notifications_1.announceNotification;
// Check for bent status error for failed api call.
if (error.json) {
error.json().then(value => {
const apiError = value;
apiError.level = notifications_1.NotificationLevel.Error;
handler(apiError);
});
return;
}
error = error;
error.level = notifications_1.NotificationLevel.Error;
handler(error);
}
exports.catchError = catchError;
/**
* Remote media providers supported in the editor.
*/
var RemoteMediaProviders;
(function (RemoteMediaProviders) {
RemoteMediaProviders["GCS"] = "GCS";
})(RemoteMediaProviders = exports.RemoteMediaProviders || (exports.RemoteMediaProviders = {}));
/**
* Project types supported in the editor.
*/
var ProjectTypes;
(function (ProjectTypes) {
ProjectTypes["Amagaki"] = "Amagaki";
ProjectTypes["Grow"] = "Grow";
})(ProjectTypes = exports.ProjectTypes || (exports.ProjectTypes = {}));
/**
* Status for the api ping.
*/
var PingStatus;
(function (PingStatus) {
/**
* Api is available.
*/
PingStatus["Ok"] = "Ok";
})(PingStatus = exports.PingStatus || (exports.PingStatus = {}));
/**
* Status for the publish process.
*/
var PublishStatus;
(function (PublishStatus) {
/**
* There are no publish processes allowed.
*
* Some workspaces may not allow for publishing.
* For example the `main` branch has no where to be published.
*/
PublishStatus["NotAllowed"] = "NotAllowed";
/**
* There are no active publish processes.
*/
PublishStatus["NotStarted"] = "NotStarted";
/**
* There are no changes to publish.
*
* For example, the main branch and the current branch are on the same
* commit and there is nothing to publish.
*/
PublishStatus["NoChanges"] = "NoChanges";
/**
* There is an active publish in process.
*/
PublishStatus["Pending"] = "Pending";
/**
* The publish process has completed.
*/
PublishStatus["Complete"] = "Complete";
/**
* There was a problem during the publish process.
*/
PublishStatus["Failure"] = "Failure";
})(PublishStatus = exports.PublishStatus || (exports.PublishStatus = {}));
/**
* Editor url accessibility level for a resource.
*/
var UrlLevel;
(function (UrlLevel) {
/**
* Private url, should not be shared to others and not public.
*
* For example, the editor preview url. It should not be shared
* widely due to the transitive nature of workspaces, but can
* still be used to viewed when needed.
*/
UrlLevel["Private"] = "Private";
/**
* Protected url, a shared service that is used for sharing
* but still restricted in how it is accessed.
*
* For example, a staging server to preview changes before
* they are live.
*/
UrlLevel["Protected"] = "Protected";
/**
* Public url, a publicly accessbile way to access the resource.
*
* For example, the live version of the site that users normally
* see.
*/
UrlLevel["Public"] = "Public";
/**
* Source url, a remotely hosted version of the resource.
*
* For example, a url that shows the resource in a repository
* like github.
*/
UrlLevel["Source"] = "Source";
})(UrlLevel = exports.UrlLevel || (exports.UrlLevel = {}));
//# sourceMappingURL=api.js.map