@platformatic/service 2.2.0 → 2.2.2-alpha.1

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 CHANGED
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  export interface PlatformaticService {
9
+ basePath?: string;
9
10
  server?: {
10
11
  hostname?: string;
11
12
  port?: number | string;
package/lib/schema.js CHANGED
@@ -334,6 +334,9 @@ const platformaticServiceSchema = {
334
334
  title: 'Platformatic Service',
335
335
  type: 'object',
336
336
  properties: {
337
+ basePath: {
338
+ type: 'string'
339
+ },
337
340
  server,
338
341
  plugins,
339
342
  metrics,
package/lib/stackable.js CHANGED
@@ -28,6 +28,13 @@ class ServiceStackable {
28
28
  })
29
29
 
30
30
  this.#updateConfig()
31
+
32
+ // Setup globals
33
+ this.registerGlobals({
34
+ setOpenapiSchema: this.setOpenapiSchema.bind(this),
35
+ setGraphqlSchema: this.setGraphqlSchema.bind(this),
36
+ setBasePath: this.setBasePath.bind(this)
37
+ })
31
38
  }
32
39
 
33
40
  async init () {
@@ -104,6 +111,18 @@ class ServiceStackable {
104
111
  return this.configManager.env
105
112
  }
106
113
 
114
+ getMeta () {
115
+ const config = this.configManager.current
116
+
117
+ return {
118
+ composer: {
119
+ prefix: config.basePath ?? this.basePath ?? this.context?.serviceId,
120
+ wantsAbsoluteUrls: false,
121
+ needsRootRedirect: false
122
+ }
123
+ }
124
+ }
125
+
107
126
  async getWatchConfig () {
108
127
  const config = this.configManager.current
109
128
 
@@ -166,6 +185,22 @@ class ServiceStackable {
166
185
  this.#updateConfig()
167
186
  }
168
187
 
188
+ setOpenapiSchema (schema) {
189
+ this.openapiSchema = schema
190
+ }
191
+
192
+ setGraphqlSchema (schema) {
193
+ this.graphqlSchema = schema
194
+ }
195
+
196
+ setBasePath (basePath) {
197
+ this.basePath = basePath
198
+ }
199
+
200
+ registerGlobals (globals) {
201
+ globalThis.platformatic = Object.assign(globalThis.platformatic ?? {}, globals)
202
+ }
203
+
169
204
  #setHttpMetrics () {
170
205
  this.app.register(httpMetrics, {
171
206
  registry: this.metricsRegistry,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/service",
3
- "version": "2.2.0",
3
+ "version": "2.2.2-alpha.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -76,13 +76,13 @@
76
76
  "rfdc": "^1.3.1",
77
77
  "semgrator": "^0.3.0",
78
78
  "undici": "^6.9.0",
79
- "@platformatic/client": "2.2.0",
80
- "@platformatic/config": "2.2.0",
81
- "@platformatic/scalar-theme": "2.2.0",
82
- "@platformatic/telemetry": "2.2.0",
83
- "@platformatic/generators": "2.2.0",
84
- "@platformatic/ts-compiler": "2.2.0",
85
- "@platformatic/utils": "2.2.0"
79
+ "@platformatic/client": "2.2.2-alpha.1",
80
+ "@platformatic/config": "2.2.2-alpha.1",
81
+ "@platformatic/generators": "2.2.2-alpha.1",
82
+ "@platformatic/telemetry": "2.2.2-alpha.1",
83
+ "@platformatic/utils": "2.2.2-alpha.1",
84
+ "@platformatic/ts-compiler": "2.2.2-alpha.1",
85
+ "@platformatic/scalar-theme": "2.2.2-alpha.1"
86
86
  },
87
87
  "scripts": {
88
88
  "test": "pnpm run lint && borp -T --concurrency=1 --timeout=180000 && tsd",
package/schema.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/service/2.2.0.json",
3
- "version": "2.2.0",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/service/2.2.2-alpha.1.json",
3
+ "version": "2.2.2-alpha.1",
4
4
  "title": "Platformatic Service",
5
5
  "type": "object",
6
6
  "properties": {
7
+ "basePath": {
8
+ "type": "string"
9
+ },
7
10
  "server": {
8
11
  "type": "object",
9
12
  "properties": {