@platformatic/service 0.46.1 → 0.47.0

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.
Files changed (125) hide show
  1. package/.c8rc +6 -0
  2. package/config.d.ts +0 -1
  3. package/index.d.ts +25 -0
  4. package/index.js +1 -0
  5. package/index.test-d.ts +24 -1
  6. package/lib/schema.js +0 -3
  7. package/package.json +9 -7
  8. package/fixtures/hello/no-server-logger.json +0 -13
  9. package/fixtures/hello/platformatic.service.json +0 -18
  10. package/fixtures/hello/plugin.js +0 -7
  11. package/fixtures/hello/warn-log.service.json +0 -18
  12. package/fixtures/hello-client/hello/hello.cjs +0 -21
  13. package/fixtures/hello-client/hello/hello.d.ts +0 -34
  14. package/fixtures/hello-client/hello/hello.openapi.json +0 -22
  15. package/fixtures/hello-client/hello/package.json +0 -5
  16. package/fixtures/hello-client/platformatic.service.json +0 -19
  17. package/fixtures/hello-client/plugin.js +0 -8
  18. package/fixtures/hello-client-ts/hello/hello.cjs +0 -21
  19. package/fixtures/hello-client-ts/hello/hello.d.ts +0 -34
  20. package/fixtures/hello-client-ts/hello/hello.openapi.json +0 -22
  21. package/fixtures/hello-client-ts/hello/package.json +0 -5
  22. package/fixtures/hello-client-ts/platformatic.service.json +0 -21
  23. package/fixtures/hello-client-ts/plugin.ts +0 -8
  24. package/fixtures/hello-client-ts/tsconfig.json +0 -23
  25. package/fixtures/hello-client-ts-without-deps/hello.d.ts +0 -34
  26. package/fixtures/hello-client-ts-without-deps/hello.openapi.json +0 -22
  27. package/fixtures/hello-client-ts-without-deps/platformatic.service.json +0 -23
  28. package/fixtures/hello-client-ts-without-deps/plugin.ts +0 -8
  29. package/fixtures/hello-client-ts-without-deps/tsconfig.json +0 -22
  30. package/fixtures/hello-client-without-deps/hello.d.ts +0 -34
  31. package/fixtures/hello-client-without-deps/hello.openapi.json +0 -22
  32. package/fixtures/hello-client-without-deps/platformatic.service.json +0 -21
  33. package/fixtures/hello-client-without-deps/plugin.js +0 -8
  34. package/fixtures/https/embedded-pem.json +0 -20
  35. package/fixtures/https/https.crt +0 -25
  36. package/fixtures/https/https.key +0 -27
  37. package/fixtures/https/pem-path.json +0 -20
  38. package/fixtures/https/plugin.js +0 -7
  39. package/fixtures/options/platformatic.service.yml +0 -9
  40. package/fixtures/options/plugin.js +0 -7
  41. package/test/autoload.test.js +0 -486
  42. package/test/cli/compile-1.test.mjs +0 -352
  43. package/test/cli/compile-2.test.mjs +0 -310
  44. package/test/cli/gen-schema.test.mjs +0 -44
  45. package/test/cli/gen-types.test.mjs +0 -30
  46. package/test/cli/helper.mjs +0 -67
  47. package/test/cli/start.test.mjs +0 -126
  48. package/test/cli/tap-parallel-not-ok +0 -0
  49. package/test/cli/validations.test.mjs +0 -33
  50. package/test/clients.test.js +0 -87
  51. package/test/config.test.js +0 -316
  52. package/test/cors.test.js +0 -291
  53. package/test/fixtures/bad-typescript-plugin/platformatic.service.json +0 -16
  54. package/test/fixtures/bad-typescript-plugin/plugin.ts +0 -5
  55. package/test/fixtures/bad-typescript-plugin/tsconfig.json +0 -22
  56. package/test/fixtures/custom-port-placeholder.json +0 -10
  57. package/test/fixtures/default-env-var-names.json +0 -7
  58. package/test/fixtures/directories/platformatic.service.json +0 -13
  59. package/test/fixtures/directories/plugins/decorator.js +0 -7
  60. package/test/fixtures/directories/routes/foo/bar.js +0 -11
  61. package/test/fixtures/directories/routes/foo/baz/index.js +0 -7
  62. package/test/fixtures/directories/routes/foo/baz/index2.js +0 -11
  63. package/test/fixtures/directories/routes/oof/auto.hooks.js +0 -5
  64. package/test/fixtures/directories/routes/oof/index.js +0 -7
  65. package/test/fixtures/directories/routes/root.js +0 -7
  66. package/test/fixtures/hello-ts-with-config/global.d.ts +0 -8
  67. package/test/fixtures/hello-ts-with-config/platformatic.service.json +0 -16
  68. package/test/fixtures/hello-ts-with-config/plugin.ts +0 -8
  69. package/test/fixtures/hello-ts-with-config/tsconfig.json +0 -23
  70. package/test/fixtures/hello-world-resolver.js +0 -16
  71. package/test/fixtures/missing-property.config.json +0 -1
  72. package/test/fixtures/nested-directories/modules/catalogue/index.js +0 -11
  73. package/test/fixtures/nested-directories/modules/catalogue/routes/products.js +0 -14
  74. package/test/fixtures/nested-directories/modules/inventory/index.js +0 -33
  75. package/test/fixtures/nested-directories/modules/inventory/routes/product.js +0 -15
  76. package/test/fixtures/nested-directories/package.json +0 -3
  77. package/test/fixtures/nested-directories/platformatic.service.json +0 -23
  78. package/test/fixtures/nested-directories/plugins/decorator.js +0 -3
  79. package/test/fixtures/nested-directories/plugins/handlers.js +0 -17
  80. package/test/fixtures/not-load.js +0 -8
  81. package/test/fixtures/not-load.service.json +0 -13
  82. package/test/fixtures/other-side.js +0 -9
  83. package/test/fixtures/request-id.js +0 -9
  84. package/test/fixtures/root-endpoint-plugin.js +0 -8
  85. package/test/fixtures/throw-resolver.js +0 -16
  86. package/test/fixtures/typescript-autoload/platformatic.service.json +0 -16
  87. package/test/fixtures/typescript-autoload/routes/plugin.ts +0 -5
  88. package/test/fixtures/typescript-autoload/tsconfig.json +0 -22
  89. package/test/fixtures/typescript-compiled/compiled/plugin.js +0 -6
  90. package/test/fixtures/typescript-compiled/platformatic.service.json +0 -18
  91. package/test/fixtures/typescript-plugin/platformatic.service.json +0 -16
  92. package/test/fixtures/typescript-plugin/plugin.ts +0 -5
  93. package/test/fixtures/typescript-plugin/tsconfig.json +0 -22
  94. package/test/fixtures/typescript-plugin-custom-flags/platformatic.service.json +0 -18
  95. package/test/fixtures/typescript-plugin-custom-flags/plugin.ts +0 -5
  96. package/test/fixtures/typescript-plugin-custom-flags/tsconfig.json +0 -22
  97. package/test/fixtures/typescript-plugin-custom-tsconfig/a-config-for-ts.json +0 -22
  98. package/test/fixtures/typescript-plugin-custom-tsconfig/platformatic.service.json +0 -18
  99. package/test/fixtures/typescript-plugin-custom-tsconfig/plugin.ts +0 -5
  100. package/test/fixtures/typescript-plugin-nocompile/platformatic.service.json +0 -16
  101. package/test/fixtures/typescript-plugin-nocompile/plugin.ts +0 -5
  102. package/test/fixtures/typescript-plugin-nocompile/tsconfig.json +0 -22
  103. package/test/fixtures/typescript-plugin-nocompile-enabled/platformatic.service.json +0 -18
  104. package/test/fixtures/typescript-plugin-nocompile-enabled/plugin.ts +0 -5
  105. package/test/fixtures/typescript-plugin-nocompile-enabled/tsconfig.json +0 -22
  106. package/test/fixtures/typescript-plugin-nocompile-string/platformatic.service.json +0 -16
  107. package/test/fixtures/typescript-plugin-nocompile-string/plugin.ts +0 -5
  108. package/test/fixtures/typescript-plugin-nocompile-string/tsconfig.json +0 -22
  109. package/test/fixtures/typescript-plugin-string/platformatic.service.json +0 -16
  110. package/test/fixtures/typescript-plugin-string/plugin.ts +0 -5
  111. package/test/fixtures/typescript-plugin-string/tsconfig.json +0 -22
  112. package/test/fixtures/undici-plugin.js +0 -15
  113. package/test/graphql.test.js +0 -219
  114. package/test/healthcheck.test.js +0 -92
  115. package/test/helper.js +0 -30
  116. package/test/https.test.js +0 -64
  117. package/test/lambda.test.js +0 -103
  118. package/test/load-and-reload-files.test.js +0 -180
  119. package/test/load-plugin.test.js +0 -67
  120. package/test/metrics.test.js +0 -220
  121. package/test/routes.test.js +0 -230
  122. package/test/schema.test.js +0 -12
  123. package/test/tap-parallel-ok +0 -0
  124. package/test/telemetry.test.js +0 -87
  125. package/test/utils.test.js +0 -37
package/.c8rc ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "exclude": [
3
+ "fixtures/*",
4
+ "test/*"
5
+ ]
6
+ }
package/config.d.ts CHANGED
@@ -193,7 +193,6 @@ export interface Plugins {
193
193
  [k: string]: unknown;
194
194
  }
195
195
  )[];
196
- stopTimeout?: number;
197
196
  typescript?:
198
197
  | {
199
198
  enabled?: boolean | string;
package/index.d.ts CHANGED
@@ -3,7 +3,9 @@
3
3
  /// <reference types="@fastify/swagger" />
4
4
  import { FastifyInstance } from 'fastify'
5
5
  import ConfigManager from '@platformatic/config'
6
+ import type { IConfigManagerOptions } from '@platformatic/config'
6
7
  import { PlatformaticService } from './config'
8
+ import type { JSONSchemaType } from 'ajv'
7
9
 
8
10
  export interface PlatformaticApp<T> {
9
11
  configManager: ConfigManager<T>
@@ -19,3 +21,26 @@ declare module 'fastify' {
19
21
  restart: () => Promise<void>
20
22
  }
21
23
  }
24
+
25
+ export interface ConfigManagerConfig<T> extends Omit<IConfigManagerOptions, 'source' | 'watch' | 'schema'> {
26
+ transformConfig: (this: ConfigManager<T>) => Promise<void>
27
+ schema: object
28
+ }
29
+
30
+ export interface Stackable<ConfigType> {
31
+ (app: FastifyInstance, opts: object): Promise<void>
32
+
33
+ configType: string
34
+ configManagerConfig: ConfigManagerConfig<ConfigType>
35
+ schema: object
36
+ }
37
+
38
+ interface SchemaExport {
39
+ schema: JSONSchemaType<PlatformaticServiceConfig>
40
+ }
41
+
42
+ export const schema: SchemaExport
43
+
44
+ export declare const platformaticService: Stackable<PlatformaticServiceConfig>
45
+
46
+ export default platformaticService
package/index.js CHANGED
@@ -54,6 +54,7 @@ async function platformaticService (app, opts, toLoad = []) {
54
54
  if (config.plugins) {
55
55
  let registerTsCompiler = false
56
56
  const typescript = config.plugins.typescript
57
+ /* c8 ignore next 6 */
57
58
  if (typescript === true) {
58
59
  registerTsCompiler = true
59
60
  } else if (typeof typescript === 'object') {
package/index.test-d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { expectType } from 'tsd'
2
2
  import { FastifyInstance } from 'fastify'
3
- import { buildServer, PlatformaticApp } from '.'
3
+ import { buildServer, PlatformaticApp, platformaticService, Stackable, PlatformaticServiceConfig } from '.'
4
4
  import ConfigManager from '@platformatic/config'
5
5
  import { OpenAPI } from 'openapi-types'
6
6
  import type { MercuriusPlugin } from 'mercurius'
@@ -22,3 +22,26 @@ expectType<PlatformaticService>(server.platformatic.config)
22
22
  expectType<OpenAPI.Document>(server.swagger())
23
23
  expectType<MercuriusPlugin>(server.graphql)
24
24
  expectType<Promise<void>>(server.restart())
25
+
26
+ function buildStackable (): Stackable<PlatformaticServiceConfig> {
27
+ async function myApp (app: FastifyInstance, opts: object): Promise<void> {
28
+ await platformaticService(app, opts)
29
+ }
30
+
31
+ myApp.schema = platformaticService.configManagerConfig.schema
32
+ myApp.configType = 'myApp'
33
+ myApp.configManagerConfig = {
34
+ ...platformaticService.configManagerConfig,
35
+ async transformConfig (this: ConfigManager<PlatformaticServiceConfig>) {
36
+ this.current.plugins = {
37
+ paths: [{
38
+ path: 'my-plugin'
39
+ }]
40
+ }
41
+ }
42
+ }
43
+
44
+ return myApp
45
+ }
46
+
47
+ expectType<Stackable<PlatformaticServiceConfig>>(buildStackable())
package/lib/schema.js CHANGED
@@ -429,9 +429,6 @@ const plugins = {
429
429
  }]
430
430
  }
431
431
  },
432
- stopTimeout: {
433
- type: 'integer'
434
- },
435
432
  typescript: {
436
433
  anyOf: [{
437
434
  type: 'object',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/service",
3
- "version": "0.46.1",
3
+ "version": "0.47.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -48,6 +48,8 @@
48
48
  "@fastify/swagger-ui": "^1.9.0",
49
49
  "@fastify/under-pressure": "^8.2.0",
50
50
  "@mercuriusjs/federation": "^2.0.0",
51
+ "@types/ws": "^8.5.5",
52
+ "ajv": "^8.12.0",
51
53
  "close-with-grace": "^1.2.0",
52
54
  "commist": "^3.2.0",
53
55
  "desm": "^1.3.0",
@@ -56,7 +58,7 @@
56
58
  "execa": "^8.0.0",
57
59
  "fastify": "^4.18.0",
58
60
  "fastify-metrics": "^10.3.0",
59
- "fastify-plugin": "^4.5.0",
61
+ "fastify-plugin": "^4.5.1",
60
62
  "graphql": "^16.6.0",
61
63
  "help-me": "^4.2.0",
62
64
  "mercurius": "^13.0.0",
@@ -65,11 +67,11 @@
65
67
  "pino-pretty": "^10.0.0",
66
68
  "rfdc": "^1.3.0",
67
69
  "ua-parser-js": "^1.0.35",
68
- "@platformatic/client": "0.46.1",
69
- "@platformatic/config": "0.46.1",
70
- "@platformatic/swagger-ui-theme": "0.46.1",
71
- "@platformatic/utils": "0.46.1",
72
- "@platformatic/telemetry": "0.46.1"
70
+ "@platformatic/client": "0.47.0",
71
+ "@platformatic/config": "0.47.0",
72
+ "@platformatic/swagger-ui-theme": "0.47.0",
73
+ "@platformatic/telemetry": "0.47.0",
74
+ "@platformatic/utils": "0.47.0"
73
75
  },
74
76
  "standard": {
75
77
  "ignore": [
@@ -1,13 +0,0 @@
1
- {
2
- "server": {
3
- "hostname": "127.0.0.1",
4
- "port": 0,
5
- "logger": {
6
- "level": "info"
7
- }
8
- },
9
- "plugins": {
10
- "paths": ["./plugin.js"]
11
- },
12
- "metrics": false
13
- }
@@ -1,18 +0,0 @@
1
- {
2
- "server": {
3
- "hostname": "127.0.0.1",
4
- "port": 0,
5
- "logger": {
6
- "level": "info",
7
- "name": "hello server"
8
- }
9
- },
10
- "plugins": {
11
- "paths": ["./plugin.js"]
12
- },
13
- "service": {
14
- "openapi": true
15
- },
16
- "metrics": false,
17
- "watch": false
18
- }
@@ -1,7 +0,0 @@
1
- 'use default'
2
-
3
- module.exports = async function (app) {
4
- app.get('/', async () => {
5
- return { hello: 'world' }
6
- })
7
- }
@@ -1,18 +0,0 @@
1
- {
2
- "server": {
3
- "hostname": "127.0.0.1",
4
- "port": 0,
5
- "logger": {
6
- "level": "warn",
7
- "name": "hello server"
8
- }
9
- },
10
- "plugins": {
11
- "paths": ["./plugin.js"]
12
- },
13
- "service": {
14
- "openapi": true
15
- },
16
- "metrics": false,
17
- "watch": false
18
- }
@@ -1,21 +0,0 @@
1
- 'use strict'
2
-
3
- const pltClient = require('@platformatic/client')
4
- const { join } = require('path')
5
-
6
- async function generateHelloClientPlugin (app, opts) {
7
- app.register(pltClient, {
8
- type: 'openapi',
9
- name: 'hello',
10
- path: join(__dirname, 'hello.openapi.json'),
11
- url: opts.url
12
- })
13
- }
14
-
15
- generateHelloClientPlugin[Symbol.for('plugin-meta')] = {
16
- name: 'hello OpenAPI Client'
17
- }
18
- generateHelloClientPlugin[Symbol.for('skip-override')] = true
19
-
20
- module.exports = generateHelloClientPlugin
21
- module.exports.default = generateHelloClientPlugin
@@ -1,34 +0,0 @@
1
- import { FastifyPluginAsync } from 'fastify'
2
-
3
- interface GetRequest {
4
- }
5
-
6
- interface GetResponse {
7
- }
8
-
9
- interface Hello {
10
- get(req: GetRequest): Promise<GetResponse>;
11
- }
12
-
13
- type HelloPlugin = FastifyPluginAsync<NonNullable<hello.HelloOptions>>
14
-
15
- declare module 'fastify' {
16
- interface FastifyInstance {
17
- 'hello': Hello;
18
- }
19
-
20
- interface FastifyRequest {
21
- 'hello': Hello;
22
- }
23
- }
24
-
25
- declare namespace hello {
26
- export interface HelloOptions {
27
- url: string
28
- }
29
- export const hello: HelloPlugin;
30
- export { hello as default };
31
- }
32
-
33
- declare function hello(...params: Parameters<HelloPlugin>): ReturnType<HelloPlugin>;
34
- export = hello;
@@ -1,22 +0,0 @@
1
- {
2
- "openapi": "3.0.3",
3
- "info": {
4
- "title": "Platformatic",
5
- "description": "This is a service built on top of Platformatic",
6
- "version": "1.0.0"
7
- },
8
- "components": {
9
- "schemas": {}
10
- },
11
- "paths": {
12
- "/": {
13
- "get": {
14
- "responses": {
15
- "200": {
16
- "description": "Default Response"
17
- }
18
- }
19
- }
20
- }
21
- }
22
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "hello",
3
- "main": "./hello.cjs",
4
- "types": "./hello.d.ts"
5
- }
@@ -1,19 +0,0 @@
1
- {
2
- "server": {
3
- "hostname": "127.0.0.1",
4
- "port": 0,
5
- "logger": {
6
- "level": "warn",
7
- "name": "hello client"
8
- }
9
- },
10
- "plugins": {
11
- "paths": ["./plugin.js"]
12
- },
13
- "clients": [{
14
- "path": "hello",
15
- "url": "{PLT_CLIENT_URL}"
16
- }],
17
- "metrics": false,
18
- "watch": false
19
- }
@@ -1,8 +0,0 @@
1
- 'use default'
2
-
3
- /** @type {import('fastify').FastifyPluginAsync<{ optionA: boolean, optionB: string }>} */
4
- module.exports = async function (app) {
5
- app.get('/', async () => {
6
- return app.hello.get()
7
- })
8
- }
@@ -1,21 +0,0 @@
1
- 'use strict'
2
-
3
- const pltClient = require('@platformatic/client')
4
- const { join } = require('path')
5
-
6
- async function generateHelloClientPlugin (app, opts) {
7
- app.register(pltClient, {
8
- type: 'openapi',
9
- name: 'hello',
10
- path: join(__dirname, 'hello.openapi.json'),
11
- url: opts.url
12
- })
13
- }
14
-
15
- generateHelloClientPlugin[Symbol.for('plugin-meta')] = {
16
- name: 'hello OpenAPI Client'
17
- }
18
- generateHelloClientPlugin[Symbol.for('skip-override')] = true
19
-
20
- module.exports = generateHelloClientPlugin
21
- module.exports.default = generateHelloClientPlugin
@@ -1,34 +0,0 @@
1
- import { FastifyPluginAsync } from 'fastify'
2
-
3
- interface GetRequest {
4
- }
5
-
6
- interface GetResponse {
7
- }
8
-
9
- interface Hello {
10
- get(req: GetRequest): Promise<GetResponse>;
11
- }
12
-
13
- type HelloPlugin = FastifyPluginAsync<NonNullable<hello.HelloOptions>>
14
-
15
- declare module 'fastify' {
16
- interface FastifyInstance {
17
- 'hello': Hello;
18
- }
19
-
20
- interface FastifyRequest {
21
- 'hello': Hello;
22
- }
23
- }
24
-
25
- declare namespace hello {
26
- export interface HelloOptions {
27
- url: string
28
- }
29
- export const hello: HelloPlugin;
30
- export { hello as default };
31
- }
32
-
33
- declare function hello(...params: Parameters<HelloPlugin>): ReturnType<HelloPlugin>;
34
- export = hello;
@@ -1,22 +0,0 @@
1
- {
2
- "openapi": "3.0.3",
3
- "info": {
4
- "title": "Platformatic",
5
- "description": "This is a service built on top of Platformatic",
6
- "version": "1.0.0"
7
- },
8
- "components": {
9
- "schemas": {}
10
- },
11
- "paths": {
12
- "/": {
13
- "get": {
14
- "responses": {
15
- "200": {
16
- "description": "Default Response"
17
- }
18
- }
19
- }
20
- }
21
- }
22
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "hello",
3
- "main": "./hello.cjs",
4
- "types": "./hello.d.ts"
5
- }
@@ -1,21 +0,0 @@
1
- {
2
- "server": {
3
- "hostname": "127.0.0.1",
4
- "port": 0,
5
- "logger": {
6
- "level": "warn",
7
- "name": "hello client ts"
8
- },
9
- "pluginTimeout": 30000
10
- },
11
- "plugins": {
12
- "paths": ["./plugin.ts"],
13
- "typescript": true
14
- },
15
- "clients": [{
16
- "path": "hello",
17
- "url": "{PLT_CLIENT_URL}"
18
- }],
19
- "metrics": false,
20
- "watch": false
21
- }
@@ -1,8 +0,0 @@
1
- import { FastifyInstance } from 'fastify'
2
- /// <reference path="./hello" />
3
-
4
- export default async function (app: FastifyInstance) {
5
- app.get('/', async () => {
6
- return app.hello.get({})
7
- })
8
- }
@@ -1,23 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "esModuleInterop": true,
5
- "target": "es2020",
6
- "moduleResolution": "node",
7
- "sourceMap": false,
8
- "incremental": true,
9
- "pretty": true,
10
- "noEmitOnError": true,
11
- "outDir": "dist"
12
- },
13
- "watchOptions": {
14
- "watchFile": "fixedPollingInterval",
15
- "watchDirectory": "fixedPollingInterval",
16
- "fallbackPolling": "dynamicPriority",
17
- "synchronousWatchDirectory": true,
18
- "excludeDirectories": [
19
- "**/node_modules",
20
- "dist"
21
- ]
22
- }
23
- }
@@ -1,34 +0,0 @@
1
- import { FastifyPluginAsync } from 'fastify'
2
-
3
- interface GetRequest {
4
- }
5
-
6
- interface GetResponse {
7
- }
8
-
9
- interface Hello {
10
- get(req: GetRequest): Promise<GetResponse>;
11
- }
12
-
13
- type HelloPlugin = FastifyPluginAsync<NonNullable<hello.HelloOptions>>
14
-
15
- declare module 'fastify' {
16
- interface FastifyInstance {
17
- 'hello': Hello;
18
- }
19
-
20
- interface FastifyRequest {
21
- 'hello': Hello;
22
- }
23
- }
24
-
25
- declare namespace hello {
26
- export interface HelloOptions {
27
- url: string
28
- }
29
- export const hello: HelloPlugin;
30
- export { hello as default };
31
- }
32
-
33
- declare function hello(...params: Parameters<HelloPlugin>): ReturnType<HelloPlugin>;
34
- export = hello;
@@ -1,22 +0,0 @@
1
- {
2
- "openapi": "3.0.3",
3
- "info": {
4
- "title": "Platformatic",
5
- "description": "This is a service built on top of Platformatic",
6
- "version": "1.0.0"
7
- },
8
- "components": {
9
- "schemas": {}
10
- },
11
- "paths": {
12
- "/": {
13
- "get": {
14
- "responses": {
15
- "200": {
16
- "description": "Default Response"
17
- }
18
- }
19
- }
20
- }
21
- }
22
- }
@@ -1,23 +0,0 @@
1
- {
2
- "server": {
3
- "hostname": "127.0.0.1",
4
- "port": 0,
5
- "logger": {
6
- "level": "warn",
7
- "name": "hello client ts"
8
- },
9
- "pluginTimeout": 30000
10
- },
11
- "plugins": {
12
- "paths": ["./plugin.ts"],
13
- "typescript": true
14
- },
15
- "clients": [{
16
- "schema": "./hello.openapi.json",
17
- "name": "hello",
18
- "type": "openapi",
19
- "url": "{PLT_CLIENT_URL}"
20
- }],
21
- "metrics": false,
22
- "watch": false
23
- }
@@ -1,8 +0,0 @@
1
- import { FastifyInstance } from 'fastify'
2
- /// <reference path="./hello" />
3
-
4
- export default async function (app: FastifyInstance) {
5
- app.get('/', async () => {
6
- return app.hello.get({})
7
- })
8
- }
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "esModuleInterop": true,
5
- "target": "es6",
6
- "moduleResolution": "node",
7
- "sourceMap": true,
8
- "pretty": true,
9
- "noEmitOnError": true,
10
- "outDir": "dist"
11
- },
12
- "watchOptions": {
13
- "watchFile": "fixedPollingInterval",
14
- "watchDirectory": "fixedPollingInterval",
15
- "fallbackPolling": "dynamicPriority",
16
- "synchronousWatchDirectory": true,
17
- "excludeDirectories": [
18
- "**/node_modules",
19
- "dist"
20
- ]
21
- }
22
- }
@@ -1,34 +0,0 @@
1
- import { FastifyPluginAsync } from 'fastify'
2
-
3
- interface GetRequest {
4
- }
5
-
6
- interface GetResponse {
7
- }
8
-
9
- interface Hello {
10
- get(req: GetRequest): Promise<GetResponse>;
11
- }
12
-
13
- type HelloPlugin = FastifyPluginAsync<NonNullable<hello.HelloOptions>>
14
-
15
- declare module 'fastify' {
16
- interface FastifyInstance {
17
- 'hello': Hello;
18
- }
19
-
20
- interface FastifyRequest {
21
- 'hello': Hello;
22
- }
23
- }
24
-
25
- declare namespace hello {
26
- export interface HelloOptions {
27
- url: string
28
- }
29
- export const hello: HelloPlugin;
30
- export { hello as default };
31
- }
32
-
33
- declare function hello(...params: Parameters<HelloPlugin>): ReturnType<HelloPlugin>;
34
- export = hello;
@@ -1,22 +0,0 @@
1
- {
2
- "openapi": "3.0.3",
3
- "info": {
4
- "title": "Platformatic",
5
- "description": "This is a service built on top of Platformatic",
6
- "version": "1.0.0"
7
- },
8
- "components": {
9
- "schemas": {}
10
- },
11
- "paths": {
12
- "/": {
13
- "get": {
14
- "responses": {
15
- "200": {
16
- "description": "Default Response"
17
- }
18
- }
19
- }
20
- }
21
- }
22
- }
@@ -1,21 +0,0 @@
1
- {
2
- "server": {
3
- "hostname": "127.0.0.1",
4
- "port": 0,
5
- "logger": {
6
- "level": "warn",
7
- "name": "hello client"
8
- }
9
- },
10
- "plugins": {
11
- "paths": ["./plugin.js"]
12
- },
13
- "clients": [{
14
- "schema": "./hello.openapi.json",
15
- "name": "hello",
16
- "type": "openapi",
17
- "url": "{PLT_CLIENT_URL}"
18
- }],
19
- "metrics": false,
20
- "watch": false
21
- }