@seamapi/cli 0.4.0 → 0.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/README.md +1 -6
- package/lib/blueprint.d.ts +6 -0
- package/lib/blueprint.js +37 -0
- package/lib/blueprint.js.map +1 -0
- package/lib/get-api-blueprint.d.ts +1 -1
- package/lib/get-api-blueprint.js +15 -7
- package/lib/get-api-blueprint.js.map +1 -1
- package/lib/interact-for-custom-metadata.d.ts +1 -1
- package/lib/interact-for-custom-metadata.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/src/lib/blueprint.ts +53 -0
- package/src/lib/get-api-blueprint.ts +17 -7
- package/src/lib/interact-for-custom-metadata.ts +4 -1
- package/src/lib/version.ts +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getOpenapiSchema } from '@seamapi/http/connect'
|
|
3
|
-
import * as seamTypes from '@seamapi/types/connect'
|
|
1
|
+
import type { Blueprint } from '@seamapi/blueprint'
|
|
4
2
|
|
|
3
|
+
import getBlueprint from './blueprint.js'
|
|
5
4
|
import { getServer } from './get-server.js'
|
|
6
5
|
|
|
7
6
|
export type ApiBlueprint = Blueprint
|
|
@@ -9,9 +8,20 @@ export type ApiBlueprint = Blueprint
|
|
|
9
8
|
export const getApiBlueprint = async (
|
|
10
9
|
useRemoteDefinitions: boolean,
|
|
11
10
|
): Promise<ApiBlueprint> => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
// Remote definitions describe whatever the server is currently running, so
|
|
12
|
+
// build them directly from the server's OpenAPI document. This runtime path
|
|
13
|
+
// does not load @seamapi/types.
|
|
14
|
+
if (useRemoteDefinitions) return await createRemoteBlueprint()
|
|
15
15
|
|
|
16
|
-
return
|
|
16
|
+
return await getBlueprint()
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const createRemoteBlueprint = async (): Promise<Blueprint> => {
|
|
20
|
+
const [{ createBlueprint }, { getOpenapiSchema }] = await Promise.all([
|
|
21
|
+
import('@seamapi/blueprint'),
|
|
22
|
+
import('@seamapi/http/connect'),
|
|
23
|
+
])
|
|
24
|
+
const openapi = await getOpenapiSchema(getServer())
|
|
25
|
+
|
|
26
|
+
return await createBlueprint({ openapi }, { omitUndocumented: true })
|
|
17
27
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { CustomMetadata } from '@seamapi/types/connect'
|
|
2
1
|
import prompts from 'prompts'
|
|
3
2
|
|
|
3
|
+
// Structurally the CustomMetadata of @seamapi/types, spelled out here so the
|
|
4
|
+
// published declarations do not depend on a development-only package.
|
|
5
|
+
type CustomMetadata = Record<string, string | boolean>
|
|
6
|
+
|
|
4
7
|
type UpdatedCustomMetadata = {
|
|
5
8
|
[x: string]: string | boolean | null
|
|
6
9
|
}
|
package/src/lib/version.ts
CHANGED