@loopback/example-graphql 0.12.8 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application.js +2 -0
- package/dist/application.js.map +1 -1
- package/dist/graphql-resolvers/recipe-resolver.d.ts +4 -3
- package/dist/graphql-resolvers/recipe-resolver.js +8 -7
- package/dist/graphql-resolvers/recipe-resolver.js.map +1 -1
- package/package.json +10 -9
- package/src/application.ts +3 -0
- package/src/graphql-resolvers/recipe-resolver.ts +5 -7
package/dist/application.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.GraphqlDemoApplication = void 0;
|
|
8
8
|
const tslib_1 = require("tslib");
|
|
9
|
+
const subscription_1 = require("@graphql-yoga/subscription");
|
|
9
10
|
const boot_1 = require("@loopback/boot");
|
|
10
11
|
const graphql_1 = require("@loopback/graphql");
|
|
11
12
|
const repository_1 = require("@loopback/repository");
|
|
@@ -23,6 +24,7 @@ class GraphqlDemoApplication extends (0, boot_1.BootMixin)((0, repository_1.Repo
|
|
|
23
24
|
return next();
|
|
24
25
|
});
|
|
25
26
|
this.expressMiddleware('middleware.express.GraphQL', server.expressApp);
|
|
27
|
+
this.bind(graphql_1.GraphQLBindings.PUB_SUB).to((0, subscription_1.createPubSub)());
|
|
26
28
|
// It's possible to register a graphql context resolver
|
|
27
29
|
this.bind(graphql_1.GraphQLBindings.GRAPHQL_CONTEXT_RESOLVER).to(async (context) => {
|
|
28
30
|
return { ...context };
|
package/dist/application.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,yCAAyC;AACzC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,yCAAyC;AAEzC,+CAAoE;AACpE,qDAAqD;AACrD,yCAA+C;AAC/C,wDAAwB;AACxB,q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,CAAC,yBAAe,CAAC,2BAA2B,CAAC,CAAC,EAAE,CACvD,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAC3B,OAAO,EAAC,GAAG,OAAO,EAAC,CAAC;QACtB,CAAC,CACF,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,8BAAa,CAAC,CAAC,CAAC;QAE5C,2BAA2B;QAC3B,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;QAEpD,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,mDAAmD;QACnD,IAAI,CAAC,WAAW,GAAG;YACjB,gBAAgB,EAAE;gBAChB,8CAA8C;gBAC9C,IAAI,EAAE,CAAC,mBAAmB,CAAC;gBAC3B,UAAU,EAAE,CAAC,KAAK,CAAC;gBACnB,MAAM,EAAE,IAAI;aACb;SACF,CAAC;IACJ,CAAC;CACF;AA/CD,wDA+CC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PubSub, ResolverData, ResolverInterface } from '@loopback/graphql';
|
|
2
2
|
import { RecipeInput } from '../graphql-types/recipe-input';
|
|
3
3
|
import { Recipe } from '../graphql-types/recipe-type';
|
|
4
4
|
import { RecipeRepository } from '../repositories';
|
|
@@ -6,11 +6,12 @@ import { RecipeService } from '../services/recipe.service';
|
|
|
6
6
|
export declare class RecipeResolver implements ResolverInterface<Recipe> {
|
|
7
7
|
private readonly recipeRepo;
|
|
8
8
|
private readonly recipeService;
|
|
9
|
+
private pubSub;
|
|
9
10
|
private resolverData;
|
|
10
|
-
constructor(recipeRepo: RecipeRepository, recipeService: RecipeService, resolverData: ResolverData);
|
|
11
|
+
constructor(recipeRepo: RecipeRepository, recipeService: RecipeService, pubSub: PubSub, resolverData: ResolverData);
|
|
11
12
|
recipe(recipeId: string): Promise<Recipe>;
|
|
12
13
|
recipes(): Promise<Recipe[]>;
|
|
13
|
-
addRecipe(recipe: RecipeInput
|
|
14
|
+
addRecipe(recipe: RecipeInput): Promise<Recipe>;
|
|
14
15
|
recipeCreated(recipe: Recipe): Promise<Recipe>;
|
|
15
16
|
numberInCollection(recipe: Recipe): Promise<number>;
|
|
16
17
|
ratingsCount(recipe: Recipe, minRate: number): number;
|
|
@@ -14,9 +14,10 @@ const recipe_type_1 = require("../graphql-types/recipe-type");
|
|
|
14
14
|
const repositories_1 = require("../repositories");
|
|
15
15
|
const recipe_service_1 = require("../services/recipe.service");
|
|
16
16
|
let RecipeResolver = class RecipeResolver {
|
|
17
|
-
constructor(recipeRepo, recipeService, resolverData) {
|
|
17
|
+
constructor(recipeRepo, recipeService, pubSub, resolverData) {
|
|
18
18
|
this.recipeRepo = recipeRepo;
|
|
19
19
|
this.recipeService = recipeService;
|
|
20
|
+
this.pubSub = pubSub;
|
|
20
21
|
this.resolverData = resolverData;
|
|
21
22
|
}
|
|
22
23
|
async recipe(recipeId) {
|
|
@@ -25,9 +26,9 @@ let RecipeResolver = class RecipeResolver {
|
|
|
25
26
|
async recipes() {
|
|
26
27
|
return this.recipeRepo.getAll();
|
|
27
28
|
}
|
|
28
|
-
async addRecipe(recipe
|
|
29
|
+
async addRecipe(recipe) {
|
|
29
30
|
const result = await this.recipeRepo.add(recipe);
|
|
30
|
-
|
|
31
|
+
this.pubSub.publish('recipeCreated', result);
|
|
31
32
|
return result;
|
|
32
33
|
}
|
|
33
34
|
async recipeCreated(recipe) {
|
|
@@ -59,9 +60,8 @@ tslib_1.__decorate([
|
|
|
59
60
|
tslib_1.__decorate([
|
|
60
61
|
(0, graphql_1.mutation)(returns => recipe_type_1.Recipe),
|
|
61
62
|
tslib_1.__param(0, (0, graphql_1.arg)('recipe')),
|
|
62
|
-
tslib_1.__param(1, (0, graphql_1.pubSub)('recipeCreated')),
|
|
63
63
|
tslib_1.__metadata("design:type", Function),
|
|
64
|
-
tslib_1.__metadata("design:paramtypes", [recipe_input_1.RecipeInput
|
|
64
|
+
tslib_1.__metadata("design:paramtypes", [recipe_input_1.RecipeInput]),
|
|
65
65
|
tslib_1.__metadata("design:returntype", Promise)
|
|
66
66
|
], RecipeResolver.prototype, "addRecipe", null);
|
|
67
67
|
tslib_1.__decorate([
|
|
@@ -90,8 +90,9 @@ exports.RecipeResolver = RecipeResolver = tslib_1.__decorate([
|
|
|
90
90
|
(0, graphql_1.resolver)(of => recipe_type_1.Recipe),
|
|
91
91
|
tslib_1.__param(0, (0, repository_1.repository)('RecipeRepository')),
|
|
92
92
|
tslib_1.__param(1, (0, core_1.service)(recipe_service_1.RecipeService)),
|
|
93
|
-
tslib_1.__param(2, (0, core_1.inject)(graphql_1.GraphQLBindings.
|
|
93
|
+
tslib_1.__param(2, (0, core_1.inject)(graphql_1.GraphQLBindings.PUB_SUB)),
|
|
94
|
+
tslib_1.__param(3, (0, core_1.inject)(graphql_1.GraphQLBindings.RESOLVER_DATA)),
|
|
94
95
|
tslib_1.__metadata("design:paramtypes", [repositories_1.RecipeRepository,
|
|
95
|
-
recipe_service_1.RecipeService, Object])
|
|
96
|
+
recipe_service_1.RecipeService, Object, Object])
|
|
96
97
|
], RecipeResolver);
|
|
97
98
|
//# sourceMappingURL=recipe-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recipe-resolver.js","sourceRoot":"","sources":["../../src/graphql-resolvers/recipe-resolver.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,yCAAyC;AACzC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,yCAA+C;AAC/C,+
|
|
1
|
+
{"version":3,"file":"recipe-resolver.js","sourceRoot":"","sources":["../../src/graphql-resolvers/recipe-resolver.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,yCAAyC;AACzC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,yCAA+C;AAC/C,+CAc2B;AAC3B,qDAAgD;AAChD,gEA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
|
|
1
1
|
{
|
|
2
2
|
"name": "@loopback/example-graphql",
|
|
3
3
|
"description": "GraphQL Example Application",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.13.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"loopback-application",
|
|
7
7
|
"loopback"
|
|
@@ -49,18 +49,19 @@
|
|
|
49
49
|
"!*/__tests__"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@loopback/
|
|
54
|
-
"@loopback/
|
|
55
|
-
"@loopback/
|
|
56
|
-
"@loopback/
|
|
52
|
+
"@graphql-yoga/subscription": "^5.0.5",
|
|
53
|
+
"@loopback/boot": "^8.0.10",
|
|
54
|
+
"@loopback/core": "^7.0.9",
|
|
55
|
+
"@loopback/graphql": "^0.13.0",
|
|
56
|
+
"@loopback/repository": "^8.0.9",
|
|
57
|
+
"@loopback/rest": "^15.0.10",
|
|
57
58
|
"class-transformer": "^0.5.1",
|
|
58
59
|
"tslib": "^2.8.1"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@loopback/build": "^12.0.
|
|
62
|
+
"@loopback/build": "^12.0.9",
|
|
62
63
|
"@loopback/eslint-config": "^16.0.1",
|
|
63
|
-
"@loopback/testlab": "^8.0.
|
|
64
|
+
"@loopback/testlab": "^8.0.9",
|
|
64
65
|
"@types/multer": "^2.0.0",
|
|
65
66
|
"@types/node": "^16.18.126",
|
|
66
67
|
"eslint": "^8.57.1",
|
|
@@ -69,5 +70,5 @@
|
|
|
69
70
|
"source-map-support": "^0.5.21",
|
|
70
71
|
"typescript": "~5.2.2"
|
|
71
72
|
},
|
|
72
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "77064f8efea6b713992283d653d8d46bdd724982"
|
|
73
74
|
}
|
package/src/application.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// This file is licensed under the MIT License.
|
|
4
4
|
// License text available at https://opensource.org/licenses/MIT
|
|
5
5
|
|
|
6
|
+
import {createPubSub} from '@graphql-yoga/subscription';
|
|
6
7
|
import {BootMixin} from '@loopback/boot';
|
|
7
8
|
import {ApplicationConfig} from '@loopback/core';
|
|
8
9
|
import {GraphQLBindings, GraphQLComponent} from '@loopback/graphql';
|
|
@@ -30,6 +31,8 @@ export class GraphqlDemoApplication extends BootMixin(
|
|
|
30
31
|
|
|
31
32
|
this.expressMiddleware('middleware.express.GraphQL', server.expressApp);
|
|
32
33
|
|
|
34
|
+
this.bind(GraphQLBindings.PUB_SUB).to(createPubSub());
|
|
35
|
+
|
|
33
36
|
// It's possible to register a graphql context resolver
|
|
34
37
|
this.bind(GraphQLBindings.GRAPHQL_CONTEXT_RESOLVER).to(async context => {
|
|
35
38
|
return {...context};
|
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
GraphQLBindings,
|
|
12
12
|
Int,
|
|
13
13
|
mutation,
|
|
14
|
-
|
|
15
|
-
pubSub,
|
|
14
|
+
PubSub,
|
|
16
15
|
query,
|
|
17
16
|
resolver,
|
|
18
17
|
ResolverData,
|
|
@@ -33,6 +32,8 @@ export class RecipeResolver implements ResolverInterface<Recipe> {
|
|
|
33
32
|
@repository('RecipeRepository')
|
|
34
33
|
private readonly recipeRepo: RecipeRepository,
|
|
35
34
|
@service(RecipeService) private readonly recipeService: RecipeService,
|
|
35
|
+
// inject pubSub for publishing a notification
|
|
36
|
+
@inject(GraphQLBindings.PUB_SUB) private pubSub: PubSub,
|
|
36
37
|
// It's possible to inject the resolver data
|
|
37
38
|
@inject(GraphQLBindings.RESOLVER_DATA) private resolverData: ResolverData,
|
|
38
39
|
) {}
|
|
@@ -49,12 +50,9 @@ export class RecipeResolver implements ResolverInterface<Recipe> {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
@mutation(returns => Recipe)
|
|
52
|
-
async addRecipe(
|
|
53
|
-
@arg('recipe') recipe: RecipeInput,
|
|
54
|
-
@pubSub('recipeCreated') publish: Publisher<Recipe>,
|
|
55
|
-
): Promise<Recipe> {
|
|
53
|
+
async addRecipe(@arg('recipe') recipe: RecipeInput): Promise<Recipe> {
|
|
56
54
|
const result = await this.recipeRepo.add(recipe);
|
|
57
|
-
|
|
55
|
+
this.pubSub.publish('recipeCreated', result);
|
|
58
56
|
return result;
|
|
59
57
|
}
|
|
60
58
|
|