@rxdi/altair 0.7.196

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/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # @rxdi Altair Playground
2
+
3
+ ##### More information about Altair can be found here [Altair](https://altairgraphql.dev/docs)
4
+
5
+ ##### This module is intended to be used with [rxdi](https://github.com/rxdi/core)
6
+
7
+ ## Installation and basic examples:
8
+
9
+ ##### To install this Gapi module, run:
10
+
11
+ ```bash
12
+ $ npm install @rxdi/altair
13
+ ```
14
+
15
+ ## Consuming @rxdi/graphql
16
+
17
+ ##### Import inside AppModule or CoreModule
18
+
19
+ ```typescript
20
+ import { Module } from '@rxdi/core';
21
+ import { HapiModule } from '@rxdi/hapi';
22
+ import { GraphQLModule } from '@rxdi/graphql';
23
+
24
+ @Module({
25
+ imports: [
26
+ HapiModule.forRoot(),
27
+ GraphQLModule.forRoot(),
28
+ AltairModule.forRoot({
29
+ baseURL: 'http://localhost:9000/altair/',
30
+ endpointURL: 'http://localhost:9000/graphql',
31
+ subscriptionsEndpoint: 'http://localhost:9000/subscriptions',
32
+ initialQuery: `{ status { status } }`,
33
+ }),
34
+ ],
35
+ })
36
+ export class AppModule {}
37
+ ```
38
+
39
+
40
+ Now open http://localhost:9000/altair and Njoy! :)
@@ -0,0 +1,7 @@
1
+ import { Server } from '@hapi/hapi';
2
+ import { PluginInterface } from '@rxdi/core';
3
+ export declare class AltairStaticsPlugin implements PluginInterface {
4
+ private server;
5
+ constructor(server: Server);
6
+ register(): Promise<void>;
7
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.AltairStaticsPlugin = void 0;
25
+ const hapi_1 = require("@rxdi/hapi");
26
+ const hapi_2 = require("@hapi/hapi");
27
+ const core_1 = require("@rxdi/core");
28
+ let AltairStaticsPlugin = class AltairStaticsPlugin {
29
+ constructor(server) {
30
+ this.server = server;
31
+ }
32
+ register() {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ this.server.route({
35
+ method: 'GET',
36
+ path: '/altair/{param*}',
37
+ handler: {
38
+ directory: {
39
+ path: './node_modules/altair-static/build/dist',
40
+ },
41
+ },
42
+ });
43
+ });
44
+ }
45
+ };
46
+ exports.AltairStaticsPlugin = AltairStaticsPlugin;
47
+ exports.AltairStaticsPlugin = AltairStaticsPlugin = __decorate([
48
+ (0, core_1.Plugin)(),
49
+ __param(0, (0, core_1.Inject)(hapi_1.HAPI_SERVER)),
50
+ __metadata("design:paramtypes", [hapi_2.Server])
51
+ ], AltairStaticsPlugin);
@@ -0,0 +1,5 @@
1
+ import { ModuleWithProviders } from '@rxdi/core';
2
+ import { AltairConfig } from './altair.tokens';
3
+ export declare class AltairModule {
4
+ static forRoot(config?: AltairConfig): ModuleWithProviders;
5
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var AltairModule_1;
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.AltairModule = void 0;
11
+ const core_1 = require("@rxdi/core");
12
+ const altair_plugin_1 = require("./altair.plugin");
13
+ const altair_tokens_1 = require("./altair.tokens");
14
+ const altair_static_plugin_1 = require("./altair-static.plugin");
15
+ let AltairModule = AltairModule_1 = class AltairModule {
16
+ static forRoot(config = altair_tokens_1.DefaultAltairConfig) {
17
+ return {
18
+ module: AltairModule_1,
19
+ providers: [
20
+ {
21
+ provide: altair_tokens_1.AltairConfig,
22
+ useValue: config,
23
+ },
24
+ ],
25
+ };
26
+ }
27
+ };
28
+ exports.AltairModule = AltairModule;
29
+ exports.AltairModule = AltairModule = AltairModule_1 = __decorate([
30
+ (0, core_1.Module)({
31
+ plugins: [altair_plugin_1.AltairPlugin, altair_static_plugin_1.AltairStaticsPlugin],
32
+ providers: [
33
+ {
34
+ provide: altair_tokens_1.AltairConfig,
35
+ useValue: altair_tokens_1.DefaultAltairConfig,
36
+ },
37
+ ],
38
+ })
39
+ ], AltairModule);
@@ -0,0 +1,10 @@
1
+ import { Server } from '@hapi/hapi';
2
+ import { AfterStarterService, PluginInterface } from '@rxdi/core';
3
+ import { AltairConfig } from './altair.tokens';
4
+ export declare class AltairPlugin implements PluginInterface {
5
+ private server;
6
+ private config;
7
+ private afterStarterService;
8
+ constructor(server: Server, config: AltairConfig, afterStarterService: AfterStarterService);
9
+ register(): Promise<void>;
10
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.AltairPlugin = void 0;
25
+ const hapi_1 = require("@rxdi/hapi");
26
+ const hapi_2 = require("@hapi/hapi");
27
+ const core_1 = require("@rxdi/core");
28
+ const altair_static_1 = require("altair-static");
29
+ const rxjs_1 = require("rxjs");
30
+ const altair_tokens_1 = require("./altair.tokens");
31
+ let AltairPlugin = class AltairPlugin {
32
+ constructor(server, config, afterStarterService) {
33
+ this.server = server;
34
+ this.config = config;
35
+ this.afterStarterService = afterStarterService;
36
+ }
37
+ register() {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ console.log(this.config);
40
+ this.server.route({
41
+ method: 'GET',
42
+ path: '/altair',
43
+ handler: (request, h) => h.response((0, altair_static_1.renderAltair)(this.config)).type('text/html'),
44
+ });
45
+ this.afterStarterService.appStarted.pipe((0, rxjs_1.take)(1)).subscribe(() => {
46
+ console.log(`Altair playground started at http://localhost:${this.server.info.port}/altair`);
47
+ });
48
+ });
49
+ }
50
+ };
51
+ exports.AltairPlugin = AltairPlugin;
52
+ exports.AltairPlugin = AltairPlugin = __decorate([
53
+ (0, core_1.Plugin)(),
54
+ __param(0, (0, core_1.Inject)(hapi_1.HAPI_SERVER)),
55
+ __param(1, (0, core_1.Inject)(altair_tokens_1.AltairConfig)),
56
+ __metadata("design:paramtypes", [hapi_2.Server, Object, core_1.AfterStarterService])
57
+ ], AltairPlugin);
@@ -0,0 +1,10 @@
1
+ import { InjectionToken } from '@rxdi/core';
2
+ import { RenderOptions } from 'altair-static';
3
+ export declare const AltairConfig: InjectionToken<unknown>;
4
+ export type AltairConfig = RenderOptions;
5
+ export declare const DefaultAltairConfig: {
6
+ baseURL: string;
7
+ endpointURL: string;
8
+ subscriptionsEndpoint: string;
9
+ initialQuery: string;
10
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DefaultAltairConfig = exports.AltairConfig = void 0;
4
+ const core_1 = require("@rxdi/core");
5
+ exports.AltairConfig = new core_1.InjectionToken('altair-module-config');
6
+ exports.DefaultAltairConfig = {
7
+ baseURL: 'http://localhost:9000/altair/',
8
+ endpointURL: 'http://localhost:9000/graphql',
9
+ subscriptionsEndpoint: 'http://localhost:9000/subscriptions',
10
+ initialQuery: `{ status { status } }`,
11
+ };
@@ -0,0 +1,2 @@
1
+ export * from './altair.module';
2
+ export * from './altair.tokens';
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./altair.module"), exports);
18
+ __exportStar(require("./altair.tokens"), exports);
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@rxdi/altair",
3
+ "version": "0.7.196",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/rxdi/rxdi"
7
+ },
8
+ "scripts": {
9
+ "lint": "tslint -c tslint.json 'development/**/*.{ts,tsx}'",
10
+ "pretest": "npm run lint",
11
+ "build": "tsc || true",
12
+ "test": "echo tests"
13
+ },
14
+ "author": {
15
+ "name": "Kristian Tachev(Stradivario)",
16
+ "email": "kristiqn.tachev@gmail.com"
17
+ },
18
+ "keywords": [
19
+ "graphql",
20
+ "gapi",
21
+ "altair"
22
+ ],
23
+ "license": "MIT",
24
+ "bugs": {
25
+ "url": "https://github.com/rxdi/graphql/issues"
26
+ },
27
+ "homepage": "https://github.com/rxdi/graphql#readme",
28
+ "main": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "module": "./dist/index.js",
31
+ "typings": "./dist/index.d.ts",
32
+ "dependencies": {
33
+ "altair-static": "^8.5.0"
34
+ },
35
+ "devDependencies": {
36
+ "@rxdi/core": "^0.7.195",
37
+ "@rxdi/hapi": "^0.7.195",
38
+ "@types/node": "^25.0.3",
39
+ "tslint": "^5.20.1",
40
+ "tslint-language-service": "^0.9.9",
41
+ "typescript": "^5.9.3"
42
+ }
43
+ }