massimo-cli 1.2.0 → 1.5.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.
- package/lib/frontend-openapi-generator.js +7 -1
- package/lib/get-type.js +4 -5
- package/package.json +14 -14
|
@@ -248,7 +248,7 @@ function generateFrontendImplementationFromOpenAPI ({
|
|
|
248
248
|
writer.blankLine()
|
|
249
249
|
|
|
250
250
|
/* eslint-disable-next-line no-template-curly-in-string */
|
|
251
|
-
const searchString = queryParams.length > 0 ?
|
|
251
|
+
const searchString = queryParams.length > 0 ? "?${searchParams.toString().replace(/\\+/g, '%20')}" : ''
|
|
252
252
|
if (!isGetMethod) {
|
|
253
253
|
writer
|
|
254
254
|
.write(`const response = await fetch(\`\${url}${stringLiteralPath}${searchString}\`, `)
|
|
@@ -446,6 +446,12 @@ function generateTypesFromOpenAPI ({ schema, name, fullRequest, fullResponse, pr
|
|
|
446
446
|
})
|
|
447
447
|
})
|
|
448
448
|
|
|
449
|
+
// Declare the module-level named exports emitted by the implementation file,
|
|
450
|
+
// so consumers relying on the .d.ts can `import { setBaseUrl, ... }` without type errors.
|
|
451
|
+
writer.writeLine(`export declare const setBaseUrl: ${camelCaseName}['setBaseUrl'];`)
|
|
452
|
+
writer.writeLine(`export declare const setDefaultHeaders: ${camelCaseName}['setDefaultHeaders'];`)
|
|
453
|
+
writer.writeLine(`export declare const setDefaultFetchParams: ${camelCaseName}['setDefaultFetchParams'];`)
|
|
454
|
+
|
|
449
455
|
writer.writeLine(`type PlatformaticFrontendClient = Omit<${camelCaseName}, 'setBaseUrl'>`)
|
|
450
456
|
writer.write('type BuildOptions = ').block(() => {
|
|
451
457
|
writer.writeLine('headers?: object')
|
package/lib/get-type.js
CHANGED
|
@@ -73,11 +73,10 @@ export function getType (typeDef, methodType, spec) {
|
|
|
73
73
|
const nullable = typeDef.nullable
|
|
74
74
|
const chainedTypes = typeDef.enum
|
|
75
75
|
.map(en => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
76
|
+
// Quote by the runtime type of the value: the schema may omit `type`
|
|
77
|
+
if (en === null) return 'null'
|
|
78
|
+
if (typeof en === 'string') return `'${en.replace(/'/g, "\\'")}'`
|
|
79
|
+
return en
|
|
81
80
|
})
|
|
82
81
|
.join(' | ')
|
|
83
82
|
return nullable === true ? `${chainedTypes} | null` : chainedTypes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "massimo-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "A client for HTTP services.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -25,21 +25,21 @@
|
|
|
25
25
|
"graphql": "^16.8.1",
|
|
26
26
|
"help-me": "^5.0.0",
|
|
27
27
|
"jsonpointer": "^5.0.1",
|
|
28
|
+
"massimo": "1.5.0",
|
|
28
29
|
"minimist": "^1.2.8",
|
|
29
30
|
"pino": "^9.9.0",
|
|
30
31
|
"pino-pretty": "^13.0.0",
|
|
31
32
|
"undici": "^7.0.0",
|
|
32
|
-
"yaml": "^2.4.1"
|
|
33
|
-
"massimo": "1.2.0"
|
|
33
|
+
"yaml": "^2.4.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@platformatic/composer": "3.
|
|
37
|
-
"@platformatic/db": "3.
|
|
38
|
-
"@platformatic/foundation": "3.
|
|
39
|
-
"@platformatic/runtime": "3.
|
|
40
|
-
"@platformatic/service": "3.
|
|
41
|
-
"@platformatic/sql-graphql": "3.
|
|
42
|
-
"@platformatic/sql-mapper": "3.
|
|
36
|
+
"@platformatic/composer": "3.67.0",
|
|
37
|
+
"@platformatic/db": "3.67.0",
|
|
38
|
+
"@platformatic/foundation": "3.67.0",
|
|
39
|
+
"@platformatic/runtime": "3.67.0",
|
|
40
|
+
"@platformatic/service": "3.67.0",
|
|
41
|
+
"@platformatic/sql-graphql": "3.67.0",
|
|
42
|
+
"@platformatic/sql-mapper": "3.67.0",
|
|
43
43
|
"@playwright/test": "^1.42.1",
|
|
44
44
|
"@types/react": "^19.1.6",
|
|
45
45
|
"@types/react-dom": "^19.1.5",
|
|
@@ -48,18 +48,18 @@
|
|
|
48
48
|
"dotenv": "^16.4.5",
|
|
49
49
|
"eslint": "9",
|
|
50
50
|
"execa": "^9.0.0",
|
|
51
|
-
"fastify": "^5.
|
|
51
|
+
"fastify": "^5.12.0",
|
|
52
52
|
"fastify-tsconfig": "^3.0.0",
|
|
53
53
|
"fs-extra": "^11.2.0",
|
|
54
|
-
"neostandard": "^0.
|
|
54
|
+
"neostandard": "^0.13.0",
|
|
55
55
|
"react": "^19.1.0",
|
|
56
56
|
"react-dom": "^19.1.0",
|
|
57
57
|
"scheduler": "^0.27.0",
|
|
58
58
|
"split2": "^4.2.0",
|
|
59
|
-
"tsd": "^0.
|
|
59
|
+
"tsd": "^0.33.0",
|
|
60
60
|
"typescript": "^5.5.4",
|
|
61
61
|
"vite": "^5.1.6",
|
|
62
|
-
"wattpm": "3.
|
|
62
|
+
"wattpm": "3.67.0",
|
|
63
63
|
"why-is-node-running": "^2.2.2"
|
|
64
64
|
},
|
|
65
65
|
"engines": {
|