@simulacrum/github-api-simulator
Version:
Provides common functionality to frontend app and plugins.
29 lines • 2.46 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.githubBlobSchema = exports.githubBranchSchema = exports.githubRepositorySchema = exports.githubOrganizationSchema = exports.githubUserSchema = exports.simulation = void 0;
const foundation_simulator_1 = require("@simulacrum/foundation-simulator");
const index_ts_1 = require("./store/index.js");
const extend_api_ts_1 = require("./extend-api.js");
const index_ts_2 = require("./rest/index.js");
const entities_ts_1 = require("./store/entities.js");
const simulation = (args = {}) => {
var _a, _b, _c, _d;
const parsedInitialState = !(args === null || args === void 0 ? void 0 : args.initialState)
? undefined
: entities_ts_1.gitubInitialStoreSchema.parse(args === null || args === void 0 ? void 0 : args.initialState);
return (0, foundation_simulator_1.createFoundationSimulationServer)({
port: 3300, // default port
simulationContextPage: "/simulation",
extendStore: (0, index_ts_1.extendStore)(parsedInitialState, (_a = args === null || args === void 0 ? void 0 : args.extend) === null || _a === void 0 ? void 0 : _a.extendStore),
extendRouter: extend_api_ts_1.extendRouter,
openapi: (0, index_ts_2.openapi)(parsedInitialState, (_b = args === null || args === void 0 ? void 0 : args.apiUrl) !== null && _b !== void 0 ? _b : "/", (_c = args === null || args === void 0 ? void 0 : args.apiSchema) !== null && _c !== void 0 ? _c : "api.github.com.json", (_d = args === null || args === void 0 ? void 0 : args.extend) === null || _d === void 0 ? void 0 : _d.openapiHandlers),
})();
};
exports.simulation = simulation;
var entities_ts_2 = require("./store/entities.js");
Object.defineProperty(exports, "githubUserSchema", { enumerable: true, get: function () { return entities_ts_2.githubUserSchema; } });
Object.defineProperty(exports, "githubOrganizationSchema", { enumerable: true, get: function () { return entities_ts_2.githubOrganizationSchema; } });
Object.defineProperty(exports, "githubRepositorySchema", { enumerable: true, get: function () { return entities_ts_2.githubRepositorySchema; } });
Object.defineProperty(exports, "githubBranchSchema", { enumerable: true, get: function () { return entities_ts_2.githubBranchSchema; } });
Object.defineProperty(exports, "githubBlobSchema", { enumerable: true, get: function () { return entities_ts_2.githubBlobSchema; } });
//# sourceMappingURL=index.js.map
;