Socket
Socket
Sign inDemoInstall

graphql-upload

Package Overview
Dependencies
33
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 13.0.0 to 14.0.0

GRAPHQL_MULTIPART_REQUEST_SPEC_URL.js

79

package.json
{
"name": "graphql-upload",
"version": "13.0.0",
"version": "14.0.0",
"description": "Middleware and an Upload scalar to add support for GraphQL multipart requests (file uploads via queries and mutations) to various Node.js GraphQL servers.",

@@ -30,57 +30,68 @@ "license": "MIT",

"files": [
"private",
"public"
"GRAPHQL_MULTIPART_REQUEST_SPEC_URL.js",
"GraphQLUpload.js",
"graphqlUploadExpress.js",
"graphqlUploadKoa.js",
"ignoreStream.js",
"processRequest.js",
"Upload.js"
],
"sideEffects": false,
"main": "./public/index.js",
"exports": {
".": {
"import": "./public/index.mjs",
"require": "./public/index.js"
},
"./public/*": "./public/*",
"./package.json": "./package.json"
"./GraphQLUpload.js": "./GraphQLUpload.js",
"./graphqlUploadExpress.js": "./graphqlUploadExpress.js",
"./graphqlUploadKoa.js": "./graphqlUploadKoa.js",
"./package.json": "./package.json",
"./processRequest.js": "./processRequest.js",
"./Upload.js": "./Upload.js"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >= 16.0.0"
"node": "^14.17.0 || ^16.0.0 || >= 18.0.0"
},
"peerDependencies": {
"graphql": "0.13.1 - 16"
"@types/express": "^4.0.29",
"@types/koa": "^2.11.4",
"graphql": "^16.3.0"
},
"peerDependenciesMeta": {
"@types/express": {
"optional": true
},
"@types/koa": {
"optional": true
}
},
"dependencies": {
"@types/busboy": "^0.3.2",
"@types/node": "*",
"@types/object-path": "^0.11.1",
"busboy": "^0.3.1",
"fs-capacitor": "^6.2.0",
"http-errors": "^1.8.1",
"http-errors": "^2.0.0",
"object-path": "^0.11.8"
},
"devDependencies": {
"coverage-node": "^5.0.1",
"eslint": "^8.3.0",
"eslint-config-env": "^23.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsdoc": "^37.0.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"express": "^4.17.1",
"form-data-encoder": "^1.7.1",
"formdata-node": "^4.3.1",
"graphql": "^16.0.1",
"hard-rejection": "^2.1.0",
"jsdoc-md": "^11.0.2",
"@types/express": "^4.17.13",
"@types/koa": "^2.13.4",
"coverage-node": "^6.1.0",
"eslint": "^8.16.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"express": "^4.18.0",
"form-data-encoder": "^2.0.1",
"graphql": "^16.5.0",
"koa": "^2.13.4",
"node-abort-controller": "^3.0.1",
"node-fetch": "^3.1.0",
"prettier": "^2.5.0",
"test-director": "^7.0.0"
"node-fetch": "^3.2.3",
"prettier": "^2.6.2",
"test-director": "^8.0.2",
"typescript": "^4.7.1-rc"
},
"scripts": {
"docs-update": "jsdoc-md",
"docs-check": "jsdoc-md -c",
"eslint": "eslint .",
"prettier": "prettier -c .",
"tests": "coverage-node -r hard-rejection/register test/index.mjs",
"test": "npm run eslint && npm run prettier && npm run docs-check && npm run tests",
"types": "tsc -p jsconfig.json",
"tests": "coverage-node --unhandled-rejections=throw test.mjs",
"test": "npm run eslint && npm run prettier && npm run types && npm run tests",
"prepublishOnly": "npm test"
}
}

@@ -7,3 +7,3 @@ ![graphql-upload logo](https://cdn.jsdelivr.net/gh/jaydenseric/graphql-upload@8.0.0/graphql-upload-logo.svg)

Middleware and an [`Upload`](#class-graphqlupload) scalar to add support for [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec) (file uploads via queries and mutations) to various Node.js GraphQL servers.
Middleware and an [`Upload`](./GraphQLUpload.js) scalar to add support for [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec) (file uploads via queries and mutations) to various Node.js GraphQL servers.

@@ -20,9 +20,9 @@ ## Installation

Use the [`graphqlUploadKoa`](#function-graphqluploadkoa) or [`graphqlUploadExpress`](#function-graphqluploadexpress) middleware just before GraphQL middleware. Alternatively, use [`processRequest`](#function-processrequest) to create custom middleware.
Use the [`graphqlUploadKoa`](./graphqlUploadKoa.js) or [`graphqlUploadExpress`](./graphqlUploadExpress.js) middleware just before GraphQL middleware. Alternatively, use [`processRequest`](./processRequest.js) to create custom middleware.
A schema built with separate SDL and resolvers (e.g. using [`makeExecutableSchema`](https://www.graphql-tools.com/docs/api/modules/schema#makeexecutableschema) from [`@graphql-tools/schema`](https://npm.im/@graphql-tools/schema)) requires the [`Upload`](#class-graphqlupload) scalar to be setup.
A schema built with separate SDL and resolvers (e.g. using [`makeExecutableSchema`](https://www.graphql-tools.com/docs/api/modules/schema_src#makeexecutableschema) from [`@graphql-tools/schema`](https://npm.im/@graphql-tools/schema)) requires the [`Upload`](./GraphQLUpload.js) scalar to be setup.
## Usage
[Clients implementing the GraphQL multipart request spec](https://github.com/jaydenseric/graphql-multipart-request-spec#client) upload files as [`Upload`](#class-graphqlupload) scalar query or mutation variables. Their resolver values are promises that resolve [file upload details](#type-fileupload) for processing and storage. Files are typically streamed into cloud storage but may also be stored in the filesystem.
[Clients implementing the GraphQL multipart request spec](https://github.com/jaydenseric/graphql-multipart-request-spec#client) upload files as [`Upload`](./GraphQLUpload.js) scalar query or mutation variables. Their resolver values are promises that resolve file upload details for processing and storage. Files are typically streamed into cloud storage but may also be stored in the filesystem.

@@ -33,9 +33,9 @@ See the [example API and client](https://github.com/jaydenseric/apollo-upload-examples).

- The process must have both read and write access to the directory identified by [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir).
- The process must have both read and write access to the directory identified by [`os.tmpdir()`](https://nodejs.org/api/os.html#ostmpdir).
- The device requires sufficient disk space to buffer the expected number of concurrent upload requests.
- Promisify and await file upload streams in resolvers or the server will send a response to the client before uploads are complete, causing a disconnect.
- Handle file upload promise rejection and stream errors; uploads sometimes fail due to network connectivity issues or impatient users disconnecting.
- Process multiple uploads asynchronously with [`Promise.all`](https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/promise/all) or a more flexible solution such as [`Promise.allSettled`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled) where an error in one does not reject them all.
- Only use [`createReadStream()`](#type-fileupload) _before_ the resolver returns; late calls (e.g. in an unawaited async function or callback) throw an error. Existing streams can still be used after a response is sent, although there are few valid reasons for not awaiting their completion.
- Use [`stream.destroy()`](https://nodejs.org/api/stream.html#stream_readable_destroy_error) when an incomplete stream is no longer needed, or temporary files may not get cleaned up.
- Process multiple uploads asynchronously with [`Promise.all`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all) or a more flexible solution such as [`Promise.allSettled`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled) where an error in one does not reject them all.
- Only use the function `createReadStream` _before_ the resolver returns; late calls (e.g. in an unawaited async function or callback) throw an error. Existing streams can still be used after a response is sent, although there are few valid reasons for not awaiting their completion.
- Use [`stream.destroy()`](https://nodejs.org/api/stream.html#readabledestroyerror) when an incomplete stream is no longer needed, or temporary files may not get cleaned up.

@@ -46,381 +46,18 @@ ## Architecture

[`busboy`](https://npm.im/busboy) parses multipart request streams. Once the `operations` and `map` fields have been parsed, [`Upload`](#class-graphqlupload) scalar values in the GraphQL operations are populated with promises, and the operations are passed down the middleware chain to GraphQL resolvers.
[`busboy`](https://npm.im/busboy) parses multipart request streams. Once the `operations` and `map` fields have been parsed, [`Upload`](./GraphQLUpload.js) scalar values in the GraphQL operations are populated with promises, and the operations are passed down the middleware chain to GraphQL resolvers.
[`fs-capacitor`](https://npm.im/fs-capacitor) is used to buffer file uploads to the filesystem and coordinate simultaneous reading and writing. As soon as a file upload’s contents begins streaming, its data begins buffering to the filesystem and its associated promise resolves. GraphQL resolvers can then create new streams from the buffer by calling [`createReadStream()`](#type-fileupload). The buffer is destroyed once all streams have ended or closed and the server has responded to the request. Any remaining buffer files will be cleaned when the process exits.
[`fs-capacitor`](https://npm.im/fs-capacitor) is used to buffer file uploads to the filesystem and coordinate simultaneous reading and writing. As soon as a file upload’s contents begins streaming, its data begins buffering to the filesystem and its associated promise resolves. GraphQL resolvers can then create new streams from the buffer by calling the function `createReadStream`. The buffer is destroyed once all streams have ended or closed and the server has responded to the request. Any remaining buffer files will be cleaned when the process exits.
## Requirements
- [Node.js](https://nodejs.org): `^12.22.0 || ^14.17.0 || >= 16.0.0`
- [Node.js](https://nodejs.org): `^14.17.0 || ^16.0.0 || >= 18.0.0`
## API
## Exports
- [class GraphQLUpload](#class-graphqlupload)
- [class Upload](#class-upload)
- [Upload instance method reject](#upload-instance-method-reject)
- [Upload instance method resolve](#upload-instance-method-resolve)
- [Upload instance property file](#upload-instance-property-file)
- [Upload instance property promise](#upload-instance-property-promise)
- [function graphqlUploadExpress](#function-graphqluploadexpress)
- [function graphqlUploadKoa](#function-graphqluploadkoa)
- [function processRequest](#function-processrequest)
- [type FileUpload](#type-fileupload)
- [type FileUploadCreateReadStream](#type-fileuploadcreatereadstream)
- [type GraphQLOperation](#type-graphqloperation)
- [type ProcessRequestFunction](#type-processrequestfunction)
- [type ProcessRequestOptions](#type-processrequestoptions)
These CommonJS modules are published to [npm](https://npmjs.com) and exported via the [`package.json`](./package.json) `exports` field:
### class GraphQLUpload
A GraphQL `Upload` scalar that can be used in a [`GraphQLSchema`](https://graphql.org/graphql-js/type/#graphqlschema). It’s value in resolvers is a promise that resolves [file upload details](#type-fileupload) for processing and storage.
#### Examples
_Ways to `import`._
> ```js
> import { GraphQLUpload } from "graphql-upload";
> ```
>
> ```js
> import GraphQLUpload from "graphql-upload/public/GraphQLUpload.js";
> ```
_Ways to `require`._
> ```js
> const { GraphQLUpload } = require("graphql-upload");
> ```
>
> ```js
> const GraphQLUpload = require("graphql-upload/public/GraphQLUpload.js");
> ```
_A schema built using [`makeExecutableSchema`](https://www.graphql-tools.com/docs/api/modules/schema#makeexecutableschema) from [`@graphql-tools/schema`](https://npm.im/@graphql-tools/schema)._
> ```js
> const { makeExecutableSchema } = require("@graphql-tools/schema");
> const { GraphQLUpload } = require("graphql-upload");
>
> const schema = makeExecutableSchema({
> typeDefs: /* GraphQL */ `
> scalar Upload
> `,
> resolvers: {
> Upload: GraphQLUpload,
> },
> });
> ```
_A manually constructed schema with an image upload mutation._
> ```js
> const {
> GraphQLSchema,
> GraphQLObjectType,
> GraphQLBoolean,
> } = require("graphql");
> const { GraphQLUpload } = require("graphql-upload");
>
> const schema = new GraphQLSchema({
> mutation: new GraphQLObjectType({
> name: "Mutation",
> fields: {
> uploadImage: {
> description: "Uploads an image.",
> type: GraphQLBoolean,
> args: {
> image: {
> description: "Image file.",
> type: GraphQLUpload,
> },
> },
> async resolve(parent, { image }) {
> const { filename, mimetype, createReadStream } = await image;
> const stream = createReadStream();
> // Promisify the stream and store the file, then…
> return true;
> },
> },
> },
> }),
> });
> ```
---
### class Upload
A file expected to be uploaded as it has been declared in the `map` field of a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). The [`processRequest`](#function-processrequest) function places references to an instance of this class wherever the file is expected in the [GraphQL operation](#type-graphqloperation). The [`Upload`](#class-graphqlupload) scalar derives it’s value from the [`promise`](#upload-instance-property-promise) property.
#### Examples
_Ways to `import`._
> ```js
> import { Upload } from "graphql-upload";
> ```
>
> ```js
> import Upload from "graphql-upload/public/Upload.js";
> ```
_Ways to `require`._
> ```js
> const { Upload } = require("graphql-upload");
> ```
>
> ```js
> const Upload = require("graphql-upload/public/Upload.js");
> ```
#### Upload instance method reject
Rejects the upload promise with an error. This should only be utilized by [`processRequest`](#function-processrequest).
| Parameter | Type | Description |
| :-------- | :----- | :-------------- |
| `error` | object | Error instance. |
#### Upload instance method resolve
Resolves the upload promise with the file upload details. This should only be utilized by [`processRequest`](#function-processrequest).
| Parameter | Type | Description |
| :-------- | :----------------------------- | :------------------- |
| `file` | [FileUpload](#type-fileupload) | File upload details. |
#### Upload instance property file
The file upload details, available when the [upload promise](#upload-instance-property-promise) resolves. This should only be utilized by [`processRequest`](#function-processrequest).
**Type:** `undefined` | [FileUpload](#type-fileupload)
#### Upload instance property promise
Promise that resolves file upload details. This should only be utilized by [`GraphQLUpload`](#class-graphqlupload).
**Type:** Promise<[FileUpload](#type-fileupload)>
---
### function graphqlUploadExpress
Creates [Express](https://expressjs.com) middleware that processes [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec) using [`processRequest`](#function-processrequest), ignoring non-multipart requests. It sets the request body to be [similar to a conventional GraphQL POST request](#type-graphqloperation) for following GraphQL middleware to consume.
| Parameter | Type | Description |
| :-- | :-- | :-- |
| `options` | [ProcessRequestOptions](#type-processrequestoptions) | Middleware options. Any [`ProcessRequestOptions`](#type-processrequestoptions) can be used. |
| `options.processRequest` | [ProcessRequestFunction](#type-processrequestfunction)? = [processRequest](#function-processrequest) | Used to process [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec). |
**Returns:** Function — Express middleware.
#### Examples
_Ways to `import`._
> ```js
> import { graphqlUploadExpress } from "graphql-upload";
> ```
>
> ```js
> import graphqlUploadExpress from "graphql-upload/public/graphqlUploadExpress.js";
> ```
_Ways to `require`._
> ```js
> const { graphqlUploadExpress } = require("graphql-upload");
> ```
>
> ```js
> const graphqlUploadExpress = require("graphql-upload/public/graphqlUploadExpress.js");
> ```
_Basic [`express-graphql`](https://npm.im/express-graphql) setup._
> ```js
> const express = require("express");
> const graphqlHTTP = require("express-graphql");
> const { graphqlUploadExpress } = require("graphql-upload");
> const schema = require("./schema");
>
> express()
> .use(
> "/graphql",
> graphqlUploadExpress({ maxFileSize: 10000000, maxFiles: 10 }),
> graphqlHTTP({ schema })
> )
> .listen(3000);
> ```
---
### function graphqlUploadKoa
Creates [Koa](https://koajs.com) middleware that processes [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec) using [`processRequest`](#function-processrequest), ignoring non-multipart requests. It sets the request body to be [similar to a conventional GraphQL POST request](#type-graphqloperation) for following GraphQL middleware to consume.
| Parameter | Type | Description |
| :-- | :-- | :-- |
| `options` | [ProcessRequestOptions](#type-processrequestoptions) | Middleware options. Any [`ProcessRequestOptions`](#type-processrequestoptions) can be used. |
| `options.processRequest` | [ProcessRequestFunction](#type-processrequestfunction)? = [processRequest](#function-processrequest) | Used to process [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec). |
**Returns:** Function — Koa middleware.
#### Examples
_Ways to `import`._
> ```js
> import { graphqlUploadKoa } from "graphql-upload";
> ```
>
> ```js
> import graphqlUploadKoa from "graphql-upload/public/graphqlUploadKoa.js";
> ```
_Ways to `require`._
> ```js
> const { graphqlUploadKoa } = require("graphql-upload");
> ```
>
> ```js
> const graphqlUploadKoa = require("graphql-upload/public/graphqlUploadKoa.js");
> ```
_Basic [`graphql-api-koa`](https://npm.im/graphql-api-koa) setup._
> ```js
> const Koa = require("koa");
> const bodyParser = require("koa-bodyparser");
> const { errorHandler, execute } = require("graphql-api-koa");
> const { graphqlUploadKoa } = require("graphql-upload");
> const schema = require("./schema");
>
> new Koa()
> .use(errorHandler())
> .use(bodyParser())
> .use(graphqlUploadKoa({ maxFileSize: 10000000, maxFiles: 10 }))
> .use(execute({ schema }))
> .listen(3000);
> ```
---
### function processRequest
Processes a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). It parses the `operations` and `map` fields to create an [`Upload`](#class-upload) instance for each expected file upload, placing references wherever the file is expected in the [GraphQL operation](#type-graphqloperation) for the [`Upload`](#class-graphqlupload) scalar to derive it’s value. Errors are created with [`http-errors`](https://npm.im/http-errors) to assist in sending responses with appropriate HTTP status codes. Used in [`graphqlUploadExpress`](#function-graphqluploadexpress) and [`graphqlUploadKoa`](#function-graphqluploadkoa) and can be used to create custom middleware.
**Type:** [ProcessRequestFunction](#type-processrequestfunction)
#### Examples
_Ways to `import`._
> ```js
> import { processRequest } from "graphql-upload";
> ```
>
> ```js
> import processRequest from "graphql-upload/public/processRequest.js";
> ```
_Ways to `require`._
> ```js
> const { processRequest } = require("graphql-upload");
> ```
>
> ```js
> const processRequest = require("graphql-upload/public/processRequest.js");
> ```
---
### type FileUpload
File upload details that are only available after the file’s field in the [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec) has begun streaming in.
**Type:** object
| Property | Type | Description |
| :-- | :-- | :-- |
| `filename` | string | File name. |
| `mimetype` | string | File MIME type. Provided by the client and can’t be trusted. |
| `encoding` | string | File stream transfer encoding. |
| `createReadStream` | [FileUploadCreateReadStream](#type-fileuploadcreatereadstream) | Creates a [Node.js readable stream](https://nodejs.org/api/stream.html#stream_readable_streams) of the file’s contents, for processing and storage. |
---
### type FileUploadCreateReadStream
Creates a [Node.js readable stream](https://nodejs.org/api/stream.html#stream_readable_streams) of an [uploading file’s](#type-fileupload) contents, for processing and storage. Multiple calls create independent streams. Throws if called after all resolvers have resolved, or after an error has interrupted the request.
**Type:** Function
| Parameter | Type | Description |
| :-- | :-- | :-- |
| `options` | object? | [`fs-capacitor`](https://npm.im/fs-capacitor) [`ReadStreamOptions`](https://github.com/mike-marcacci/fs-capacitor#readstreamoptions). |
| `options.encoding` | string? = `null` | Specify an encoding for the [`data`](https://nodejs.org/api/stream.html#stream_event_data) chunks to be strings (without splitting multi-byte characters across chunks) instead of Node.js [`Buffer`](https://nodejs.org/api/buffer.html#buffer_buffer) instances. Supported values depend on the [`Buffer` implementation](https://github.com/nodejs/node/blob/v13.7.0/lib/buffer.js#L587-L663) and include `utf8`, `ucs2`, `utf16le`, `latin1`, `ascii`, `base64`, or `hex`. |
| `options.highWaterMark` | number? = `16384` | Maximum number of bytes to store in the internal buffer before ceasing to read from the underlying resource. |
**Returns:** Readable — [Node.js readable stream](https://nodejs.org/api/stream.html#stream_readable_streams) of the file’s contents.
#### See
- [Node.js `Readable` stream constructor docs](https://nodejs.org/api/stream.html#stream_new_stream_readable_options).
- [Node.js stream backpressure guide](https://nodejs.org/en/docs/guides/backpressuring-in-streams).
---
### type GraphQLOperation
A GraphQL operation object in a shape that can be consumed and executed by most GraphQL servers.
**Type:** object
| Property | Type | Description |
| :-- | :-- | :-- |
| `query` | string | GraphQL document containing queries and fragments. |
| `operationName` | string \| `null`? | GraphQL document operation name to execute. |
| `variables` | object \| `null`? | GraphQL document operation variables and values map. |
#### See
- [GraphQL over HTTP spec](https://github.com/graphql/graphql-over-http).
- [Apollo Server POST requests](https://www.apollographql.com/docs/apollo-server/requests/#post-requests).
---
### type ProcessRequestFunction
Processes a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec).
**Type:** Function
| Parameter | Type | Description |
| :-- | :-- | :-- |
| `request` | IncomingMessage | [Node.js HTTP server request instance](https://nodejs.org/api/http.html#http_class_http_incomingmessage). |
| `response` | ServerResponse | [Node.js HTTP server response instance](https://nodejs.org/api/http.html#http_class_http_serverresponse). |
| `options` | [ProcessRequestOptions](#type-processrequestoptions)? | Options for processing the request. |
**Returns:** Promise<[GraphQLOperation](#type-graphqloperation) | Array<[GraphQLOperation](#type-graphqloperation)>> — GraphQL operation or batch of operations for a GraphQL server to consume (usually as the request body).
#### See
- [`processRequest`](#function-processrequest).
---
### type ProcessRequestOptions
Options for processing a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec); mostly relating to security, performance and limits.
**Type:** object
| Property | Type | Description |
| :-- | :-- | :-- |
| `maxFieldSize` | number? = `1000000` | Maximum allowed non-file multipart form field size in bytes; enough for your queries. |
| `maxFileSize` | number? = Infinity | Maximum allowed file size in bytes. |
| `maxFiles` | number? = Infinity | Maximum allowed number of files. |
- [`GraphQLUpload.js`](./GraphQLUpload.js)
- [`graphqlUploadExpress.js`](./graphqlUploadExpress.js)
- [`graphqlUploadKoa.js`](./graphqlUploadKoa.js)
- [`processRequest.js`](./processRequest.js)
- [`Upload.js`](./Upload.js)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc