@platformatic/runtime 2.0.0 → 2.0.2

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 (250) hide show
  1. package/config.d.ts +1 -1
  2. package/package.json +13 -13
  3. package/schema.json +1 -1
  4. package/fixtures/botched-start/platformatic.runtime.json +0 -14
  5. package/fixtures/botched-start/services/a/platformatic.service.json +0 -14
  6. package/fixtures/botched-start/services/a/plugin.js +0 -11
  7. package/fixtures/composerApp/api1.json +0 -65
  8. package/fixtures/composerApp/platformatic.composer.json +0 -23
  9. package/fixtures/configs/invalid-entrypoint.json +0 -14
  10. package/fixtures/configs/invalid-schema-type.config.json +0 -19
  11. package/fixtures/configs/invalid-web-with-services.json +0 -36
  12. package/fixtures/configs/missing-property.config.json +0 -13
  13. package/fixtures/configs/missing-service-config.json +0 -7
  14. package/fixtures/configs/monorepo-composer-no-autoload.json +0 -32
  15. package/fixtures/configs/monorepo-composer.json +0 -19
  16. package/fixtures/configs/monorepo-create-cycle.json +0 -20
  17. package/fixtures/configs/monorepo-missing-dependencies.json +0 -9
  18. package/fixtures/configs/monorepo-no-cycles.json +0 -19
  19. package/fixtures/configs/monorepo-openapi.json +0 -12
  20. package/fixtures/configs/monorepo-watch-env.json +0 -19
  21. package/fixtures/configs/monorepo-watch-single.json +0 -12
  22. package/fixtures/configs/monorepo-watch.json +0 -27
  23. package/fixtures/configs/monorepo-with-dependencies.json +0 -8
  24. package/fixtures/configs/monorepo-with-management-api-without-metrics.json +0 -21
  25. package/fixtures/configs/monorepo-with-management-api.json +0 -20
  26. package/fixtures/configs/monorepo-with-metrics.json +0 -32
  27. package/fixtures/configs/monorepo.json +0 -27
  28. package/fixtures/configs/no-schema.config.json +0 -18
  29. package/fixtures/configs/no-services.config.json +0 -5
  30. package/fixtures/configs/no-sources.config.json +0 -4
  31. package/fixtures/configs/service-throws-on-start.json +0 -11
  32. package/fixtures/configs/service-with-env-port.json +0 -32
  33. package/fixtures/configs/service-with-stdio.json +0 -12
  34. package/fixtures/configs/watch.json +0 -19
  35. package/fixtures/crash-on-bootstrap/platformatic.runtime.json +0 -15
  36. package/fixtures/crash-on-bootstrap/services/service-1/platformatic.service.json +0 -14
  37. package/fixtures/crash-on-bootstrap/services/service-1/plugin.js +0 -5
  38. package/fixtures/crash-on-bootstrap/services/service-2/platformatic.service.json +0 -14
  39. package/fixtures/crash-on-bootstrap/services/service-2/plugin.js +0 -5
  40. package/fixtures/dbApp/package.json +0 -5
  41. package/fixtures/dbApp/platformatic.db.json +0 -28
  42. package/fixtures/dbApp/plugin.js +0 -12
  43. package/fixtures/dbAppNoName/package.json +0 -4
  44. package/fixtures/dbAppNoName/platformatic.db.json +0 -27
  45. package/fixtures/dbAppNoName/plugin.js +0 -12
  46. package/fixtures/dbAppNoPackageJson/platformatic.db.json +0 -27
  47. package/fixtures/dbAppNoPackageJson/plugin.js +0 -12
  48. package/fixtures/dbAppWithMigrationError/migrations/001.do.sql +0 -4
  49. package/fixtures/dbAppWithMigrationError/migrations/001.undo.sql +0 -1
  50. package/fixtures/dbAppWithMigrationError/package.json +0 -5
  51. package/fixtures/dbAppWithMigrationError/platformatic.db.json +0 -28
  52. package/fixtures/dbAppWithMigrationError/plugin.js +0 -5
  53. package/fixtures/do-not-reload-dependencies/node_modules/foo/foo.js +0 -2
  54. package/fixtures/do-not-reload-dependencies/node_modules/foo/package.json +0 -3
  55. package/fixtures/do-not-reload-dependencies/node_modules/foom/foom.js +0 -1
  56. package/fixtures/do-not-reload-dependencies/node_modules/foom/package.json +0 -4
  57. package/fixtures/do-not-reload-dependencies/platformatic.service.json +0 -18
  58. package/fixtures/do-not-reload-dependencies/plugin.js +0 -14
  59. package/fixtures/do-not-restart-on-crash/platformatic.runtime.json +0 -15
  60. package/fixtures/do-not-restart-on-crash/services/a/platformatic.service.json +0 -16
  61. package/fixtures/do-not-restart-on-crash/services/a/plugin.js +0 -9
  62. package/fixtures/empty/hello.js +0 -7
  63. package/fixtures/express/platformatic.runtime.json +0 -21
  64. package/fixtures/express/services/a/platformatic.service.json +0 -14
  65. package/fixtures/express/services/a/plugin.js +0 -26
  66. package/fixtures/express/services/b/platformatic.service.json +0 -14
  67. package/fixtures/express/services/b/plugin.js +0 -19
  68. package/fixtures/external-client/openmeter.json +0 -420
  69. package/fixtures/external-client/platformatic.service.json +0 -13
  70. package/fixtures/interceptors/external.js +0 -27
  71. package/fixtures/interceptors/idp.js +0 -48
  72. package/fixtures/interceptors/platformatic.runtime.json +0 -27
  73. package/fixtures/interceptors/services/a/platformatic.service.json +0 -17
  74. package/fixtures/interceptors/services/a/plugin.js +0 -15
  75. package/fixtures/interceptors-2/platformatic.runtime.json +0 -25
  76. package/fixtures/interceptors-2/services/a/platformatic.service.json +0 -17
  77. package/fixtures/interceptors-2/services/a/plugin.js +0 -15
  78. package/fixtures/leven/.env.sample +0 -4
  79. package/fixtures/leven/platformatic.runtime.json +0 -11
  80. package/fixtures/leven/services/deeply-spittle/platformatic.service.json +0 -25
  81. package/fixtures/leven/services/deeply-spittle/plugins/example.js +0 -6
  82. package/fixtures/leven/services/deeply-spittle/routes/root.js +0 -8
  83. package/fixtures/leven/services/rainy-empire/platformatic.composer.json +0 -21
  84. package/fixtures/management-api/package.json +0 -4
  85. package/fixtures/management-api/platformatic.json +0 -22
  86. package/fixtures/management-api/services/service-1/platformatic.json +0 -15
  87. package/fixtures/management-api/services/service-1/plugin.js +0 -16
  88. package/fixtures/management-api/services/service-2/platformatic.json +0 -9
  89. package/fixtures/management-api/services/service-2/plugin.js +0 -8
  90. package/fixtures/management-api/services/service-db/migrations/001.do.sql +0 -4
  91. package/fixtures/management-api/services/service-db/migrations/001.undo.sql +0 -1
  92. package/fixtures/management-api/services/service-db/package.json +0 -5
  93. package/fixtures/management-api/services/service-db/platformatic.db.json +0 -29
  94. package/fixtures/management-api/services/service-db/plugin.js +0 -12
  95. package/fixtures/management-api-custom-labels/package.json +0 -4
  96. package/fixtures/management-api-custom-labels/platformatic.json +0 -22
  97. package/fixtures/management-api-custom-labels/services/service-1/platformatic.json +0 -12
  98. package/fixtures/management-api-custom-labels/services/service-1/plugin.js +0 -16
  99. package/fixtures/management-api-custom-labels/services/service-2/platformatic.json +0 -9
  100. package/fixtures/management-api-custom-labels/services/service-2/plugin.js +0 -8
  101. package/fixtures/management-api-custom-labels/services/service-db/migrations/001.do.sql +0 -4
  102. package/fixtures/management-api-custom-labels/services/service-db/migrations/001.undo.sql +0 -1
  103. package/fixtures/management-api-custom-labels/services/service-db/package.json +0 -5
  104. package/fixtures/management-api-custom-labels/services/service-db/platformatic.db.json +0 -29
  105. package/fixtures/management-api-custom-labels/services/service-db/plugin.js +0 -12
  106. package/fixtures/management-api-without-metrics/package.json +0 -4
  107. package/fixtures/management-api-without-metrics/platformatic.json +0 -14
  108. package/fixtures/management-api-without-metrics/services/service-1/platformatic.json +0 -8
  109. package/fixtures/monorepo/composerApp/external-service.json +0 -204
  110. package/fixtures/monorepo/composerApp/platformatic.composer.json +0 -46
  111. package/fixtures/monorepo/dbApp/platformatic.db.json +0 -16
  112. package/fixtures/monorepo/docs/README.md +0 -1
  113. package/fixtures/monorepo/serviceApp/deps/dep1.js +0 -7
  114. package/fixtures/monorepo/serviceApp/deps/dep2.mjs +0 -2
  115. package/fixtures/monorepo/serviceApp/deps/dep3.mjs +0 -2
  116. package/fixtures/monorepo/serviceApp/deps/dep4.js +0 -1
  117. package/fixtures/monorepo/serviceApp/platformatic.service.json +0 -23
  118. package/fixtures/monorepo/serviceApp/plugin.js +0 -29
  119. package/fixtures/monorepo/serviceApp/with-logger/package.json +0 -5
  120. package/fixtures/monorepo/serviceApp/with-logger/with-logger.cjs +0 -25
  121. package/fixtures/monorepo/serviceApp/with-logger/with-logger.d.ts +0 -38
  122. package/fixtures/monorepo/serviceApp/with-logger/with-logger.openapi.json +0 -22
  123. package/fixtures/monorepo/serviceAppWithLogger/platformatic.service.json +0 -20
  124. package/fixtures/monorepo/serviceAppWithLogger/plugin.js +0 -20
  125. package/fixtures/monorepo/serviceAppWithMultiplePlugins/platformatic.service.json +0 -28
  126. package/fixtures/monorepo/serviceAppWithMultiplePlugins/plugin.js +0 -8
  127. package/fixtures/monorepo/serviceAppWithMultiplePlugins/plugin2.mjs +0 -5
  128. package/fixtures/monorepo-missing-dependencies/composer/platformatic.json +0 -24
  129. package/fixtures/monorepo-openapi/serviceAppWithoutOpenapi/platformatic.service.json +0 -13
  130. package/fixtures/monorepo-openapi/serviceAppWithoutOpenapi/plugin.js +0 -8
  131. package/fixtures/monorepo-watch/service1/platformatic.service.json +0 -13
  132. package/fixtures/monorepo-watch/service1/plugin.js +0 -8
  133. package/fixtures/monorepo-with-dependencies/main/clients/service-1/package.json +0 -3
  134. package/fixtures/monorepo-with-dependencies/main/clients/service-1/schema.json +0 -204
  135. package/fixtures/monorepo-with-dependencies/main/clients/service-2/package.json +0 -3
  136. package/fixtures/monorepo-with-dependencies/main/clients/service-2/schema.json +0 -204
  137. package/fixtures/monorepo-with-dependencies/main/external-service.schema.json +0 -204
  138. package/fixtures/monorepo-with-dependencies/main/platformatic.json +0 -46
  139. package/fixtures/monorepo-with-dependencies/service-1/clients/service-2/package.json +0 -3
  140. package/fixtures/monorepo-with-dependencies/service-1/clients/service-2/schema.json +0 -204
  141. package/fixtures/monorepo-with-dependencies/service-1/external-service.schema.json +0 -204
  142. package/fixtures/monorepo-with-dependencies/service-1/platformatic.json +0 -29
  143. package/fixtures/monorepo-with-dependencies/service-2/platformatic.json +0 -15
  144. package/fixtures/no-env.service.json +0 -25
  145. package/fixtures/preload/platformatic.runtime.json +0 -15
  146. package/fixtures/preload/preload.js +0 -1
  147. package/fixtures/preload/services/a/platformatic.service.json +0 -14
  148. package/fixtures/preload/services/a/plugin.js +0 -7
  149. package/fixtures/prom-server/platformatic.json +0 -16
  150. package/fixtures/prom-server/services/service-1/platformatic.json +0 -13
  151. package/fixtures/prom-server/services/service-1/plugin.js +0 -8
  152. package/fixtures/prom-server/services/service-2/platformatic.json +0 -12
  153. package/fixtures/prom-server/services/service-2/plugin.js +0 -8
  154. package/fixtures/restart-on-crash/platformatic.runtime.json +0 -14
  155. package/fixtures/restart-on-crash/services/a/platformatic.service.json +0 -16
  156. package/fixtures/restart-on-crash/services/a/plugin.js +0 -9
  157. package/fixtures/sample-runtime/.env +0 -9
  158. package/fixtures/sample-runtime/package.json +0 -16
  159. package/fixtures/sample-runtime/platformatic.json +0 -18
  160. package/fixtures/sample-runtime/services/rival/package.json +0 -16
  161. package/fixtures/sample-runtime/services/rival/platformatic.json +0 -33
  162. package/fixtures/sample-runtime/services/rival/routes/root.js +0 -7
  163. package/fixtures/sample-runtime-with-2-services/.env +0 -10
  164. package/fixtures/sample-runtime-with-2-services/package.json +0 -16
  165. package/fixtures/sample-runtime-with-2-services/platformatic.json +0 -18
  166. package/fixtures/sample-runtime-with-2-services/services/foobar/package.json +0 -16
  167. package/fixtures/sample-runtime-with-2-services/services/foobar/platformatic.json +0 -18
  168. package/fixtures/sample-runtime-with-2-services/services/foobar/routes/root.js +0 -7
  169. package/fixtures/sample-runtime-with-2-services/services/rival/package.json +0 -16
  170. package/fixtures/sample-runtime-with-2-services/services/rival/platformatic.json +0 -33
  171. package/fixtures/sample-runtime-with-2-services/services/rival/routes/root.js +0 -7
  172. package/fixtures/server/logger-transport/custom-transport.js +0 -15
  173. package/fixtures/server/logger-transport/platformatic.runtime.json +0 -21
  174. package/fixtures/server/logger-transport/services/echo/platformatic.service.json +0 -12
  175. package/fixtures/server/logger-transport/services/echo/routes/hello.js +0 -6
  176. package/fixtures/server/overrides-service/platformatic.runtime.json +0 -18
  177. package/fixtures/server/overrides-service/services/echo/platformatic.service.json +0 -19
  178. package/fixtures/server/overrides-service/services/echo/routes/span.js +0 -8
  179. package/fixtures/server/runtime-server/platformatic.runtime.json +0 -18
  180. package/fixtures/server/runtime-server/services/echo/platformatic.service.json +0 -12
  181. package/fixtures/server/runtime-server/services/echo/routes/hello.js +0 -6
  182. package/fixtures/serviceAppThrowsOnStart/platformatic.service.json +0 -12
  183. package/fixtures/serviceAppThrowsOnStart/plugin.js +0 -6
  184. package/fixtures/stackables/node_modules/foo/foo.js +0 -62
  185. package/fixtures/stackables/node_modules/foo/package.json +0 -4
  186. package/fixtures/stackables/platformatic.json +0 -11
  187. package/fixtures/start-command-in-runtime.js +0 -24
  188. package/fixtures/start-command.js +0 -9
  189. package/fixtures/starter.js +0 -9
  190. package/fixtures/stdio/platformatic.service.json +0 -6
  191. package/fixtures/stdio/plugin.js +0 -24
  192. package/fixtures/telemetry/platformatic.runtime.json +0 -18
  193. package/fixtures/telemetry/services/echo/platformatic.service.json +0 -19
  194. package/fixtures/telemetry/services/echo/routes/span.js +0 -22
  195. package/fixtures/telemetry/services/service-1/platformatic.service.json +0 -19
  196. package/fixtures/telemetry/services/service-1/routes/echo.js +0 -7
  197. package/fixtures/typescript/.env +0 -4
  198. package/fixtures/typescript/platformatic.runtime.json +0 -11
  199. package/fixtures/typescript/services/composer/platformatic.composer.json +0 -28
  200. package/fixtures/typescript/services/movies/.env +0 -4
  201. package/fixtures/typescript/services/movies/global.d.ts +0 -23
  202. package/fixtures/typescript/services/movies/migrations/001.do.sql +0 -6
  203. package/fixtures/typescript/services/movies/migrations/001.undo.sql +0 -3
  204. package/fixtures/typescript/services/movies/platformatic.db.json +0 -33
  205. package/fixtures/typescript/services/movies/plugin.ts +0 -5
  206. package/fixtures/typescript/services/movies/tsconfig.json +0 -21
  207. package/fixtures/typescript/services/movies/types/Movie.d.ts +0 -9
  208. package/fixtures/typescript/services/movies/types/index.d.ts +0 -7
  209. package/fixtures/typescript/services/titles/client/client.d.ts +0 -141
  210. package/fixtures/typescript/services/titles/client/client.openapi.json +0 -630
  211. package/fixtures/typescript/services/titles/client/package.json +0 -4
  212. package/fixtures/typescript/services/titles/platformatic.service.json +0 -31
  213. package/fixtures/typescript/services/titles/plugins/example.ts +0 -6
  214. package/fixtures/typescript/services/titles/routes/root.ts +0 -21
  215. package/fixtures/typescript/services/titles/tsconfig.json +0 -21
  216. package/fixtures/typescript-custom-flags/.env +0 -4
  217. package/fixtures/typescript-custom-flags/platformatic.runtime.json +0 -11
  218. package/fixtures/typescript-custom-flags/services/composer/platformatic.composer.json +0 -28
  219. package/fixtures/typescript-custom-flags/services/movies/global.d.ts +0 -23
  220. package/fixtures/typescript-custom-flags/services/movies/migrations/001.do.sql +0 -6
  221. package/fixtures/typescript-custom-flags/services/movies/migrations/001.undo.sql +0 -3
  222. package/fixtures/typescript-custom-flags/services/movies/platformatic.db.json +0 -35
  223. package/fixtures/typescript-custom-flags/services/movies/plugin.ts +0 -5
  224. package/fixtures/typescript-custom-flags/services/movies/tsconfig.json +0 -20
  225. package/fixtures/typescript-custom-flags/services/movies/types/Movie.d.ts +0 -9
  226. package/fixtures/typescript-custom-flags/services/movies/types/index.d.ts +0 -7
  227. package/fixtures/typescript-custom-flags/services/titles/client/client.d.ts +0 -141
  228. package/fixtures/typescript-custom-flags/services/titles/client/client.openapi.json +0 -630
  229. package/fixtures/typescript-custom-flags/services/titles/client/package.json +0 -4
  230. package/fixtures/typescript-custom-flags/services/titles/platformatic.service.json +0 -33
  231. package/fixtures/typescript-custom-flags/services/titles/plugins/example.ts +0 -6
  232. package/fixtures/typescript-custom-flags/services/titles/routes/root.ts +0 -21
  233. package/fixtures/typescript-custom-flags/services/titles/tsconfig.json +0 -21
  234. package/fixtures/typescript-no-env/platformatic.runtime.json +0 -11
  235. package/fixtures/typescript-no-env/services/composer/platformatic.composer.json +0 -28
  236. package/fixtures/typescript-no-env/services/movies/global.d.ts +0 -23
  237. package/fixtures/typescript-no-env/services/movies/migrations/001.do.sql +0 -6
  238. package/fixtures/typescript-no-env/services/movies/migrations/001.undo.sql +0 -3
  239. package/fixtures/typescript-no-env/services/movies/platformatic.db.json +0 -33
  240. package/fixtures/typescript-no-env/services/movies/plugin.ts +0 -5
  241. package/fixtures/typescript-no-env/services/movies/tsconfig.json +0 -21
  242. package/fixtures/typescript-no-env/services/movies/types/Movie.d.ts +0 -9
  243. package/fixtures/typescript-no-env/services/movies/types/index.d.ts +0 -7
  244. package/fixtures/typescript-no-env/services/titles/client/client.d.ts +0 -141
  245. package/fixtures/typescript-no-env/services/titles/client/client.openapi.json +0 -630
  246. package/fixtures/typescript-no-env/services/titles/client/package.json +0 -4
  247. package/fixtures/typescript-no-env/services/titles/platformatic.service.json +0 -31
  248. package/fixtures/typescript-no-env/services/titles/plugins/example.ts +0 -6
  249. package/fixtures/typescript-no-env/services/titles/routes/root.ts +0 -21
  250. package/fixtures/typescript-no-env/services/titles/tsconfig.json +0 -21
@@ -1,420 +0,0 @@
1
- {
2
- "openapi": "3.0.3",
3
- "info": {
4
- "title": "OpenMeter API",
5
- "version": "1.0.0",
6
- "description": "",
7
- "license": {
8
- "name": "Apache 2.0",
9
- "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
10
- }
11
- },
12
- "paths": {
13
- "/api/v1alpha1/events": {
14
- "post": {
15
- "description": "Ingest events",
16
- "operationId": "ingestEvents",
17
- "requestBody": {
18
- "required": true,
19
- "content": {
20
- "application/json": {
21
- "schema": {
22
- "$ref": "#/components/schemas/Event"
23
- }
24
- }
25
- }
26
- },
27
- "responses": {
28
- "200": {
29
- "description": "OK"
30
- },
31
- "default": {
32
- "description": "Unexpected error",
33
- "content": {
34
- "application/json": {
35
- "schema": {
36
- "$ref": "#/components/schemas/Error"
37
- }
38
- }
39
- }
40
- }
41
- }
42
- }
43
- },
44
- "/api/v1alpha1/meters": {
45
- "get": {
46
- "description": "Get meters",
47
- "operationId": "getMeters",
48
- "responses": {
49
- "200": {
50
- "description": "OK",
51
- "content": {
52
- "application/json": {
53
- "schema": {
54
- "type": "array",
55
- "items": {
56
- "$ref": "#/components/schemas/Meter"
57
- }
58
- }
59
- }
60
- }
61
- },
62
- "default": {
63
- "description": "Unexpected error",
64
- "content": {
65
- "application/json": {
66
- "schema": {
67
- "$ref": "#/components/schemas/Error"
68
- }
69
- }
70
- }
71
- }
72
- }
73
- }
74
- },
75
- "/api/v1alpha1/meters/{meterId}": {
76
- "get": {
77
- "description": "Get meter by ID",
78
- "operationId": "getMetersById",
79
- "parameters": [
80
- {
81
- "name": "meterId",
82
- "in": "path",
83
- "required": true,
84
- "schema": {
85
- "type": "string"
86
- }
87
- }
88
- ],
89
- "responses": {
90
- "200": {
91
- "description": "OK",
92
- "content": {
93
- "application/json": {
94
- "schema": {
95
- "$ref": "#/components/schemas/Meter"
96
- }
97
- }
98
- }
99
- },
100
- "404": {
101
- "description": "Not Found",
102
- "content": {
103
- "application/json": {
104
- "schema": {
105
- "$ref": "#/components/schemas/Error"
106
- }
107
- }
108
- }
109
- },
110
- "default": {
111
- "description": "Unexpected error",
112
- "content": {
113
- "application/json": {
114
- "schema": {
115
- "$ref": "#/components/schemas/Error"
116
- }
117
- }
118
- }
119
- }
120
- }
121
- }
122
- },
123
- "/api/v1alpha1/meters/{meterId}/values": {
124
- "get": {
125
- "description": "Get meter values",
126
- "operationId": "getValuesByMeterId",
127
- "parameters": [
128
- {
129
- "name": "meterId",
130
- "in": "path",
131
- "required": true,
132
- "schema": {
133
- "type": "string"
134
- }
135
- },
136
- {
137
- "name": "subject",
138
- "in": "query",
139
- "required": false,
140
- "schema": {
141
- "type": "string"
142
- }
143
- },
144
- {
145
- "name": "from",
146
- "in": "query",
147
- "required": false,
148
- "description": "Start date-time in RFC 3339 format.\nMust be aligned with the window size.\nInclusive.\n",
149
- "schema": {
150
- "type": "string",
151
- "format": "date-time"
152
- }
153
- },
154
- {
155
- "name": "to",
156
- "in": "query",
157
- "required": false,
158
- "description": "End date-time in RFC 3339 format.\nMust be aligned with the window size.\nInclusive.\n",
159
- "schema": {
160
- "type": "string",
161
- "format": "date-time"
162
- }
163
- },
164
- {
165
- "name": "windowSize",
166
- "in": "query",
167
- "required": false,
168
- "description": "If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.\n",
169
- "schema": {
170
- "$ref": "#/components/schemas/WindowSize"
171
- }
172
- }
173
- ],
174
- "responses": {
175
- "200": {
176
- "description": "OK",
177
- "content": {
178
- "application/json": {
179
- "schema": {
180
- "type": "object",
181
- "properties": {
182
- "windowSize": {
183
- "$ref": "#/components/schemas/WindowSize"
184
- },
185
- "data": {
186
- "type": "array",
187
- "items": {
188
- "$ref": "#/components/schemas/MeterValue"
189
- }
190
- }
191
- },
192
- "required": [
193
- "data"
194
- ]
195
- }
196
- }
197
- }
198
- },
199
- "default": {
200
- "description": "Unexpected error",
201
- "content": {
202
- "application/json": {
203
- "schema": {
204
- "$ref": "#/components/schemas/Error"
205
- }
206
- }
207
- }
208
- }
209
- }
210
- }
211
- }
212
- },
213
- "components": {
214
- "schemas": {
215
- "Error": {
216
- "type": "object",
217
- "x-go-type": "ErrResponse",
218
- "properties": {
219
- "statusCode": {
220
- "type": "integer",
221
- "format": "int32"
222
- },
223
- "status": {
224
- "type": "string"
225
- },
226
- "code": {
227
- "type": "integer",
228
- "format": "int32"
229
- },
230
- "message": {
231
- "type": "string"
232
- }
233
- }
234
- },
235
- "Event": {
236
- "description": "CloudEvents Specification JSON Schema",
237
- "x-go-type": "event.Event",
238
- "x-go-type-import": {
239
- "path": "github.com/cloudevents/sdk-go/v2/event"
240
- },
241
- "type": "object",
242
- "additionalProperties": false,
243
- "properties": {
244
- "id": {
245
- "description": "Identifies the event.",
246
- "type": "string",
247
- "minLength": 1,
248
- "example": "A234-1234-1234"
249
- },
250
- "source": {
251
- "description": "Identifies the context in which an event happened.",
252
- "type": "string",
253
- "format": "uri-reference",
254
- "minLength": 1,
255
- "example": "https://github.com/cloudevents"
256
- },
257
- "specversion": {
258
- "description": "The version of the CloudEvents specification which the event uses.",
259
- "type": "string",
260
- "minLength": 1,
261
- "example": "1.0"
262
- },
263
- "type": {
264
- "description": "Describes the type of event related to the originating occurrence.",
265
- "type": "string",
266
- "minLength": 1,
267
- "example": "api_request"
268
- },
269
- "datacontenttype": {
270
- "description": "Content type of the data value. Must adhere to RFC 2046 format.",
271
- "type": "string",
272
- "enum": [
273
- "application/json"
274
- ],
275
- "nullable": true,
276
- "minLength": 1,
277
- "example": "application/json"
278
- },
279
- "dataschema": {
280
- "description": "Identifies the schema that data adheres to.",
281
- "type": "string",
282
- "nullable": true,
283
- "format": "uri",
284
- "minLength": 1
285
- },
286
- "subject": {
287
- "description": "Describes the subject of the event in the context of the event producer (identified by source).",
288
- "type": "string",
289
- "nullable": true,
290
- "minLength": 1,
291
- "example": "customer_id"
292
- },
293
- "time": {
294
- "description": "Timestamp of when the occurrence happened. Must adhere to RFC 3339.",
295
- "type": "string",
296
- "nullable": true,
297
- "format": "date-time",
298
- "minLength": 1,
299
- "example": "2018-04-05T17:31:00Z"
300
- },
301
- "data": {
302
- "description": "The event payload.",
303
- "type": "object",
304
- "additionalProperties": true,
305
- "example": "{\"duration_ms\": \"123\"}\n"
306
- }
307
- },
308
- "required": [
309
- "id",
310
- "source",
311
- "specversion",
312
- "type",
313
- "subject"
314
- ]
315
- },
316
- "Meter": {
317
- "type": "object",
318
- "x-go-type": "models.Meter",
319
- "x-go-type-import": {
320
- "path": "github.com/openmeterio/openmeter/pkg/models"
321
- },
322
- "properties": {
323
- "id": {
324
- "type": "string",
325
- "example": "my_meter"
326
- },
327
- "name": {
328
- "type": "string",
329
- "example": "My Meter"
330
- },
331
- "description": {
332
- "type": "string",
333
- "example": "My Meter Description"
334
- },
335
- "labels": {
336
- "type": "object",
337
- "additionalProperties": {
338
- "type": "string"
339
- },
340
- "properties": {
341
- },
342
- "example": "{\n \"my_label\": \"my_value\"\n}\n"
343
- },
344
- "type": {
345
- "type": "string",
346
- "example": "event_type"
347
- },
348
- "aggregation": {
349
- "type": "string",
350
- "enum": [
351
- "SUM",
352
- "COUNT",
353
- "MAX",
354
- "COUNT_DISTINCT",
355
- "LATEST_BY_OFFSET"
356
- ],
357
- "example": "SUM"
358
- },
359
- "valueProperty": {
360
- "type": "string",
361
- "example": "$.duration_ms",
362
- "description": "JSONPath expression to extract the value from the event data."
363
- },
364
- "groupBy": {
365
- "type": "array",
366
- "items": {
367
- "type": "string"
368
- },
369
- "example": "[\n \"$.my_label\"\n]\n",
370
- "description": "JSONPath expressions to extract the group by values from the event data."
371
- },
372
- "windowSize": {
373
- "$ref": "#/components/schemas/WindowSize"
374
- }
375
- }
376
- },
377
- "WindowSize": {
378
- "type": "string",
379
- "x-go-type": "models.WindowSize",
380
- "x-go-type-import": {
381
- "path": "github.com/openmeterio/openmeter/pkg/models"
382
- },
383
- "enum": [
384
- "MINUTE",
385
- "HOUR",
386
- "DAY"
387
- ]
388
- },
389
- "MeterValue": {
390
- "type": "object",
391
- "x-go-type": "models.MeterValue",
392
- "x-go-type-import": {
393
- "path": "github.com/openmeterio/openmeter/pkg/models"
394
- },
395
- "properties": {
396
- "subject": {
397
- "type": "string"
398
- },
399
- "windowStart": {
400
- "type": "string",
401
- "format": "date-time"
402
- },
403
- "windowEnd": {
404
- "type": "string",
405
- "format": "date-time"
406
- },
407
- "value": {
408
- "type": "number"
409
- },
410
- "groupBy": {
411
- "type": "object",
412
- "additionalProperties": {
413
- "type": "string"
414
- }
415
- }
416
- }
417
- }
418
- }
419
- }
420
- }
@@ -1,13 +0,0 @@
1
- {
2
- "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
- "server": {
4
- "hostname": "127.0.0.1",
5
- "port": "0",
6
- "logger": {
7
- "level": "info"
8
- }
9
- },
10
- "service": {
11
- "openapi": true
12
- }
13
- }
@@ -1,27 +0,0 @@
1
- 'use strict'
2
-
3
- const fastify = require('fastify')
4
-
5
- async function start (opts) {
6
- const app = fastify()
7
-
8
- // Dumb bearer token implementation
9
- app.get('/hello', async (req, res) => {
10
- // We just check if there is an authorization header,
11
- // which is insecure,
12
- if (req.headers.authorization) {
13
- return { hello: 'world' }
14
- } else {
15
- res.code(401)
16
- return { error: 'Unauthorized' }
17
- }
18
- })
19
-
20
- return app
21
- }
22
-
23
- module.exports = start
24
-
25
- if (require.main === module) {
26
- start({ logger: { name: 'external' } }).then(app => app.listen({ port: process.env.PORT || 3001 }))
27
- }
@@ -1,48 +0,0 @@
1
- 'use strict'
2
-
3
- const fastify = require('fastify')
4
- const formBody = require('@fastify/formbody')
5
- const { createSigner } = require('fast-jwt')
6
-
7
- async function start (opts) {
8
- const app = fastify(opts)
9
- let port = opts.port
10
-
11
- const signSync = createSigner({
12
- key: 'secret',
13
- expiresIn: '1h',
14
- })
15
-
16
- app.decorate('refreshToken', '')
17
- app.decorate('signSync', signSync)
18
-
19
- app.register(formBody)
20
-
21
- // Dump bearer token implementation
22
- app.post('/token', async (req, res) => {
23
- return { access_token: signSync({}) }
24
- })
25
-
26
- await app.listen({ port })
27
-
28
- port = app.server.address().port
29
-
30
- const refreshToken = signSync({
31
- iss: `http://localhost:${port}`,
32
- })
33
-
34
- app.refreshToken = refreshToken
35
-
36
- app.log.info({ refreshToken }, 'refresh token')
37
-
38
- return app
39
- }
40
-
41
- module.exports = start
42
-
43
- if (require.main === module) {
44
- start({ logger: { name: 'idp' }, port: process.env.PORT || 3000 }).catch((err) => {
45
- console.error(err)
46
- process.exit(1)
47
- })
48
- }
@@ -1,27 +0,0 @@
1
- {
2
- "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
- "entrypoint": "a",
4
- "autoload": {
5
- "path": "./services"
6
- },
7
- "server": {
8
- "hostname": "127.0.0.1",
9
- "port": "{{PORT}}",
10
- "logger": {
11
- "level": "info"
12
- }
13
- },
14
- "undici": {
15
- "interceptors": {
16
- "Agent": [{
17
- "module": "undici-oidc-interceptor",
18
- "options": {
19
- "idpTokenUrl": "{{PLT_IDP_TOKEN_URL}}",
20
- "refreshToken": "{{PLT_REFRESH_TOKEN}}",
21
- "origins": ["{{PLT_EXTERNAL_SERVICE}}"],
22
- "clientId": "my-client-id"
23
- }
24
- }]
25
- }
26
- }
27
- }
@@ -1,17 +0,0 @@
1
- {
2
- "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
- "server": {
4
- "logger": {
5
- "level": "warn"
6
- }
7
- },
8
- "plugins": {
9
- "paths": [{
10
- "path": "plugin.js",
11
- "encapsulate": false,
12
- "options": {
13
- "externalService": "{{PLT_EXTERNAL_SERVICE}}"
14
- }
15
- }]
16
- }
17
- }
@@ -1,15 +0,0 @@
1
- 'use strict'
2
-
3
- const { request } = require('undici')
4
-
5
- module.exports = async function (fastify, options) {
6
- fastify.get('/hello', async (_, reply) => {
7
- const res = await request(`${options.externalService}/hello`)
8
- if (res.statusCode !== 200) {
9
- reply.code(res.statusCode)
10
- }
11
- reply.log.info('response received')
12
- const data = await res.body.json()
13
- return data
14
- })
15
- }
@@ -1,25 +0,0 @@
1
- {
2
- "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
- "entrypoint": "a",
4
- "autoload": {
5
- "path": "./services"
6
- },
7
- "server": {
8
- "hostname": "127.0.0.1",
9
- "port": "{{PORT}}",
10
- "logger": {
11
- "level": "info"
12
- }
13
- },
14
- "undici": {
15
- "interceptors": [{
16
- "module": "undici-oidc-interceptor",
17
- "options": {
18
- "idpTokenUrl": "{{PLT_IDP_TOKEN_URL}}",
19
- "refreshToken": "{{PLT_REFRESH_TOKEN}}",
20
- "origins": ["{{PLT_EXTERNAL_SERVICE}}"],
21
- "clientId": "my-client-id"
22
- }
23
- }]
24
- }
25
- }
@@ -1,17 +0,0 @@
1
- {
2
- "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
- "server": {
4
- "logger": {
5
- "level": "warn"
6
- }
7
- },
8
- "plugins": {
9
- "paths": [{
10
- "path": "plugin.js",
11
- "encapsulate": false,
12
- "options": {
13
- "externalService": "{{PLT_EXTERNAL_SERVICE}}"
14
- }
15
- }]
16
- }
17
- }
@@ -1,15 +0,0 @@
1
- 'use strict'
2
-
3
- const { request } = require('undici')
4
-
5
- module.exports = async function (fastify, options) {
6
- fastify.get('/hello', async (_, reply) => {
7
- const res = await request(`${options.externalService}/hello`)
8
- if (res.statusCode !== 200) {
9
- reply.code(res.statusCode)
10
- }
11
- reply.log.info('response received')
12
- const data = await res.body.json()
13
- return data
14
- })
15
- }
@@ -1,4 +0,0 @@
1
- PLT_SERVER_HOSTNAME=127.0.0.1
2
- PORT=3043
3
- PLT_SERVER_LOGGER_LEVEL=info
4
- PLT_EXAMPLE=world
@@ -1,11 +0,0 @@
1
- {
2
- "$schema": "https://schemas.platformatic.dev/@platformatic/runtime/1.52.0.json",
3
- "entrypoint": "rainy-empire",
4
- "watch": true,
5
- "autoload": {
6
- "path": "services",
7
- "exclude": [
8
- "docs"
9
- ]
10
- }
11
- }
@@ -1,25 +0,0 @@
1
- {
2
- "$schema": "https://schemas.platformatic.dev/@platformatic/service/1.52.0.json",
3
- "server": {
4
- "hostname": "{PLT_SERVER_HOSTNAME}",
5
- "port": "{PORT}",
6
- "logger": {
7
- "level": "{PLT_SERVER_LOGGER_LEVEL}"
8
- }
9
- },
10
- "service": {
11
- "openapi": true
12
- },
13
- "plugins": {
14
- "paths": [
15
- {
16
- "path": "./plugins",
17
- "encapsulate": false,
18
- "options": {
19
- "example": "{PLT_EXAMPLE}"
20
- }
21
- },
22
- "./routes"
23
- ]
24
- }
25
- }
@@ -1,6 +0,0 @@
1
- /// <reference types="@platformatic/service" />
2
- 'use strict'
3
- /** @param {import('fastify').FastifyInstance} fastify */
4
- module.exports = async function (fastify, opts) {
5
- fastify.decorate('example', 'foobar')
6
- }