Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var apollo_server_micro_1 = require("apollo-server-micro");
var post_1 = require("./post");
var json_placeholder_1 = require("./util/json-placeholder");
exports.typeDefs = apollo_server_micro_1.gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n extend type Query {\n comments(options: PageQueryOptions): CommentsPage\n comment(id: ID!): Comment\n }\n\n extend type Mutation {\n createComment(input: CreateCommentInput!): Comment\n updateComment(id: ID!, input: UpdateCommentInput!): Comment\n deleteComment(id: ID!): Boolean\n }\n\n type Comment {\n id: ID\n name: String\n email: String\n body: String\n post: Post\n }\n\n input CreateCommentInput {\n name: String!\n email: String!\n body: String!\n }\n\n input UpdateCommentInput {\n name: String\n email: String\n body: String\n }\n"], ["\n extend type Query {\n comments(options: PageQueryOptions): CommentsPage\n comment(id: ID!): Comment\n }\n\n extend type Mutation {\n createComment(input: CreateCommentInput!): Comment\n updateComment(id: ID!, input: UpdateCommentInput!): Comment\n deleteComment(id: ID!): Boolean\n }\n\n type Comment {\n id: ID\n name: String\n email: String\n body: String\n post: Post\n }\n\n input CreateCommentInput {\n name: String!\n email: String!\n body: String!\n }\n\n input UpdateCommentInput {\n name: String\n email: String\n body: String\n }\n"])));
function fetchComments(options) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, json_placeholder_1.fetchPage('/comments', options)];
});
});
}
exports.fetchComments = fetchComments;
function fetchComment(id) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, json_placeholder_1.fetchResource("/comments/" + id)];
});
});
}
exports.fetchComment = fetchComment;
"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
Object.defineProperty(exports, "__esModule", { value: true });
var apollo_server_micro_1 = require("apollo-server-micro");
exports.typeDefs = apollo_server_micro_1.gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n input PageQueryOptions {\n paginate: PaginateOptions\n slice: SliceOptions\n sort: [SortOptions]\n operators: [OperatorOptions]\n search: SearchOptions\n }\n\n input PaginateOptions {\n page: Int\n limit: Int\n }\n\n input SliceOptions {\n start: Int\n end: Int\n limit: Int\n }\n\n input SortOptions {\n field: String\n order: SortOrderEnum\n }\n\n enum SortOrderEnum {\n ASC\n DESC\n }\n\n input OperatorOptions {\n kind: OperatorKindEnum\n field: String\n value: String\n }\n\n enum OperatorKindEnum {\n GTE\n LTE\n NE\n LIKE\n }\n\n input SearchOptions {\n q: String\n }\n\n type PostsPage {\n data: [Post]\n links: PaginationLinks\n meta: PageMetadata\n }\n\n type CommentsPage {\n data: [Comment]\n links: PaginationLinks\n meta: PageMetadata\n }\n\n type AlbumsPage {\n data: [Album]\n links: PaginationLinks\n meta: PageMetadata\n }\n\n type PhotosPage {\n data: [Photo]\n links: PaginationLinks\n meta: PageMetadata\n }\n\n type TodosPage {\n data: [Todo]\n links: PaginationLinks\n meta: PageMetadata\n }\n\n type UsersPage {\n data: [User]\n links: PaginationLinks\n meta: PageMetadata\n }\n\n type PaginationLinks {\n first: PageLimitPair\n prev: PageLimitPair\n next: PageLimitPair\n last: PageLimitPair\n }\n\n type PageLimitPair {\n page: Int\n limit: Int\n }\n\n type PageMetadata {\n totalCount: Int\n }\n"], ["\n input PageQueryOptions {\n paginate: PaginateOptions\n slice: SliceOptions\n sort: [SortOptions]\n operators: [OperatorOptions]\n search: SearchOptions\n }\n\n input PaginateOptions {\n page: Int\n limit: Int\n }\n\n input SliceOptions {\n start: Int\n end: Int\n limit: Int\n }\n\n input SortOptions {\n field: String\n order: SortOrderEnum\n }\n\n enum SortOrderEnum {\n ASC\n DESC\n }\n\n input OperatorOptions {\n kind: OperatorKindEnum\n field: String\n value: String\n }\n\n enum OperatorKindEnum {\n GTE\n LTE\n NE\n LIKE\n }\n\n input SearchOptions {\n q: String\n }\n\n type PostsPage {\n data: [Post]\n links: PaginationLinks\n meta: PageMetadata\n }\n\n type CommentsPage {\n data: [Comment]\n links: PaginationLinks\n meta: PageMetadata\n }\n\n type AlbumsPage {\n data: [Album]\n links: PaginationLinks\n meta: PageMetadata\n }\n\n type PhotosPage {\n data: [Photo]\n links: PaginationLinks\n meta: PageMetadata\n }\n\n type TodosPage {\n data: [Todo]\n links: PaginationLinks\n meta: PageMetadata\n }\n\n type UsersPage {\n data: [User]\n links: PaginationLinks\n meta: PageMetadata\n }\n\n type PaginationLinks {\n first: PageLimitPair\n prev: PageLimitPair\n next: PageLimitPair\n last: PageLimitPair\n }\n\n type PageLimitPair {\n page: Int\n limit: Int\n }\n\n type PageMetadata {\n totalCount: Int\n }\n"])));
var SortOrderEnum;
(function (SortOrderEnum) {
SortOrderEnum["Asc"] = "ASC";
SortOrderEnum["Desc"] = "DESC";
})(SortOrderEnum = exports.SortOrderEnum || (exports.SortOrderEnum = {}));
var OperatorKindEnum;
(function (OperatorKindEnum) {
OperatorKindEnum["Gte"] = "GTE";
OperatorKindEnum["Lte"] = "LTE";
OperatorKindEnum["Ne"] = "NE";
OperatorKindEnum["Like"] = "LIKE";
})(OperatorKindEnum = exports.OperatorKindEnum || (exports.OperatorKindEnum = {}));
exports.resolvers = {
Query: {},
Mutation: {},
};
function buildApolloServer() {
var baseTypeDefs = apollo_server_micro_1.gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n type Query {\n _: Int\n }\n\n type Mutation {\n _: Int\n }\n "], ["\n type Query {\n _: Int\n }\n\n type Mutation {\n _: Int\n }\n "])));
var typeDefs = [
baseTypeDefs,
album_1.typeDefs,
comment_1.typeDefs,
page_1.typeDefs,
photo_1.typeDefs,
post_1.typeDefs,
todo_1.typeDefs,
user_1.typeDefs,
];
var resolvers = {
Query: __assign({}, album_1.resolvers.Query, comment_1.resolvers.Query, page_1.resolvers.Query, photo_1.resolvers.Query, post_1.resolvers.Query, todo_1.resolvers.Query, user_1.resolvers.Query),
Mutation: __assign({}, album_1.resolvers.Mutation, comment_1.resolvers.Mutation, page_1.resolvers.Mutation, photo_1.resolvers.Mutation, post_1.resolvers.Mutation, todo_1.resolvers.Mutation, user_1.resolvers.Mutation),
Album: album_1.resolvers.Album,
Comment: comment_1.resolvers.Comment,
Photo: photo_1.resolvers.Photo,
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var apollo_server_micro_1 = require("apollo-server-micro");
var album_1 = require("./album");
var json_placeholder_1 = require("./util/json-placeholder");
exports.typeDefs = apollo_server_micro_1.gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n extend type Query {\n photos(options: PageQueryOptions): PhotosPage\n photo(id: ID!): Photo\n }\n\n extend type Mutation {\n createPhoto(input: CreatePhotoInput!): Photo\n updatePhoto(id: ID!, input: UpdatePhotoInput!): Photo\n deletePhoto(id: ID!): Boolean\n }\n\n type Photo {\n id: ID\n title: String\n url: String\n thumbnailUrl: String\n album: Album\n }\n\n input CreatePhotoInput {\n title: String!\n url: String!\n thumbnailUrl: String!\n }\n\n input UpdatePhotoInput {\n title: String\n url: String\n thumbnailUrl: String\n }\n"], ["\n extend type Query {\n photos(options: PageQueryOptions): PhotosPage\n photo(id: ID!): Photo\n }\n\n extend type Mutation {\n createPhoto(input: CreatePhotoInput!): Photo\n updatePhoto(id: ID!, input: UpdatePhotoInput!): Photo\n deletePhoto(id: ID!): Boolean\n }\n\n type Photo {\n id: ID\n title: String\n url: String\n thumbnailUrl: String\n album: Album\n }\n\n input CreatePhotoInput {\n title: String!\n url: String!\n thumbnailUrl: String!\n }\n\n input UpdatePhotoInput {\n title: String\n url: String\n thumbnailUrl: String\n }\n"])));
function fetchPhotos(options) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, json_placeholder_1.fetchPage('/photos', options)];
});
});
}
exports.fetchPhotos = fetchPhotos;
function fetchPhoto(id) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, json_placeholder_1.fetchResource("/photos/" + id)];
});
});
}
exports.fetchPhoto = fetchPhoto;
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var apollo_server_micro_1 = require("apollo-server-micro");
var user_1 = require("./user");
var json_placeholder_1 = require("./util/json-placeholder");
exports.typeDefs = apollo_server_micro_1.gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n extend type Query {\n posts(options: PageQueryOptions): PostsPage\n post(id: ID!): Post\n }\n\n extend type Mutation {\n createPost(input: CreatePostInput!): Post\n updatePost(id: ID!, input: UpdatePostInput!): Post\n deletePost(id: ID!): Boolean\n }\n\n type Post {\n id: ID\n title: String\n body: String\n user: User\n comments(options: PageQueryOptions): CommentsPage\n }\n\n input CreatePostInput {\n title: String!\n body: String!\n }\n\n input UpdatePostInput {\n title: String\n body: String\n }\n"], ["\n extend type Query {\n posts(options: PageQueryOptions): PostsPage\n post(id: ID!): Post\n }\n\n extend type Mutation {\n createPost(input: CreatePostInput!): Post\n updatePost(id: ID!, input: UpdatePostInput!): Post\n deletePost(id: ID!): Boolean\n }\n\n type Post {\n id: ID\n title: String\n body: String\n user: User\n comments(options: PageQueryOptions): CommentsPage\n }\n\n input CreatePostInput {\n title: String!\n body: String!\n }\n\n input UpdatePostInput {\n title: String\n body: String\n }\n"])));
function fetchPosts(options) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, json_placeholder_1.fetchPage('/posts', options)];
});
});
}
exports.fetchPosts = fetchPosts;
function fetchPost(id) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, json_placeholder_1.fetchResource("/posts/" + id)];
});
});
}
exports.fetchPost = fetchPost;
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var apollo_server_micro_1 = require("apollo-server-micro");
var user_1 = require("./user");
var json_placeholder_1 = require("./util/json-placeholder");
exports.typeDefs = apollo_server_micro_1.gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n extend type Query {\n todos(options: PageQueryOptions): TodosPage\n todo(id: ID!): Todo\n }\n\n extend type Mutation {\n createTodo(input: CreateTodoInput!): Todo\n updateTodo(id: ID!, input: UpdateTodoInput!): Todo\n deleteTodo(id: ID!): Boolean\n }\n\n type Todo {\n id: ID\n title: String\n completed: Boolean\n user: User\n }\n\n input CreateTodoInput {\n title: String!\n completed: Boolean!\n }\n\n input UpdateTodoInput {\n title: String\n completed: Boolean\n }\n"], ["\n extend type Query {\n todos(options: PageQueryOptions): TodosPage\n todo(id: ID!): Todo\n }\n\n extend type Mutation {\n createTodo(input: CreateTodoInput!): Todo\n updateTodo(id: ID!, input: UpdateTodoInput!): Todo\n deleteTodo(id: ID!): Boolean\n }\n\n type Todo {\n id: ID\n title: String\n completed: Boolean\n user: User\n }\n\n input CreateTodoInput {\n title: String!\n completed: Boolean!\n }\n\n input UpdateTodoInput {\n title: String\n completed: Boolean\n }\n"])));
function fetchTodos(options) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, json_placeholder_1.fetchPage('/todos', options)];
});
});
}
exports.fetchTodos = fetchTodos;
function fetchTodo(id) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, json_placeholder_1.fetchResource("/todos/" + id)];
});
});
}
exports.fetchTodo = fetchTodo;
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var apollo_server_micro_1 = require("apollo-server-micro");
var user_1 = require("./user");
var json_placeholder_1 = require("./util/json-placeholder");
exports.typeDefs = apollo_server_micro_1.gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n extend type Query {\n albums(options: PageQueryOptions): AlbumsPage\n album(id: ID!): Album\n }\n\n extend type Mutation {\n createAlbum(input: CreateAlbumInput!): Album\n updateAlbum(id: ID!, input: UpdateAlbumInput!): Album\n deleteAlbum(id: ID!): Boolean\n }\n\n type Album {\n id: ID\n title: String\n user: User\n photos(options: PageQueryOptions): PhotosPage\n }\n\n input CreateAlbumInput {\n title: String!\n userId: ID!\n }\n\n input UpdateAlbumInput {\n title: String\n userId: ID\n }\n"], ["\n extend type Query {\n albums(options: PageQueryOptions): AlbumsPage\n album(id: ID!): Album\n }\n\n extend type Mutation {\n createAlbum(input: CreateAlbumInput!): Album\n updateAlbum(id: ID!, input: UpdateAlbumInput!): Album\n deleteAlbum(id: ID!): Boolean\n }\n\n type Album {\n id: ID\n title: String\n user: User\n photos(options: PageQueryOptions): PhotosPage\n }\n\n input CreateAlbumInput {\n title: String!\n userId: ID!\n }\n\n input UpdateAlbumInput {\n title: String\n userId: ID\n }\n"])));
function fetchAlbums(options) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, json_placeholder_1.fetchPage('/albums', options)];
});
});
}
exports.fetchAlbums = fetchAlbums;
function fetchAlbum(id) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, json_placeholder_1.fetchResource("/albums/" + id)];
});
});
}
exports.fetchAlbum = fetchAlbum;
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var apollo_server_micro_1 = require("apollo-server-micro");
var json_placeholder_1 = require("./util/json-placeholder");
exports.typeDefs = apollo_server_micro_1.gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n extend type Query {\n users(options: PageQueryOptions): UsersPage\n user(id: ID!): User\n }\n\n extend type Mutation {\n createUser(input: CreateUserInput!): User\n updateUser(id: ID!, input: UpdateUserInput!): User\n deleteUser(id: ID!): Boolean\n }\n\n type User {\n id: ID\n name: String\n username: String\n email: String\n address: Address\n phone: String\n website: String\n company: Company\n posts(options: PageQueryOptions): PostsPage\n albums(options: PageQueryOptions): AlbumsPage\n todos(options: PageQueryOptions): TodosPage\n }\n\n type Address {\n street: String\n suite: String\n city: String\n zipcode: String\n geo: Geo\n }\n\n type Geo {\n lat: Float\n lng: Float\n }\n\n type Company {\n name: String\n catchPhrase: String\n bs: String\n }\n\n input CreateUserInput {\n name: String!\n username: String!\n email: String!\n address: AddressInput\n phone: String\n website: String\n company: CompanyInput\n }\n\n input UpdateUserInput {\n name: String\n username: String\n email: String\n address: AddressInput\n phone: String\n website: String\n company: CompanyInput\n }\n\n input AddressInput {\n street: String\n suite: String\n city: String\n zipcode: String\n geo: GeoInput\n }\n\n input GeoInput {\n lat: Float\n lng: Float\n }\n\n input CompanyInput {\n name: String\n catchPhrase: String\n bs: String\n }\n"], ["\n extend type Query {\n users(options: PageQueryOptions): UsersPage\n user(id: ID!): User\n }\n\n extend type Mutation {\n createUser(input: CreateUserInput!): User\n updateUser(id: ID!, input: UpdateUserInput!): User\n deleteUser(id: ID!): Boolean\n }\n\n type User {\n id: ID\n name: String\n username: String\n email: String\n address: Address\n phone: String\n website: String\n company: Company\n posts(options: PageQueryOptions): PostsPage\n albums(options: PageQueryOptions): AlbumsPage\n todos(options: PageQueryOptions): TodosPage\n }\n\n type Address {\n street: String\n suite: String\n city: String\n zipcode: String\n geo: Geo\n }\n\n type Geo {\n lat: Float\n lng: Float\n }\n\n type Company {\n name: String\n catchPhrase: String\n bs: String\n }\n\n input CreateUserInput {\n name: String!\n username: String!\n email: String!\n address: AddressInput\n phone: String\n website: String\n company: CompanyInput\n }\n\n input UpdateUserInput {\n name: String\n username: String\n email: String\n address: AddressInput\n phone: String\n website: String\n company: CompanyInput\n }\n\n input AddressInput {\n street: String\n suite: String\n city: String\n zipcode: String\n geo: GeoInput\n }\n\n input GeoInput {\n lat: Float\n lng: Float\n }\n\n input CompanyInput {\n name: String\n catchPhrase: String\n bs: String\n }\n"])));
function fetchUsers(options) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, json_placeholder_1.fetchPage('/users', options)];
});
});
}
exports.fetchUsers = fetchUsers;
function fetchUser(id) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, json_placeholder_1.fetchResource("/users/" + id)];
});
});
}
exports.fetchUser = fetchUser;