Skip to content

Commit

Permalink
[automated commit] Bump docs to version 0.45.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leorossi authored and github-actions[bot] committed Sep 20, 2023
1 parent a6b2c9c commit 050c439
Show file tree
Hide file tree
Showing 120 changed files with 179 additions and 2 deletions.
95 changes: 95 additions & 0 deletions versioned_docs/version-0.45.0/reference/errors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Platformatic Errors

## @platformatic/service

**No errors defined**

## @platformatic/sql-mapper

### PLT_SQL_MAPPER_CANNOT_FIND_ENTITY
**Message:** Cannot find entity %s

### PLT_SQL_MAPPER_SPECIFY_PROTOCOLS
**Message:** You must specify either postgres, mysql or sqlite as protocols

### PLT_SQL_MAPPER_CONNECTION_STRING_REQUIRED
**Message:** connectionString is required

### PLT_SQL_MAPPER_TABLE_MUST_BE_A_STRING
**Message:** Table must be a string, got %s

### PLT_SQL_MAPPER_UNKNOWN_FIELD
**Message:** Unknown field %s

### PLT_SQL_MAPPER_INPUT_NOT_PROVIDED
**Message:** Input not provided.

### PLT_SQL_MAPPER_UNSUPPORTED_WHERE_CLAUSE
**Message:** Unsupported where clause %s

### PLT_SQL_MAPPER_UNSUPPORTED_OPERATOR
**Message:** Unsupported operator for Array field

### PLT_SQL_MAPPER_UNSUPPORTED_OPERATOR_FOR_NON_ARRAY
**Message:** Unsupported operator for non Array field

### PLT_SQL_MAPPER_PARAM_NOT_ALLOWED
**Message:** Param offset=%s not allowed. It must be not negative value.

### PLT_SQL_MAPPER_INVALID_PRIMARY_KEY_TYPE
**Message:** Invalid Primary Key type: "%s". We support the following: %s

### PLT_SQL_MAPPER_PARAM_LIMIT_NOT_ALLOWED
**Message:** Param limit=%s not allowed. Max accepted value %s.

### PLT_SQL_MAPPER_PARAM_LIMIT_MUST_BE_NOT_NEGATIVE
**Message:** Param limit=%s not allowed. It must be a not negative value.

### PLT_SQL_MAPPER_MISSING_VALUE_FOR_PRIMARY_KEY
**Message:** Missing value for primary key %s

### PLT_SQL_MAPPER_SQLITE_ONLY_SUPPORTS_AUTO_INCREMENT_ON_ONE_COLUMN
**Message:** SQLite only supports autoIncrement on one column

## @platformatic/sql-openapi

### PLT_SQL_OPENAPI_UNABLE_CREATE_ROUTE_FOR_REVERSE_RELATIONSHIP
**Message:** Unable to create the route for the reverse relationship

### PLT_SQL_OPENAPI_UNABLE_CREATE_ROUTE_FOR_PK_COL_RELATIONSHIP
**Message:** Unable to create the route for the PK col relationship

## @platformatic/sql-graphql

### PLT_SQL_GRAPHQL_UNABLE_GENERATE_GRAPHQL_ENUM_TYPE
**Message:** Unable to generate GraphQLEnumType

### PLT_SQL_GRAPHQL_UNSUPPORTED_KIND
**Message:** Unsupported kind: %s

### PLT_SQL_GRAPHQL_ERROR_PRINTING_GRAPHQL_SCHEMA
**Message:** Error printing the GraphQL schema

## @platformatic/sql-events

### PLT_SQL_EVENTS_OBJECT_IS_REQUIRED_UNDER_THE_DATA_PROPERTY
**Message:** The object that will be published is required under the data property

### PLT_SQL_EVENTS_PRIMARY_KEY_IS_NECESSARY_INSIDE_DATA
**Message:** The primaryKey is necessary inside data

### PLT_SQL_EVENTS_NO_SUCH_ACTION
**Message:** No such action %s

## @platformatic/sql-json-schema-mapper

**No errors defined**

## @platformatic/telemetry

**No errors defined**

## @platformatic/utils

### PLT_SQL_UTILS_PATH_OPTION_REQUIRED
**Message:** path option is required
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ If you run into a bug or have a suggestion for improvement, please
If you're only interested in the features available in Platformatic Service, you can simply switch `platformatic` with `@platformatic/service` in the `dependencies` of your `package.json`, so that you'll only import fewer deps.

You can use the `plt-service` command, it's the equivalent of `plt service`.

## TypeScript

To generate the types for the application, run `platformatic db types`.
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,56 @@ console.log(await res.json())

await service.close()
```

## TypeScript support


In order for this module to work on a TypeScript setup (outside of an application created with `create-platformatic`),
you have to add the following to your types:

```ts
import { FastifyInstance } from 'fastify'
import { PlatformaticApp, PlatformaticServiceConfig } from '@platformatic/service'

declare module 'fastify' {
interface FastifyInstance {
platformatic: PlatformaticApp<PlatformaticServiceConfig>
}
}
```

Then, you can use it:

```ts
/// <reference path="./global.d.ts" />
import { FastifyInstance } from 'fastify'

export default async function (app: FastifyInstance) {
app.get('/', async () => {
return app.platformatic.config
})
}
```

You can always generate a file called `global.d.ts` with the above content via the `platformatic service types` command.


### Usage with custom configuration

If you are creating a reusable application on top of Platformatic Service, you would need to create the types for your schema,
using [json-schema-to-typescript](https://www.npmjs.com/package/json-schema-to-typescript) in a `./config.d.ts` file and
use it like so:

```ts
import { FastifyInstance } from 'fastify'
import { PlatformaticApp } from '@platformatic/service'
import { YourApp } from './config'

declare module 'fastify' {
interface FastifyInstance {
platformatic: PlatformaticApp<YourApp>
}
}
```

Note that you can construct `platformatic` like any other union types, adding other definitions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,28 @@ async function main() {

main()
```

#### TypeScript support

In order for this module to work on a TypeScript setup (outside of a Platformatic application),
you have to add the following to your types:

```ts
import { Entities, Entity } from '@platformatic/sql-mapper'

type Movie {
id: number,
title: string
}

interface AppEntities extends Entities {
movie: Entity<Movie>
}

declare module 'fastify' {
interface FastifyInstance {
platformatic: SQLMapperPluginInterface<AppEntities>
}
}
```

4 changes: 2 additions & 2 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
"0.45.0",
"0.44.0",
"0.43.1",
"0.43.0",
"0.42.3",
"0.42.2"
"0.42.3"
]

0 comments on commit 050c439

Please sign in to comment.