├── src
├── models
│ ├── index.ts
│ └── greeting.model.ts
├── resolvers
│ ├── index.ts
│ ├── hello-world
│ │ ├── index.ts
│ │ └── hello-world.resolver.ts
│ ├── providers.ts
│ └── resolver.module.ts
├── controllers
│ ├── hello-world
│ │ ├── index.ts
│ │ ├── hello-world.controller.ts
│ │ └── hello-world.controller.spec.ts
│ └── index.ts
├── services
│ ├── index.ts
│ ├── hello-world
│ │ ├── hello-world.api.ts
│ │ ├── index.ts
│ │ └── hello-world.service.ts
│ ├── service.module.ts
│ └── providers.ts
├── main.ts
└── app.module.ts
├── tsconfig.build.json
├── .gitpod.yml
├── nest-cli.json
├── .dockerignore
├── .gitignore
├── test
├── jest-e2e.json
├── app.e2e-spec.ts
└── pact-verity.ts
├── public
└── index.html
├── schema.gql
├── chart
└── base
│ ├── .helmignore
│ ├── templates
│ ├── route.yaml
│ ├── service.yaml
│ ├── ingress.yaml
│ ├── NOTES.txt
│ ├── _helpers.tpl
│ └── deployment.yaml
│ ├── Chart.yaml
│ └── values.yaml
├── .github
├── dependabot.yml
└── ISSUE_TEMPLATE
│ └── bug_report.md
├── tsconfig.json
├── Dockerfile
├── package.json
├── CODE_OF_CONDUCT.md
├── README.md
├── LICENSE
└── licenses
└── LICENSE.txt
/src/models/index.ts:
--------------------------------------------------------------------------------
1 | export * from './greeting.model'
2 |
--------------------------------------------------------------------------------
/src/resolvers/index.ts:
--------------------------------------------------------------------------------
1 | export * from './resolver.module';
2 |
--------------------------------------------------------------------------------
/src/resolvers/hello-world/index.ts:
--------------------------------------------------------------------------------
1 | export * from './hello-world.resolver'
2 |
--------------------------------------------------------------------------------
/src/controllers/hello-world/index.ts:
--------------------------------------------------------------------------------
1 | export * from './hello-world.controller';
2 |
--------------------------------------------------------------------------------
/src/services/index.ts:
--------------------------------------------------------------------------------
1 | export * from './providers';
2 | export * from './service.module';
3 |
--------------------------------------------------------------------------------
/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
4 | }
5 |
--------------------------------------------------------------------------------
/.gitpod.yml:
--------------------------------------------------------------------------------
1 | tasks:
2 | - init: npm install
3 | command: npm start
4 | ports:
5 | - port: 3000
6 | onOpen: open-preview
7 |
--------------------------------------------------------------------------------
/src/controllers/index.ts:
--------------------------------------------------------------------------------
1 | import { HelloWorldController } from './hello-world';
2 |
3 | export * from './hello-world';
4 |
5 | export const controllers = [HelloWorldController];
6 |
--------------------------------------------------------------------------------
/src/services/hello-world/hello-world.api.ts:
--------------------------------------------------------------------------------
1 | import {GreetingModel} from "../../models";
2 |
3 | export abstract class HelloWorldApi {
4 | abstract getHello(): GreetingModel
5 | }
6 |
--------------------------------------------------------------------------------
/nest-cli.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/nest-cli",
3 | "collection": "@nestjs/schematics",
4 | "sourceRoot": "src",
5 | "compilerOptions": {
6 | "deleteOutDir": true
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/resolvers/providers.ts:
--------------------------------------------------------------------------------
1 | import {Provider} from "@nestjs/common";
2 | import {HelloWorldResolver} from "./hello-world";
3 |
4 | export * from './hello-world'
5 |
6 | export const providers: Provider[] = [HelloWorldResolver]
7 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | .git
2 | .cache
3 |
4 | node_modules/
5 |
6 | Jenkinsfile
7 | CODE_OF_CONDUCT.md
8 | LICENSE
9 | README.md
10 | chart/
11 | dist/
12 | docs/
13 | test-report.xml
14 | setup-template.sh
15 | update-template.sh
16 |
--------------------------------------------------------------------------------
/src/services/service.module.ts:
--------------------------------------------------------------------------------
1 | import {Module} from "@nestjs/common";
2 |
3 | import {providers} from "./providers";
4 |
5 | @Module({
6 | providers,
7 | exports: providers
8 | })
9 | export class ServiceModule {}
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | node_modules/
3 | *.iml
4 | dist/
5 | coverage/
6 | logs/
7 | .helm/
8 | pipeline-build-config.json
9 | test-report.xml
10 | .scannerwork/
11 |
12 | # Chart dependencies
13 | **/charts/*.tgz
14 | Chart.lock
15 |
--------------------------------------------------------------------------------
/src/services/providers.ts:
--------------------------------------------------------------------------------
1 | import {Provider} from "@nestjs/common";
2 | import {provider as helloWorldProvider} from "./hello-world";
3 |
4 | export * from './hello-world';
5 |
6 | export const providers: Provider[] = [helloWorldProvider];
7 |
--------------------------------------------------------------------------------
/test/jest-e2e.json:
--------------------------------------------------------------------------------
1 | {
2 | "moduleFileExtensions": ["js", "json", "ts"],
3 | "rootDir": ".",
4 | "testEnvironment": "node",
5 | "testRegex": ".e2e-spec.ts$",
6 | "transform": {
7 | "^.+\\.(t|j)s$": "ts-jest"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import { NestFactory } from '@nestjs/core';
2 | import { AppModule } from './app.module';
3 |
4 | async function bootstrap() {
5 | const app = await NestFactory.create(AppModule);
6 | await app.listen(3000);
7 | }
8 | bootstrap().catch(err => console.error(err));
9 |
--------------------------------------------------------------------------------
/src/resolvers/resolver.module.ts:
--------------------------------------------------------------------------------
1 | import { Module } from '@nestjs/common';
2 |
3 | import {providers} from './providers'
4 | import {ServiceModule} from "../services";
5 |
6 | @Module({
7 | imports: [ServiceModule],
8 | providers,
9 | })
10 | export class ResolverModule {}
11 |
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Example API
7 |
8 |
9 | Swagger api docs
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/models/greeting.model.ts:
--------------------------------------------------------------------------------
1 | import {Field, ObjectType} from "@nestjs/graphql";
2 |
3 | export interface GreetingModel {
4 | greeting: string
5 | }
6 |
7 | @ObjectType({ description: 'greeting' })
8 | export class Greeting implements GreetingModel {
9 | @Field()
10 | greeting: string;
11 | }
12 |
--------------------------------------------------------------------------------
/schema.gql:
--------------------------------------------------------------------------------
1 | # ------------------------------------------------------
2 | # THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
3 | # ------------------------------------------------------
4 |
5 | """greeting"""
6 | type Greeting {
7 | greeting: String!
8 | }
9 |
10 | type Query {
11 | helloWorld: Greeting!
12 | }
--------------------------------------------------------------------------------
/src/services/hello-world/index.ts:
--------------------------------------------------------------------------------
1 | import {Provider} from "@nestjs/common";
2 |
3 | import { HelloWorldApi } from './hello-world.api';
4 | import { HelloWorldService } from './hello-world.service';
5 |
6 | export * from './hello-world.api';
7 |
8 | export const provider: Provider = {
9 | provide: HelloWorldApi,
10 | useClass: HelloWorldService,
11 | };
12 |
--------------------------------------------------------------------------------
/src/services/hello-world/hello-world.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@nestjs/common';
2 | import {HelloWorldApi} from "./hello-world.api";
3 | import {GreetingModel} from "../../models";
4 |
5 | @Injectable()
6 | export class HelloWorldService implements HelloWorldApi {
7 | getHello(): GreetingModel {
8 | return {greeting: 'Hello World!'};
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/controllers/hello-world/hello-world.controller.ts:
--------------------------------------------------------------------------------
1 | import { Controller, Get } from '@nestjs/common';
2 | import { HelloWorldApi } from '../../services';
3 |
4 | @Controller()
5 | export class HelloWorldController {
6 | constructor(private readonly service: HelloWorldApi) {}
7 |
8 | @Get()
9 | getHello(): string {
10 | return this.service.getHello().greeting;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/chart/base/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/chart/base/templates/route.yaml:
--------------------------------------------------------------------------------
1 | {{- if .Values.route.enabled -}}
2 | {{- $fullName := include "starter-kit.fullname" . -}}
3 | kind: Route
4 | apiVersion: route.openshift.io/v1
5 | metadata:
6 | name: {{ $fullName }}
7 | annotations:
8 | argocd.argoproj.io/sync-options: Validate=false
9 | spec:
10 | to:
11 | kind: Service
12 | name: {{ $fullName }}
13 | weight: 100
14 | tls:
15 | termination: edge
16 | wildcardPolicy: None
17 | {{- end }}
18 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "npm" # See documentation for possible values
9 | directory: "/" # Location of package manifests
10 | schedule:
11 | interval: "daily"
12 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "declaration": true,
5 | "removeComments": true,
6 | "emitDecoratorMetadata": true,
7 | "experimentalDecorators": true,
8 | "allowSyntheticDefaultImports": true,
9 | "target": "ES2021",
10 | "sourceMap": true,
11 | "outDir": "./dist",
12 | "baseUrl": "./",
13 | "incremental": true,
14 | "skipLibCheck": true,
15 | "strictNullChecks": false,
16 | "noImplicitAny": false,
17 | "strictBindCallApply": false,
18 | "forceConsistentCasingInFileNames": false,
19 | "noFallthroughCasesInSwitch": false
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/resolvers/hello-world/hello-world.resolver.ts:
--------------------------------------------------------------------------------
1 | import {NotFoundException} from "@nestjs/common";
2 | import {Query, Resolver} from "@nestjs/graphql";
3 |
4 | import {Greeting, GreetingModel} from "../../models";
5 | import {HelloWorldApi} from "../../services";
6 |
7 | @Resolver(of => Greeting)
8 | export class HelloWorldResolver {
9 | constructor(private readonly service: HelloWorldApi) {}
10 |
11 | @Query(returns => Greeting)
12 | async helloWorld(): Promise {
13 | const greeting = await this.service.getHello();
14 | if (!greeting) {
15 | throw new NotFoundException();
16 | }
17 | return greeting;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/chart/base/templates/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ include "starter-kit.fullname" . }}
5 | labels:
6 | app.kubernetes.io/name: {{ include "starter-kit.name" . }}
7 | helm.sh/chart: {{ include "starter-kit.chart" . }}
8 | app.kubernetes.io/instance: {{ .Release.Name }}
9 | app: {{ .Release.Name }}
10 | spec:
11 | type: {{ .Values.service.type }}
12 | ports:
13 | - port: {{ .Values.service.port }}
14 | targetPort: {{ .Values.image.port }}
15 | protocol: TCP
16 | name: http
17 | selector:
18 | app.kubernetes.io/name: {{ include "starter-kit.name" . }}
19 | app.kubernetes.io/instance: {{ .Release.Name }}
20 |
--------------------------------------------------------------------------------
/test/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { Test, TestingModule } from '@nestjs/testing';
2 | import { INestApplication } from '@nestjs/common';
3 | import * as request from 'supertest';
4 | import { AppModule } from './../src/app.module';
5 |
6 | describe('HelloWorldController (e2e)', () => {
7 | let app: INestApplication;
8 |
9 | beforeEach(async () => {
10 | const moduleFixture: TestingModule = await Test.createTestingModule({
11 | imports: [AppModule],
12 | }).compile();
13 |
14 | app = moduleFixture.createNestApplication();
15 | await app.init();
16 | });
17 |
18 | it('/ (GET)', () => {
19 | return request(app.getHttpServer())
20 | .get('/')
21 | .expect(200)
22 | .expect('Hello World!');
23 | });
24 | });
25 |
--------------------------------------------------------------------------------
/src/app.module.ts:
--------------------------------------------------------------------------------
1 | import { Module } from '@nestjs/common';
2 | import {GraphQLModule} from "@nestjs/graphql";
3 | import {ApolloDriver, ApolloDriverConfig} from "@nestjs/apollo";
4 | import {join} from 'path';
5 |
6 | import { controllers } from './controllers';
7 | import {ServiceModule} from "./services";
8 | import {ResolverModule} from "./resolvers";
9 |
10 | const imports = [
11 | GraphQLModule.forRoot({
12 | driver: ApolloDriver,
13 | autoSchemaFile: 'schema.gql',
14 | sortSchema: true,
15 | subscriptions: {
16 | 'graphql-ws': true
17 | },
18 | }),
19 | ServiceModule,
20 | ResolverModule,
21 | ]
22 |
23 | @Module({
24 | imports,
25 | controllers,
26 | })
27 | export class AppModule {}
28 |
--------------------------------------------------------------------------------
/src/controllers/hello-world/hello-world.controller.spec.ts:
--------------------------------------------------------------------------------
1 | import { Test, TestingModule } from '@nestjs/testing';
2 |
3 | import { HelloWorldController } from './hello-world.controller';
4 | import { provider as helloWorldProvider } from '../../services/hello-world';
5 |
6 | describe('AppController', () => {
7 | let appController: HelloWorldController;
8 |
9 | beforeEach(async () => {
10 | const app: TestingModule = await Test.createTestingModule({
11 | controllers: [HelloWorldController],
12 | providers: [helloWorldProvider],
13 | }).compile();
14 |
15 | appController = app.get(HelloWorldController);
16 | });
17 |
18 | describe('root', () => {
19 | it('should return "Hello World!"', () => {
20 | expect(appController.getHello()).toBe('Hello World!');
21 | });
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM registry.access.redhat.com/ubi9/nodejs-22:9.5-1737605092 AS builder
2 |
3 | WORKDIR /opt/app-root/src
4 |
5 | COPY --chown=default:root . .
6 |
7 | RUN mkdir -p /opt/app-root/src/node_modules && \
8 | ls -lA && \
9 | npm ci && \
10 | npm run build
11 |
12 | FROM registry.access.redhat.com/ubi9/nodejs-22-minimal:9.5-1737619681
13 |
14 | ## Uncomment the below lines to update image security content if any
15 | # USER root
16 | # RUN dnf -y update-minimal --security --sec-severity=Important --sec-severity=Critical && dnf clean all
17 |
18 | LABEL name="ibm/template-graphql-typescript" \
19 | vendor="IBM" \
20 | version="9" \
21 | release="5" \
22 | summary="This is an example of a container image." \
23 | description="This container image will deploy a Typescript Node App"
24 |
25 | WORKDIR /opt/app-root/src
26 |
27 | COPY --from=builder --chown=1001:root /opt/app-root/src/dist dist
28 |
29 | COPY --chown=1001:root package*.json ./
30 |
31 | RUN ls -lA && \
32 | mkdir -p /opt/app-root/src/node_modules && \
33 | npm ci --omit=dev
34 |
35 | COPY --chown=1001:root licenses licenses
36 | COPY --chown=1001:root public public
37 | # COPY --chown=1001:root licenses /licenses
38 |
39 | ENV HOST=0.0.0.0 PORT=3000
40 |
41 | EXPOSE 3000/tcp
42 |
43 | CMD ["npm", "run", "start"]
44 |
45 |
--------------------------------------------------------------------------------
/chart/base/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: base
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.0
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | appVersion: 0.1.0
24 |
25 | dependencies:
26 | - name: starter-kit
27 | version: 0.6.2
28 | repository: https://charts.cloudnativetoolkit.dev
29 | alias: base
30 |
--------------------------------------------------------------------------------
/chart/base/templates/ingress.yaml:
--------------------------------------------------------------------------------
1 | {{- if .Values.ingress.enabled -}}
2 | {{- $fullName := include "starter-kit.fullname" . -}}
3 | {{- $namespace := .Release.Namespace -}}
4 | {{- $requestType := .Values.ingress.appid.requestType -}}
5 | apiVersion: networking.k8s.io/v1beta1
6 | kind: Ingress
7 | metadata:
8 | name: {{ $fullName }}
9 | labels:
10 | app.kubernetes.io/name: {{ include "starter-kit.name" . }}
11 | helm.sh/chart: {{ include "starter-kit.chart" . }}
12 | app.kubernetes.io/instance: {{ .Release.Name }}
13 | app: {{ .Release.Name }}
14 | {{- if .Values.ingress.appid.enabled }}
15 | annotations:
16 | ingress.bluemix.net/appid-auth: {{ printf "bindSecret=%s namespace=%s requestType=%s serviceName=%s" (required "AppId binding is required to enable auth on the ingress" .Values.appidBinding) $namespace $requestType $fullName }}
17 | {{- end}}
18 | spec:
19 | {{- if include "starter-kit.tlsSecretName" . }}
20 | tls:
21 | - hosts:
22 | - {{ include "starter-kit.host" . }}
23 | secretName: {{ include "starter-kit.tlsSecretName" . }}
24 | {{- end }}
25 | rules:
26 | - host: {{ include "starter-kit.host" . }}
27 | http:
28 | paths:
29 | - path: {{ .path }}
30 | backend:
31 | serviceName: {{ $fullName }}
32 | servicePort: http
33 | {{- end }}
34 |
--------------------------------------------------------------------------------
/chart/base/templates/NOTES.txt:
--------------------------------------------------------------------------------
1 | 1. Get the application URL by running these commands:
2 | {{- if .Values.ingress.enabled }}
3 | {{ include "starter-kit.url" . }}
4 | {{- else if contains "NodePort" .Values.service.type }}
5 | export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "starter-kit.fullname" . }})
6 | export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
7 | echo http://$NODE_IP:$NODE_PORT
8 | {{- else if contains "LoadBalancer" .Values.service.type }}
9 | NOTE: It may take a few minutes for the LoadBalancer IP to be available.
10 | You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "starter-kit.fullname" . }}'
11 | export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "starter-kit.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
12 | echo http://$SERVICE_IP:{{ .Values.service.port }}
13 | {{- else if contains "ClusterIP" .Values.service.type }}
14 | export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "starter-kit.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
15 | echo "Visit http://127.0.0.1:8080 to use your application"
16 | kubectl port-forward $POD_NAME 8080:80
17 | {{- end }}
18 |
--------------------------------------------------------------------------------
/chart/base/values.yaml:
--------------------------------------------------------------------------------
1 | global:
2 | tlsSecretName: ""
3 | ingressSubdomain: ""
4 |
5 | base:
6 | runtime: nodejs
7 |
8 | image:
9 | repository: bitnami/nginx
10 | port: 3000
11 | probePath: /
12 | # Overrides the image tag whose default is the chart appVersion.
13 | tag: ""
14 |
15 | autoscaling:
16 | enabled: false
17 | minReplicas: 1
18 | maxReplicas: 100
19 | targetCPUUtilizationPercentage: 80
20 |
21 | # resources: {}
22 | # We usually recommend not to specify default resources and to leave this as a conscious
23 | # choice for the user. This also increases chances charts run on environments with little
24 | # resources, such as Minikube. If you do want to specify resources, uncomment the following
25 | # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
26 | # limits:
27 | # cpu: 100m
28 | # memory: 128Mi
29 | # requests:
30 | # cpu: 100m
31 | # memory: 128Mi
32 |
33 | route:
34 | enabled: true
35 |
36 | ingress:
37 | enabled: false
38 |
39 | env:
40 | - name: IMAGE_NAME
41 | valueFrom:
42 | fieldRef:
43 | apiVersion: v1
44 | fieldPath: metadata.name
45 | - name: LOG_LEVEL
46 | value: "debug"
47 |
48 | envFrom:
49 | - configMapRef:
50 | name: jaeger-config
51 | optional: true
52 | - secretRef:
53 | name: jaeger-access
54 | optional: true
55 |
--------------------------------------------------------------------------------
/chart/base/templates/_helpers.tpl:
--------------------------------------------------------------------------------
1 | {{/* vim: set filetype=mustache: */}}
2 | {{/*
3 | Expand the name of the chart.
4 | */}}
5 | {{- define "starter-kit.name" -}}
6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7 | {{- end -}}
8 |
9 | {{/*
10 | Create a default fully qualified app name.
11 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12 | If release name contains chart name it will be used as a full name.
13 | */}}
14 | {{- define "starter-kit.fullname" -}}
15 | {{- if .Values.fullnameOverride -}}
16 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17 | {{- else -}}
18 | {{- $name := include "starter-kit.name" . -}}
19 | {{- if contains $name .Release.Name -}}
20 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21 | {{- else -}}
22 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23 | {{- end -}}
24 | {{- end -}}
25 | {{- end -}}
26 |
27 | {{/*
28 | Create chart name and version as used by the chart label.
29 | */}}
30 | {{- define "starter-kit.chart" -}}
31 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32 | {{- end -}}
33 |
34 | {{- define "starter-kit.host" -}}
35 | {{- $chartName := include "starter-kit.name" . -}}
36 | {{- $host := default $chartName .Values.ingress.host -}}
37 | {{- $subdomain := default .Values.ingress.subdomain .Values.global.ingressSubdomain -}}
38 | {{- if .Values.ingress.namespaceInHost -}}
39 | {{- printf "%s-%s.%s" $host .Release.Namespace $subdomain -}}
40 | {{- else -}}
41 | {{- printf "%s.%s" $host $subdomain -}}
42 | {{- end -}}
43 | {{- end -}}
44 |
45 | {{- define "starter-kit.url" -}}
46 | {{- $secretName := include "starter-kit.tlsSecretName" . -}}
47 | {{- $host := include "starter-kit.host" . -}}
48 | {{- if $secretName -}}
49 | {{- printf "https://%s" $host -}}
50 | {{- else -}}
51 | {{- printf "http://%s" $host -}}
52 | {{- end -}}
53 | {{- end -}}
54 |
55 | {{- define "starter-kit.protocols" -}}
56 | {{- $secretName := include "starter-kit.tlsSecretName" . -}}
57 | {{- if $secretName -}}
58 | {{- printf "%s,%s" "http" "https" -}}
59 | {{- else -}}
60 | {{- printf "%s" "http" -}}
61 | {{- end -}}
62 | {{- end -}}
63 |
64 | {{- define "starter-kit.tlsSecretName" -}}
65 | {{- $secretName := default .Values.ingress.tlsSecretName .Values.global.tlsSecretName -}}
66 | {{- if $secretName }}
67 | {{- printf "%s" $secretName -}}
68 | {{- else -}}
69 | {{- printf "" -}}
70 | {{- end -}}
71 | {{- end -}}
72 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "template-graphql-typescript",
3 | "version": "0.0.1",
4 | "description": "",
5 | "author": "",
6 | "private": true,
7 | "license": "UNLICENSED",
8 | "scripts": {
9 | "build": "nest build",
10 | "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
11 | "start": "nest start",
12 | "start:dev": "nest start --watch",
13 | "start:debug": "nest start --debug --watch",
14 | "start:prod": "node dist/main",
15 | "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
16 | "test": "jest",
17 | "test:watch": "jest --watch",
18 | "test:cov": "jest --coverage",
19 | "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
20 | "test:e2e": "jest --config ./test/jest-e2e.json"
21 | },
22 | "dependencies": {
23 | "@apollo/server": "^4.11.3",
24 | "@nestjs/apollo": "^13.0.2",
25 | "@nestjs/common": "^11.0.5",
26 | "@nestjs/core": "^11.0.5",
27 | "@nestjs/graphql": "^13.0.2",
28 | "@nestjs/platform-express": "^11.0.5",
29 | "graphql": "^16.10.0",
30 | "graphql-subscriptions": "^3.0.0",
31 | "graphql-ws": "^6.0.2",
32 | "reflect-metadata": "^0.2.2",
33 | "rxjs": "^7.8.1"
34 | },
35 | "devDependencies": {
36 | "@nestjs/cli": "^11.0.2",
37 | "@nestjs/schematics": "^11.0.0",
38 | "@nestjs/testing": "^11.0.5",
39 | "@types/express": "^5.0.0",
40 | "@types/jest": "^29.5.14",
41 | "@types/node": "^22.10.10",
42 | "@types/supertest": "^6.0.2",
43 | "@typescript-eslint/eslint-plugin": "^8.21.0",
44 | "@typescript-eslint/parser": "^8.21.0",
45 | "eslint": "^9.18.0",
46 | "eslint-config-prettier": "^10.0.1",
47 | "eslint-plugin-prettier": "^5.2.3",
48 | "jest": "^29.7.0",
49 | "prettier": "^3.4.2",
50 | "source-map-support": "^0.5.21",
51 | "supertest": "^7.0.0",
52 | "ts-jest": "^29.2.5",
53 | "ts-loader": "^9.5.2",
54 | "ts-node": "^10.9.2",
55 | "tsconfig-paths": "^4.2.0",
56 | "typescript": "^5.7.3"
57 | },
58 | "jest": {
59 | "moduleFileExtensions": [
60 | "js",
61 | "json",
62 | "ts"
63 | ],
64 | "rootDir": "src",
65 | "testRegex": ".*\\.spec\\.ts$",
66 | "transform": {
67 | "^.+\\.(t|j)s$": "ts-jest"
68 | },
69 | "collectCoverageFrom": [
70 | "**/*.(t|j)s"
71 | ],
72 | "coverageDirectory": "../coverage",
73 | "testEnvironment": "node"
74 | },
75 | "engines": {
76 | "node": ">= 18.0.0"
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/chart/base/templates/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: {{ include "starter-kit.fullname" . }}
5 | annotations:
6 | {{- if and .Values.vcsInfo.repoUrl .Values.vcsInfo.branch }}
7 | app.openshift.io/vcs-ref: {{ .Values.vcsInfo.branch }}
8 | app.openshift.io/vcs-uri: {{ .Values.vcsInfo.repoUrl }}
9 | {{- end }}
10 | {{- if .Values.connectsTo }}
11 | app.openshift.io/connects-to: {{ .Values.connectsTo }}
12 | {{- end }}
13 | labels:
14 | app.kubernetes.io/name: {{ include "starter-kit.name" . }}
15 | helm.sh/chart: {{ include "starter-kit.chart" . }}
16 | app.kubernetes.io/instance: {{ .Release.Name }}
17 | app: {{ .Release.Name }}
18 | {{- if .Values.partOf }}
19 | app.kubernetes.io/part-of: {{ .Values.partOf }}
20 | {{- end}}
21 | {{- if .Values.runtime }}
22 | app.openshift.io/runtime: {{ .Values.runtime }}
23 | {{- end}}
24 | spec:
25 | replicas: {{ .Values.replicaCount }}
26 | selector:
27 | matchLabels:
28 | app.kubernetes.io/name: {{ include "starter-kit.name" . }}
29 | app.kubernetes.io/instance: {{ .Release.Name }}
30 | template:
31 | metadata:
32 | labels:
33 | app.kubernetes.io/name: {{ include "starter-kit.name" . }}
34 | app.kubernetes.io/instance: {{ .Release.Name }}
35 | spec:
36 | {{- if .Values.image.secretName }}
37 | imagePullSecrets:
38 | - name: {{ .Values.image.secretName }}
39 | {{- end }}
40 | containers:
41 | - name: {{ .Chart.Name }}
42 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
43 | imagePullPolicy: {{ .Values.image.pullPolicy }}
44 |
45 | ports:
46 | - name: http
47 | containerPort: {{ .Values.image.port }}
48 | protocol: TCP
49 | livenessProbe:
50 | httpGet:
51 | path: /
52 | port: http
53 | readinessProbe:
54 | httpGet:
55 | path: /
56 | port: http
57 | env:
58 | - name: INGRESS_HOST
59 | value: ""
60 | - name: PROTOCOLS
61 | value: ""
62 | - name: LOG_LEVEL
63 | value: {{ .Values.logLevel | quote }}
64 | resources:
65 | {{- toYaml .Values.resources | nindent 12 }}
66 | {{- with .Values.nodeSelector }}
67 | nodeSelector:
68 | {{- toYaml . | nindent 8 }}
69 | {{- end }}
70 | {{- with .Values.affinity }}
71 | affinity:
72 | {{- toYaml . | nindent 8 }}
73 | {{- end }}
74 | {{- with .Values.tolerations }}
75 | tolerations:
76 | {{- toYaml . | nindent 8 }}
77 | {{- end }}
78 |
--------------------------------------------------------------------------------
/test/pact-verity.ts:
--------------------------------------------------------------------------------
1 | import * as path from 'path';
2 | import fs = require('fs');
3 | import {Verifier, VerifierOptions} from '@pact-foundation/pact';
4 | import * as yargs from 'yargs';
5 |
6 | import {buildApiServer} from "./helper";
7 | import * as config from '../package.json';
8 | import {ApiServer} from "../src/server";
9 | import superagent = require('superagent');
10 |
11 | const provider = config.config;
12 | const opts: VerifierOptions = config.pact as any;
13 |
14 | const argv = yargs.options({
15 | providerBaseUrl: {
16 | alias: 'p',
17 | default: `${provider.protocol}://${provider.host}:${provider.port}${provider.contextRoot}`
18 | }
19 | }).argv;
20 |
21 | const pactBrokerUrl = process.env.PACTBROKER_URL || opts.pactBrokerUrl;
22 |
23 | async function buildOptions(): Promise {
24 |
25 | const pactUrls = await listPactFiles(path.join(process.cwd(), 'pacts'));
26 | if (!pactBrokerUrl && pactUrls.length === 0) {
27 | console.log('Nothing to test. Pact Broker url not set and no pact files found');
28 | return undefined;
29 | }
30 |
31 | const options: VerifierOptions = Object.assign(
32 | {},
33 | opts,
34 | argv,
35 | pactBrokerUrl
36 | ? {pactBrokerUrl}
37 | : {pactUrls},
38 | {
39 | provider: config.name,
40 | providerVersion: config.version,
41 | publishVerificationResult: true,
42 | },
43 | );
44 |
45 | console.log('Pact verification options', options);
46 |
47 | return options;
48 | }
49 |
50 | async function listPactFiles(pactDir: string): Promise {
51 | return new Promise((resolve, reject) => {
52 | if (!fs.existsSync(pactDir)) {
53 | resolve([]);
54 | return;
55 | }
56 |
57 | fs.readdir(pactDir, (err, items) => {
58 | if (err) {
59 | reject(err);
60 | return;
61 | }
62 |
63 | if (!items || items.length == 0) {
64 | reject(new Error('no pact files found'));
65 | return;
66 | }
67 |
68 | resolve(items.map(item => path.join(pactDir, item)));
69 | });
70 | });
71 | }
72 |
73 | async function verifyPact() {
74 | const options: VerifierOptions = await buildOptions().catch(err => {
75 | console.log('Error building pact options: ' + err.message);
76 | return null;
77 | });
78 |
79 | if (!options) {
80 | return;
81 | }
82 |
83 | if (options.pactBrokerUrl) {
84 | const url = `${options.pactBrokerUrl}/pacts/provider/${options.provider}/latest`;
85 | try {
86 | await superagent.get(url);
87 | } catch (err) {
88 | if (err.status === 404) {
89 | console.log('No pacts found for provider in pact broker: ' + options.provider);
90 | return;
91 | }
92 | }
93 | }
94 |
95 | console.log('Starting server');
96 | const server: ApiServer = await buildApiServer().start();
97 |
98 | try {
99 | await new Verifier(options).verifyProvider();
100 | } finally {
101 | await server.stop();
102 | }
103 | }
104 |
105 | verifyPact().catch(err => {
106 | console.log('Error verifying provider', err);
107 | process.exit(1);
108 | });
109 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at mjperrin@us.ibm.com. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
77 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | # Graphql/Typescript Code Pattern
17 |
18 | This is a template repository for a Typescript-based Graphql micro-service.
19 |
20 | This app contains an opinionated set of components for modern web development, including:
21 |
22 |
23 | ## Getting started
24 |
25 | 1. Click the 'Use this template' button above or [this link](./generate) to generate a new repository
26 | from this template.
27 | 2. Clone the newly created template to your computer
28 | 3. Update the project name in the `project.json` file and update the README with the following steps,
29 | run from the root of your project directory:
30 | ```bash
31 | mv README.md STARTER-KIT.md
32 | echo "# {project name}" > README.md
33 | ```
34 | 4. Add and commit the changes to your repo.
35 |
36 | ## Features
37 |
38 | The starter kit provides the following features:
39 |
40 | * Graphql server from [apollo-server-express](https://github.com/apollographql/apollo-server/tree/main/packages/apollo-server-express)
41 | * Graphql decorators from [type-graphql](https://www.npmjs.com/package/type-graphql)
42 | * Dependency injection using [typescript-ioc](https://www.npmjs.com/package/typescript-ioc) decorators
43 | - Logging using [pino](hhttps://getpino.io/)
44 | - TDD environment with [jest](https://jestjs.io/)
45 | - Pact testing [Pact.io](https://docs.pact.io/)
46 | - DevOps pipeline
47 |
48 | ### Deploying
49 |
50 | After you have created a new git repo from this git template, remember to rename the project.
51 | Edit `package.json` and change the default name to the name you used to create the template.
52 |
53 | Make sure you are logged into the IBM Cloud using the IBM Cloud CLI and have access
54 | to you development cluster. If you are using OpenShift make sure you have logged into OpenShift CLI on the command line.
55 |
56 | ```$bash
57 | npm i -g @ibmgaragecloud/cloud-native-toolkit-cli
58 | ```
59 |
60 | Use the IBM Garage for Cloud CLI to register the GIT Repo with Jenkins
61 | ```$bash
62 | igc pipeline
63 | ```
64 |
65 | ### Building Locally
66 |
67 | To get started building this application locally, you can either run the application natively or use the [IBM Cloud Developer Tools](https://cloud.ibm.com/docs/cli?topic=cloud-cli-getting-started) for containerization and easy deployment to IBM Cloud.
68 |
69 | #### Native Application Development
70 |
71 | Install the latest [Node.js](https://nodejs.org/en/download/) 6+ LTS version.
72 |
73 | Once the Node toolchain has been installed, you can download the project dependencies with:
74 |
75 | ```bash
76 | npm install
77 | cd client; npm install; cd ..
78 | npm run build
79 | npm run start
80 | ```
81 |
82 | To run your application locally:
83 | ```bash
84 | npm run start
85 | ```
86 |
87 | Your application will be running at `http://localhost:3000`. You can access the `/health` and `/appmetrics-dash` endpoints at the host.
88 |
89 | ## Next Steps
90 |
91 | * Learn more about augmenting your Node.js applications on IBM Cloud with the [Node Programming Guide](https://cloud.ibm.com/docs/node?topic=nodejs-getting-started).
92 | * Explore other [sample applications](https://cloud.ibm.com/developer/appservice/starter-kits) on IBM Cloud.
93 |
94 | ## License
95 |
96 | This sample application is licensed under the Apache License, Version 2. Separate third-party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the [Developer Certificate of Origin, Version 1.1](https://developercertificate.org/) and the [Apache License, Version 2](https://www.apache.org/licenses/LICENSE-2.0.txt).
97 |
98 | [Apache License FAQ](https://www.apache.org/foundation/license-faq.html#WhatDoesItMEAN)
99 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Licensed under the Apache License, Version 2.0 (the "License");
190 | you may not use this file except in compliance with the License.
191 | You may obtain a copy of the License at
192 |
193 | http://www.apache.org/licenses/LICENSE-2.0
194 |
195 | Unless required by applicable law or agreed to in writing, software
196 | distributed under the License is distributed on an "AS IS" BASIS,
197 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
198 | See the License for the specific language governing permissions and
199 | limitations under the License.
200 |
--------------------------------------------------------------------------------
/licenses/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Licensed under the Apache License, Version 2.0 (the "License");
190 | you may not use this file except in compliance with the License.
191 | You may obtain a copy of the License at
192 |
193 | http://www.apache.org/licenses/LICENSE-2.0
194 |
195 | Unless required by applicable law or agreed to in writing, software
196 | distributed under the License is distributed on an "AS IS" BASIS,
197 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
198 | See the License for the specific language governing permissions and
199 | limitations under the License.
200 |
--------------------------------------------------------------------------------