@platformatic/runtime 0.34.0 → 0.35.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.
@@ -0,0 +1,204 @@
1
+ {
2
+ "openapi": "3.0.3",
3
+ "info": {
4
+ "version": "8.3.1",
5
+ "title": "@fastify/swagger"
6
+ },
7
+ "components": {
8
+ "schemas": {}
9
+ },
10
+ "paths": {
11
+ "/posts": {
12
+ "get": {
13
+ "responses": {
14
+ "200": {
15
+ "description": "Default Response",
16
+ "content": {
17
+ "application/json": {
18
+ "schema": {
19
+ "type": "array",
20
+ "items": {
21
+ "type": "object",
22
+ "properties": {
23
+ "id": {
24
+ "type": "number"
25
+ },
26
+ "name": {
27
+ "type": "string"
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+ },
37
+ "post": {
38
+ "requestBody": {
39
+ "content": {
40
+ "application/json": {
41
+ "schema": {
42
+ "type": "object",
43
+ "properties": {
44
+ "name": {
45
+ "type": "string"
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ },
52
+ "responses": {
53
+ "200": {
54
+ "description": "Default Response",
55
+ "content": {
56
+ "application/json": {
57
+ "schema": {
58
+ "type": "object",
59
+ "properties": {
60
+ "id": {
61
+ "type": "number"
62
+ },
63
+ "name": {
64
+ "type": "string"
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ },
73
+ "put": {
74
+ "requestBody": {
75
+ "content": {
76
+ "application/json": {
77
+ "schema": {
78
+ "type": "object",
79
+ "properties": {
80
+ "id": {
81
+ "type": "number"
82
+ },
83
+ "name": {
84
+ "type": "string"
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ },
91
+ "responses": {
92
+ "200": {
93
+ "description": "Default Response",
94
+ "content": {
95
+ "application/json": {
96
+ "schema": {
97
+ "type": "object",
98
+ "properties": {
99
+ "id": {
100
+ "type": "number"
101
+ },
102
+ "name": {
103
+ "type": "string"
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ },
113
+ "/posts/{id}": {
114
+ "get": {
115
+ "responses": {
116
+ "200": {
117
+ "description": "Default Response",
118
+ "content": {
119
+ "application/json": {
120
+ "schema": {
121
+ "type": "object",
122
+ "properties": {
123
+ "id": {
124
+ "type": "number"
125
+ },
126
+ "name": {
127
+ "type": "string"
128
+ }
129
+ }
130
+ }
131
+ }
132
+ }
133
+ }
134
+ }
135
+ },
136
+ "post": {
137
+ "responses": {
138
+ "200": {
139
+ "description": "Default Response",
140
+ "content": {
141
+ "application/json": {
142
+ "schema": {
143
+ "type": "object",
144
+ "properties": {
145
+ "id": {
146
+ "type": "number"
147
+ },
148
+ "name": {
149
+ "type": "string"
150
+ }
151
+ }
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }
157
+ },
158
+ "put": {
159
+ "responses": {
160
+ "200": {
161
+ "description": "Default Response",
162
+ "content": {
163
+ "application/json": {
164
+ "schema": {
165
+ "type": "object",
166
+ "properties": {
167
+ "id": {
168
+ "type": "number"
169
+ },
170
+ "name": {
171
+ "type": "string"
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+ },
180
+ "delete": {
181
+ "responses": {
182
+ "200": {
183
+ "description": "Default Response",
184
+ "content": {
185
+ "application/json": {
186
+ "schema": {
187
+ "type": "object",
188
+ "properties": {
189
+ "id": {
190
+ "type": "number"
191
+ },
192
+ "name": {
193
+ "type": "string"
194
+ }
195
+ }
196
+ }
197
+ }
198
+ }
199
+ }
200
+ }
201
+ }
202
+ }
203
+ }
204
+ }
@@ -31,6 +31,14 @@
31
31
  "url": "/documentation/json",
32
32
  "prefix": "/service-app"
33
33
  }
34
+ },
35
+ {
36
+ "id": "external-service",
37
+ "origin": "https://external-service.com",
38
+ "openapi": {
39
+ "file": "./external-service.json",
40
+ "prefix": "/external-service"
41
+ }
34
42
  }
35
43
  ],
36
44
  "refreshTimeout": 5000
package/lib/config.js CHANGED
@@ -95,31 +95,38 @@ async function parseClientsAndComposer (configManager) {
95
95
  const clientName = dep.id ?? ''
96
96
  const dependency = configManager.current.serviceMap.get(clientName)
97
97
 
98
- if (dependency === undefined) {
99
- throw new Error(missingDependencyErrorMessage(clientName, service, configManager))
100
- }
101
-
102
- dependency.dependents.push(service.id)
98
+ let isLocal = true
99
+ let clientUrl = null
103
100
 
104
- if (dep.origin) {
101
+ if (dep.origin !== undefined) {
105
102
  try {
106
- await cm.replaceEnv(dep.origin)
103
+ clientUrl = await cm.replaceEnv(dep.origin)
104
+ isLocal = false
107
105
  /* c8 ignore next 4 */
108
106
  } catch (err) {
109
107
  if (err.name !== 'MissingValueError') {
110
108
  throw err
111
109
  }
112
110
 
113
- if (dep.origin === `{${err.key}}`) {
114
- service.localServiceEnvVars.set(err.key, `http://${clientName}.plt.local`)
111
+ if (dependency !== undefined && dep.origin === `{${err.key}}`) {
112
+ clientUrl = `http://${clientName}.plt.local`
113
+ service.localServiceEnvVars.set(err.key, clientUrl)
115
114
  }
116
115
  }
117
116
  }
118
117
 
118
+ if (isLocal) {
119
+ if (dependency === undefined) {
120
+ throw new Error(missingDependencyErrorMessage(clientName, service, configManager))
121
+ }
122
+ clientUrl = `http://${clientName}.plt.local`
123
+ dependency.dependents.push(service.id)
124
+ }
125
+
119
126
  service.dependencies.push({
120
127
  id: clientName,
121
- url: `http://${clientName}.plt.local`,
122
- local: true
128
+ url: clientUrl,
129
+ local: isLocal
123
130
  })
124
131
  }
125
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/runtime",
3
- "version": "0.34.0",
3
+ "version": "0.35.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -24,8 +24,8 @@
24
24
  "standard": "^17.1.0",
25
25
  "tsd": "^0.28.1",
26
26
  "typescript": "^5.1.6",
27
- "@platformatic/sql-graphql": "0.34.0",
28
- "@platformatic/sql-mapper": "0.34.0"
27
+ "@platformatic/sql-graphql": "0.35.0",
28
+ "@platformatic/sql-mapper": "0.35.0"
29
29
  },
30
30
  "dependencies": {
31
31
  "@hapi/topo": "^6.0.2",
@@ -42,12 +42,12 @@
42
42
  "pino": "^8.14.1",
43
43
  "pino-pretty": "^10.0.0",
44
44
  "undici": "^5.22.1",
45
- "@platformatic/composer": "0.34.0",
46
- "@platformatic/config": "0.34.0",
47
- "@platformatic/db": "0.34.0",
48
- "@platformatic/service": "0.34.0",
49
- "@platformatic/telemetry": "0.34.0",
50
- "@platformatic/utils": "0.34.0"
45
+ "@platformatic/composer": "0.35.0",
46
+ "@platformatic/config": "0.35.0",
47
+ "@platformatic/db": "0.35.0",
48
+ "@platformatic/service": "0.35.0",
49
+ "@platformatic/utils": "0.35.0",
50
+ "@platformatic/telemetry": "0.35.0"
51
51
  },
52
52
  "standard": {
53
53
  "ignore": [