@platformatic/runtime 2.0.0-alpha.1 → 2.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.d.ts +285 -0
- package/eslint.config.js +8 -0
- package/fixtures/botched-start/platformatic.runtime.json +1 -1
- package/fixtures/botched-start/services/a/platformatic.service.json +1 -1
- package/fixtures/composerApp/platformatic.composer.json +1 -1
- package/fixtures/configs/invalid-autoload-with-services.json +1 -1
- package/fixtures/configs/invalid-entrypoint.json +1 -1
- package/fixtures/configs/invalid-schema-type.config.json +1 -1
- package/fixtures/configs/missing-property.config.json +1 -1
- package/fixtures/configs/missing-service-config.json +1 -1
- package/fixtures/configs/monorepo-composer-no-autoload.json +2 -2
- package/fixtures/configs/monorepo-composer.json +2 -2
- package/fixtures/configs/monorepo-create-cycle.json +2 -2
- package/fixtures/configs/monorepo-missing-dependencies.json +2 -2
- package/fixtures/configs/monorepo-no-cycles.json +2 -2
- package/fixtures/configs/monorepo-openapi.json +2 -2
- package/fixtures/configs/{monorepo-hotreload-env.json → monorepo-watch-env.json} +2 -2
- package/fixtures/configs/monorepo-watch-single.json +12 -0
- package/fixtures/configs/monorepo-watch.json +26 -9
- package/fixtures/configs/monorepo-with-dependencies.json +2 -2
- package/fixtures/configs/monorepo-with-management-api-without-metrics.json +21 -0
- package/fixtures/configs/monorepo-with-management-api.json +2 -2
- package/fixtures/configs/{monorepo-hotreload.json → monorepo-with-metrics.json} +5 -4
- package/fixtures/configs/monorepo.json +2 -2
- package/fixtures/configs/no-services.config.json +1 -1
- package/fixtures/configs/no-sources.config.json +1 -1
- package/fixtures/configs/service-throws-on-start.json +1 -1
- package/fixtures/configs/service-with-env-port.json +2 -2
- package/fixtures/configs/service-with-stdio.json +12 -0
- package/fixtures/configs/{hotreload.json → watch.json} +2 -2
- package/fixtures/dbApp/platformatic.db.json +1 -1
- package/fixtures/dbAppNoName/platformatic.db.json +1 -1
- package/fixtures/dbAppNoPackageJson/platformatic.db.json +1 -1
- package/fixtures/dbAppWithMigrationError/platformatic.db.json +1 -1
- package/fixtures/do-not-reload-dependencies/platformatic.service.json +1 -1
- package/fixtures/do-not-restart-on-crash/platformatic.runtime.json +3 -2
- package/fixtures/do-not-restart-on-crash/services/a/platformatic.service.json +1 -1
- package/fixtures/express/platformatic.runtime.json +1 -1
- package/fixtures/express/services/a/platformatic.service.json +1 -1
- package/fixtures/express/services/b/platformatic.service.json +1 -1
- package/fixtures/external-client/platformatic.service.json +1 -1
- package/fixtures/interceptors/idp.js +2 -2
- package/fixtures/interceptors/platformatic.runtime.json +1 -1
- package/fixtures/interceptors/services/a/platformatic.service.json +1 -1
- package/fixtures/interceptors-2/platformatic.runtime.json +1 -1
- package/fixtures/interceptors-2/services/a/platformatic.service.json +1 -1
- package/fixtures/leven/platformatic.runtime.json +2 -2
- package/fixtures/leven/services/deeply-spittle/platformatic.service.json +1 -1
- package/fixtures/leven/services/rainy-empire/platformatic.composer.json +1 -1
- package/fixtures/management-api/platformatic.json +3 -3
- package/fixtures/management-api/services/service-1/platformatic.json +1 -1
- package/fixtures/management-api/services/service-1/plugin.js +4 -3
- package/fixtures/management-api/services/service-2/platformatic.json +1 -1
- package/fixtures/management-api/services/service-db/platformatic.db.json +1 -1
- package/fixtures/management-api-custom-labels/platformatic.json +2 -2
- package/fixtures/management-api-custom-labels/services/service-1/platformatic.json +1 -1
- package/fixtures/management-api-custom-labels/services/service-1/plugin.js +4 -3
- package/fixtures/management-api-custom-labels/services/service-2/platformatic.json +1 -1
- package/fixtures/management-api-custom-labels/services/service-db/platformatic.db.json +1 -1
- package/fixtures/management-api-without-metrics/platformatic.json +3 -2
- package/fixtures/management-api-without-metrics/services/service-1/platformatic.json +1 -1
- package/fixtures/monorepo/composerApp/platformatic.composer.json +1 -1
- package/fixtures/monorepo/dbApp/platformatic.db.json +1 -1
- package/fixtures/monorepo/serviceApp/platformatic.service.json +3 -2
- package/fixtures/monorepo/serviceApp/with-logger/with-logger.cjs +2 -2
- package/fixtures/monorepo/serviceApp/with-logger/with-logger.d.ts +7 -7
- package/fixtures/monorepo/serviceAppWithLogger/platformatic.service.json +1 -1
- package/fixtures/monorepo/serviceAppWithLogger/plugin.js +12 -0
- package/fixtures/monorepo/serviceAppWithMultiplePlugins/platformatic.service.json +3 -2
- package/fixtures/monorepo-missing-dependencies/composer/platformatic.json +1 -1
- package/fixtures/monorepo-openapi/serviceAppWithoutOpenapi/platformatic.service.json +1 -1
- package/fixtures/monorepo-watch/service1/platformatic.service.json +1 -1
- package/fixtures/monorepo-with-dependencies/main/platformatic.json +1 -1
- package/fixtures/monorepo-with-dependencies/service-1/platformatic.json +1 -1
- package/fixtures/monorepo-with-dependencies/service-2/platformatic.json +1 -1
- package/fixtures/no-env.service.json +1 -1
- package/fixtures/preload/platformatic.runtime.json +1 -1
- package/fixtures/preload/services/a/platformatic.service.json +1 -1
- package/fixtures/prom-server/platformatic.json +2 -2
- package/fixtures/prom-server/services/service-1/platformatic.json +1 -1
- package/fixtures/prom-server/services/service-2/platformatic.json +1 -1
- package/fixtures/restart-on-crash/platformatic.runtime.json +1 -1
- package/fixtures/restart-on-crash/services/a/platformatic.service.json +1 -1
- package/fixtures/sample-runtime/package.json +1 -1
- package/fixtures/sample-runtime/platformatic.json +2 -2
- package/fixtures/sample-runtime/services/rival/package.json +1 -1
- package/fixtures/sample-runtime/services/rival/platformatic.json +1 -1
- package/fixtures/sample-runtime-with-2-services/package.json +1 -1
- package/fixtures/sample-runtime-with-2-services/platformatic.json +2 -2
- package/fixtures/sample-runtime-with-2-services/services/foobar/package.json +1 -1
- package/fixtures/sample-runtime-with-2-services/services/foobar/platformatic.json +1 -1
- package/fixtures/sample-runtime-with-2-services/services/rival/package.json +1 -1
- package/fixtures/sample-runtime-with-2-services/services/rival/platformatic.json +1 -1
- package/fixtures/server/logger-transport/platformatic.runtime.json +2 -2
- package/fixtures/server/logger-transport/services/echo/platformatic.service.json +1 -1
- package/fixtures/server/overrides-service/platformatic.runtime.json +2 -2
- package/fixtures/server/overrides-service/services/echo/platformatic.service.json +1 -1
- package/fixtures/server/runtime-server/platformatic.runtime.json +2 -2
- package/fixtures/server/runtime-server/services/echo/platformatic.service.json +1 -1
- package/fixtures/serviceAppThrowsOnStart/platformatic.service.json +1 -1
- package/fixtures/stackables/node_modules/foo/foo.js +2 -1
- package/fixtures/start-command-in-runtime.js +1 -1
- package/fixtures/stdio/platformatic.service.json +6 -0
- package/fixtures/stdio/plugin.js +24 -0
- package/fixtures/telemetry/platformatic.runtime.json +2 -2
- package/fixtures/telemetry/services/echo/platformatic.service.json +1 -1
- package/fixtures/typescript/platformatic.runtime.json +2 -2
- package/fixtures/typescript/services/composer/platformatic.composer.json +1 -1
- package/fixtures/typescript/services/movies/global.d.ts +2 -3
- package/fixtures/typescript/services/movies/platformatic.db.json +1 -1
- package/fixtures/typescript/services/movies/types/Movie.d.ts +3 -3
- package/fixtures/typescript/services/movies/types/index.d.ts +6 -6
- package/fixtures/typescript/services/titles/client/client.d.ts +35 -35
- package/fixtures/typescript/services/titles/platformatic.service.json +1 -1
- package/fixtures/typescript-custom-flags/platformatic.runtime.json +2 -2
- package/fixtures/typescript-custom-flags/services/composer/platformatic.composer.json +1 -1
- package/fixtures/typescript-custom-flags/services/movies/global.d.ts +2 -3
- package/fixtures/typescript-custom-flags/services/movies/platformatic.db.json +1 -1
- package/fixtures/typescript-custom-flags/services/movies/types/Movie.d.ts +3 -3
- package/fixtures/typescript-custom-flags/services/movies/types/index.d.ts +6 -6
- package/fixtures/typescript-custom-flags/services/titles/client/client.d.ts +35 -35
- package/fixtures/typescript-custom-flags/services/titles/platformatic.service.json +1 -1
- package/fixtures/typescript-no-env/platformatic.runtime.json +2 -2
- package/fixtures/typescript-no-env/services/composer/platformatic.composer.json +1 -1
- package/fixtures/typescript-no-env/services/movies/global.d.ts +2 -3
- package/fixtures/typescript-no-env/services/movies/platformatic.db.json +1 -1
- package/fixtures/typescript-no-env/services/movies/types/Movie.d.ts +3 -3
- package/fixtures/typescript-no-env/services/movies/types/index.d.ts +6 -6
- package/fixtures/typescript-no-env/services/titles/client/client.d.ts +35 -35
- package/fixtures/typescript-no-env/services/titles/platformatic.service.json +1 -1
- package/index.d.ts +7 -8
- package/index.js +14 -10
- package/index.test-d.ts +10 -12
- package/lib/build-server.js +5 -11
- package/lib/compile.js +11 -10
- package/lib/config.js +21 -14
- package/lib/dependencies.js +2 -1
- package/lib/errors.js +3 -2
- package/lib/generator/errors.js +1 -1
- package/lib/generator/runtime-generator.d.ts +15 -15
- package/lib/generator/runtime-generator.js +92 -63
- package/lib/logger.js +55 -0
- package/lib/management-api.js +29 -44
- package/lib/prom-server.js +5 -9
- package/lib/runtime.js +885 -0
- package/lib/schema.js +79 -76
- package/lib/start.js +35 -113
- package/lib/streams/message-port-writable.js +44 -0
- package/lib/streams/pino-writable.js +30 -0
- package/lib/upgrade.js +4 -3
- package/lib/utils.js +49 -1
- package/lib/versions/v1.36.0.js +1 -1
- package/lib/versions/v1.5.0.js +1 -1
- package/lib/versions/v2.0.0.js +17 -0
- package/lib/worker/app.js +224 -0
- package/lib/worker/default-stackable.js +27 -0
- package/lib/worker/itc.js +128 -0
- package/lib/worker/main.js +120 -0
- package/lib/worker/symbols.js +7 -0
- package/package.json +23 -25
- package/runtime.mjs +4 -4
- package/schema.json +824 -0
- package/lib/api-client.js +0 -500
- package/lib/api.js +0 -420
- package/lib/app.js +0 -397
- package/lib/load-config.js +0 -12
- package/lib/loader.mjs +0 -103
- package/lib/message-port-writable.js +0 -50
- package/lib/worker.js +0 -182
- /package/lib/{interceptors.js → worker/interceptors.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://platformatic.dev/
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
3
|
"entrypoint": "echo",
|
|
4
|
-
"
|
|
4
|
+
"watch": true,
|
|
5
5
|
"autoload": {
|
|
6
6
|
"path": "services",
|
|
7
7
|
"exclude": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://platformatic.dev/
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
3
|
"entrypoint": "echo",
|
|
4
|
-
"
|
|
4
|
+
"watch": true,
|
|
5
5
|
"autoload": {
|
|
6
6
|
"path": "services",
|
|
7
7
|
"exclude": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://platformatic.dev/
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
3
|
"entrypoint": "echo",
|
|
4
|
-
"
|
|
4
|
+
"watch": true,
|
|
5
5
|
"autoload": {
|
|
6
6
|
"path": "services",
|
|
7
7
|
"exclude": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { schema } = require('@platformatic/service')
|
|
3
|
+
const { schema, buildStackable } = require('@platformatic/service')
|
|
4
4
|
|
|
5
5
|
/** @type {import('fastify').FastifyPluginAsync<{}>} */
|
|
6
6
|
async function foo (app) {
|
|
@@ -57,5 +57,6 @@ foo.configManagerConfig = {
|
|
|
57
57
|
strict: false
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
foo.buildStackable = (options) => buildStackable(options, foo)
|
|
60
61
|
|
|
61
62
|
module.exports = foo
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const pino = require('pino')
|
|
4
|
+
|
|
5
|
+
module.exports = async function foo (app) {
|
|
6
|
+
app.log.info('This is an info')
|
|
7
|
+
app.log.warn('This is a warn')
|
|
8
|
+
app.log.warn('This is an error')
|
|
9
|
+
|
|
10
|
+
app.get('/', async () => {
|
|
11
|
+
console.log('This is a\n console.log')
|
|
12
|
+
console.error('This is a\n console.error')
|
|
13
|
+
|
|
14
|
+
console.log(JSON.stringify({ ts: '123', foo: 'bar' }))
|
|
15
|
+
console.log('#'.repeat(1e4))
|
|
16
|
+
console.log(Buffer.from(Array.from(Array(1e2)).map((_, i) => i)))
|
|
17
|
+
|
|
18
|
+
const logger = pino({ level: 'trace' })
|
|
19
|
+
logger.trace('This is a trace')
|
|
20
|
+
logger.fatal({ payload: { ts: '123', foo: 'bar' } }, 'This is a fatal with object')
|
|
21
|
+
|
|
22
|
+
return { ok: true }
|
|
23
|
+
})
|
|
24
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://platformatic.dev/
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
3
|
"entrypoint": "echo",
|
|
4
|
-
"
|
|
4
|
+
"watch": true,
|
|
5
5
|
"autoload": {
|
|
6
6
|
"path": "services",
|
|
7
7
|
"exclude": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://platformatic.dev/
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
3
|
"entrypoint": "composer",
|
|
4
|
-
"
|
|
4
|
+
"watch": true,
|
|
5
5
|
"autoload": {
|
|
6
6
|
"path": "services",
|
|
7
7
|
"exclude": [
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Entity } from '@platformatic/sql-mapper'
|
|
2
|
-
import graphqlPlugin from '@platformatic/sql-graphql'
|
|
1
|
+
import { Entity } from '@platformatic/sql-mapper'
|
|
3
2
|
import { EntityTypes, Movie } from './types'
|
|
4
3
|
|
|
5
4
|
declare module 'fastify' {
|
|
6
5
|
interface FastifyInstance {
|
|
7
6
|
getSchema<T extends 'Movie'>(schemaId: T): {
|
|
8
|
-
|
|
7
|
+
$id: string,
|
|
9
8
|
title: string,
|
|
10
9
|
description: string,
|
|
11
10
|
type: string,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Movie } from './Movie'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
interface EntityTypes {
|
|
4
|
+
Movie: Movie
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export { EntityTypes, Movie }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FastifyPluginAsync } from 'fastify'
|
|
2
2
|
|
|
3
3
|
interface GetMoviesRequest {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
limit?: number;
|
|
5
|
+
offset?: number;
|
|
6
|
+
totalCount?: boolean;
|
|
7
|
+
fields?: Array<string>;
|
|
8
8
|
'where.id.eq'?: number;
|
|
9
9
|
'where.id.neq'?: number;
|
|
10
10
|
'where.id.gt'?: number;
|
|
@@ -29,22 +29,22 @@ interface GetMoviesRequest {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
interface GetMoviesResponseOK {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
id?: number;
|
|
33
|
+
title: string;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
interface CreateMovieRequest {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
id?: number;
|
|
38
|
+
title: string;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
interface CreateMovieResponseOK {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
id?: number;
|
|
43
|
+
title: string;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
interface UpdateMoviesRequest {
|
|
47
|
-
|
|
47
|
+
fields?: Array<string>;
|
|
48
48
|
'where.id.eq'?: number;
|
|
49
49
|
'where.id.neq'?: number;
|
|
50
50
|
'where.id.gt'?: number;
|
|
@@ -64,44 +64,44 @@ interface UpdateMoviesRequest {
|
|
|
64
64
|
'where.title.in'?: string;
|
|
65
65
|
'where.title.nin'?: string;
|
|
66
66
|
'where.or'?: Array<string>;
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
id?: number;
|
|
68
|
+
title: string;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
interface UpdateMoviesResponseOK {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
id?: number;
|
|
73
|
+
title: string;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
interface GetMovieByIdRequest {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
fields?: Array<string>;
|
|
78
|
+
id: number;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
interface GetMovieByIdResponseOK {
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
id?: number;
|
|
83
|
+
title: string;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
interface UpdateMovieRequest {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
fields?: Array<string>;
|
|
88
|
+
id: number;
|
|
89
|
+
title: string;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
interface UpdateMovieResponseOK {
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
id?: number;
|
|
94
|
+
title: string;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
interface DeleteMoviesRequest {
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
fields?: Array<string>;
|
|
99
|
+
id: number;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
interface DeleteMoviesResponseOK {
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
id?: number;
|
|
104
|
+
title: string;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
interface Client {
|
|
@@ -117,15 +117,15 @@ type ClientPlugin = FastifyPluginAsync<NonNullable<client.ClientOptions>>
|
|
|
117
117
|
|
|
118
118
|
declare module 'fastify' {
|
|
119
119
|
interface ConfigureClient {
|
|
120
|
-
getHeaders(req: FastifyRequest, reply: FastifyReply): Promise<Record<string,string>>;
|
|
120
|
+
getHeaders(req: FastifyRequest, reply: FastifyReply): Promise<Record<string, string>>;
|
|
121
121
|
}
|
|
122
122
|
interface FastifyInstance {
|
|
123
|
-
|
|
123
|
+
client: Client;
|
|
124
124
|
configureClient(opts: ConfigureClient): unknown
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
interface FastifyRequest {
|
|
128
|
-
|
|
128
|
+
client: Client;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -133,9 +133,9 @@ declare namespace client {
|
|
|
133
133
|
export interface ClientOptions {
|
|
134
134
|
url: string
|
|
135
135
|
}
|
|
136
|
-
export const client: ClientPlugin
|
|
137
|
-
export { client as default }
|
|
136
|
+
export const client: ClientPlugin
|
|
137
|
+
export { client as default }
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
declare function client(...params: Parameters<ClientPlugin>): ReturnType<ClientPlugin
|
|
141
|
-
export = client
|
|
140
|
+
declare function client (...params: Parameters<ClientPlugin>): ReturnType<ClientPlugin>
|
|
141
|
+
export = client
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://platformatic.dev/
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
3
|
"entrypoint": "composer",
|
|
4
|
-
"
|
|
4
|
+
"watch": true,
|
|
5
5
|
"autoload": {
|
|
6
6
|
"path": "services",
|
|
7
7
|
"exclude": [
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Entity } from '@platformatic/sql-mapper'
|
|
2
|
-
import graphqlPlugin from '@platformatic/sql-graphql'
|
|
1
|
+
import { Entity } from '@platformatic/sql-mapper'
|
|
3
2
|
import { EntityTypes, Movie } from './types'
|
|
4
3
|
|
|
5
4
|
declare module 'fastify' {
|
|
6
5
|
interface FastifyInstance {
|
|
7
6
|
getSchema<T extends 'Movie'>(schemaId: T): {
|
|
8
|
-
|
|
7
|
+
$id: string,
|
|
9
8
|
title: string,
|
|
10
9
|
description: string,
|
|
11
10
|
type: string,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Movie } from './Movie'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
interface EntityTypes {
|
|
4
|
+
Movie: Movie
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export { EntityTypes, Movie }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FastifyPluginAsync } from 'fastify'
|
|
2
2
|
|
|
3
3
|
interface GetMoviesRequest {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
limit?: number;
|
|
5
|
+
offset?: number;
|
|
6
|
+
totalCount?: boolean;
|
|
7
|
+
fields?: Array<string>;
|
|
8
8
|
'where.id.eq'?: number;
|
|
9
9
|
'where.id.neq'?: number;
|
|
10
10
|
'where.id.gt'?: number;
|
|
@@ -29,22 +29,22 @@ interface GetMoviesRequest {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
interface GetMoviesResponseOK {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
id?: number;
|
|
33
|
+
title: string;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
interface CreateMovieRequest {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
id?: number;
|
|
38
|
+
title: string;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
interface CreateMovieResponseOK {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
id?: number;
|
|
43
|
+
title: string;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
interface UpdateMoviesRequest {
|
|
47
|
-
|
|
47
|
+
fields?: Array<string>;
|
|
48
48
|
'where.id.eq'?: number;
|
|
49
49
|
'where.id.neq'?: number;
|
|
50
50
|
'where.id.gt'?: number;
|
|
@@ -64,44 +64,44 @@ interface UpdateMoviesRequest {
|
|
|
64
64
|
'where.title.in'?: string;
|
|
65
65
|
'where.title.nin'?: string;
|
|
66
66
|
'where.or'?: Array<string>;
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
id?: number;
|
|
68
|
+
title: string;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
interface UpdateMoviesResponseOK {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
id?: number;
|
|
73
|
+
title: string;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
interface GetMovieByIdRequest {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
fields?: Array<string>;
|
|
78
|
+
id: number;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
interface GetMovieByIdResponseOK {
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
id?: number;
|
|
83
|
+
title: string;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
interface UpdateMovieRequest {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
fields?: Array<string>;
|
|
88
|
+
id: number;
|
|
89
|
+
title: string;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
interface UpdateMovieResponseOK {
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
id?: number;
|
|
94
|
+
title: string;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
interface DeleteMoviesRequest {
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
fields?: Array<string>;
|
|
99
|
+
id: number;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
interface DeleteMoviesResponseOK {
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
id?: number;
|
|
104
|
+
title: string;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
interface Client {
|
|
@@ -117,15 +117,15 @@ type ClientPlugin = FastifyPluginAsync<NonNullable<client.ClientOptions>>
|
|
|
117
117
|
|
|
118
118
|
declare module 'fastify' {
|
|
119
119
|
interface ConfigureClient {
|
|
120
|
-
getHeaders(req: FastifyRequest, reply: FastifyReply): Promise<Record<string,string>>;
|
|
120
|
+
getHeaders(req: FastifyRequest, reply: FastifyReply): Promise<Record<string, string>>;
|
|
121
121
|
}
|
|
122
122
|
interface FastifyInstance {
|
|
123
|
-
|
|
123
|
+
client: Client;
|
|
124
124
|
configureClient(opts: ConfigureClient): unknown
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
interface FastifyRequest {
|
|
128
|
-
|
|
128
|
+
client: Client;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -133,9 +133,9 @@ declare namespace client {
|
|
|
133
133
|
export interface ClientOptions {
|
|
134
134
|
url: string
|
|
135
135
|
}
|
|
136
|
-
export const client: ClientPlugin
|
|
137
|
-
export { client as default }
|
|
136
|
+
export const client: ClientPlugin
|
|
137
|
+
export { client as default }
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
declare function client(...params: Parameters<ClientPlugin>): ReturnType<ClientPlugin
|
|
141
|
-
export = client
|
|
140
|
+
declare function client (...params: Parameters<ClientPlugin>): ReturnType<ClientPlugin>
|
|
141
|
+
export = client
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://platformatic.dev/
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
|
|
3
3
|
"entrypoint": "composer",
|
|
4
|
-
"
|
|
4
|
+
"watch": true,
|
|
5
5
|
"autoload": {
|
|
6
6
|
"path": "services",
|
|
7
7
|
"exclude": [
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Entity } from '@platformatic/sql-mapper'
|
|
2
|
-
import graphqlPlugin from '@platformatic/sql-graphql'
|
|
1
|
+
import { Entity } from '@platformatic/sql-mapper'
|
|
3
2
|
import { EntityTypes, Movie } from './types'
|
|
4
3
|
|
|
5
4
|
declare module 'fastify' {
|
|
6
5
|
interface FastifyInstance {
|
|
7
6
|
getSchema<T extends 'Movie'>(schemaId: T): {
|
|
8
|
-
|
|
7
|
+
$id: string,
|
|
9
8
|
title: string,
|
|
10
9
|
description: string,
|
|
11
10
|
type: string,
|