@valon-technologies/gestalt 0.0.1-alpha.10 → 0.0.1-alpha.11
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/gen/v1/plugin_pb.ts +76 -13
- package/package.json +1 -1
- package/src/index.ts +18 -0
- package/src/invoker.ts +38 -2
- package/src/manifest-metadata.ts +101 -0
- package/src/plugin.ts +162 -0
- package/src/runtime.ts +14 -3
package/gen/v1/plugin_pb.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { JsonObject, Message } from "@bufbuild/protobuf";
|
|
|
12
12
|
* Describes the file v1/plugin.proto.
|
|
13
13
|
*/
|
|
14
14
|
export const file_v1_plugin: GenFile = /*@__PURE__*/
|
|
15
|
-
fileDesc("
|
|
15
|
+
fileDesc("Cg92MS9wbHVnaW4ucHJvdG8SE2dlc3RhbHQucHJvdmlkZXIudjEifgoQQ2F0YWxvZ1BhcmFtZXRlchIMCgRuYW1lGAEgASgJEgwKBHR5cGUYAiABKAkSEwoLZGVzY3JpcHRpb24YAyABKAkSEAoIcmVxdWlyZWQYBCABKAgSJwoHZGVmYXVsdBgFIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSLeAQoUT3BlcmF0aW9uQW5ub3RhdGlvbnMSGwoOcmVhZF9vbmx5X2hpbnQYASABKAhIAIgBARIcCg9pZGVtcG90ZW50X2hpbnQYAiABKAhIAYgBARIdChBkZXN0cnVjdGl2ZV9oaW50GAMgASgISAKIAQESHAoPb3Blbl93b3JsZF9oaW50GAQgASgISAOIAQFCEQoPX3JlYWRfb25seV9oaW50QhIKEF9pZGVtcG90ZW50X2hpbnRCEwoRX2Rlc3RydWN0aXZlX2hpbnRCEgoQX29wZW5fd29ybGRfaGludCKAAwoQQ2F0YWxvZ09wZXJhdGlvbhIKCgJpZBgBIAEoCRIOCgZtZXRob2QYAiABKAkSDQoFdGl0bGUYAyABKAkSEwoLZGVzY3JpcHRpb24YBCABKAkSFAoMaW5w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2dlbi92MTtwcm90b2IGcHJvdG8z", [file_google_protobuf_empty, file_google_protobuf_struct, file_google_protobuf_timestamp]);
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* CatalogParameter describes one input parameter surfaced in the generated
|
|
@@ -362,6 +362,16 @@ export type PluginInvocationGrant = Message<"gestalt.provider.v1.PluginInvocatio
|
|
|
362
362
|
* @generated from field: repeated string operations = 2;
|
|
363
363
|
*/
|
|
364
364
|
operations: string[];
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* @generated from field: repeated string surfaces = 3;
|
|
368
|
+
*/
|
|
369
|
+
surfaces: string[];
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* @generated from field: bool all_operations = 4;
|
|
373
|
+
*/
|
|
374
|
+
allOperations: boolean;
|
|
365
375
|
};
|
|
366
376
|
|
|
367
377
|
/**
|
|
@@ -465,6 +475,51 @@ export type PluginInvokeRequest = Message<"gestalt.provider.v1.PluginInvokeReque
|
|
|
465
475
|
export const PluginInvokeRequestSchema: GenMessage<PluginInvokeRequest> = /*@__PURE__*/
|
|
466
476
|
messageDesc(file_v1_plugin, 10);
|
|
467
477
|
|
|
478
|
+
/**
|
|
479
|
+
* PluginInvokeGraphQLRequest invokes the raw GraphQL surface on another plugin
|
|
480
|
+
* through the host-side invoker service.
|
|
481
|
+
*
|
|
482
|
+
* @generated from message gestalt.provider.v1.PluginInvokeGraphQLRequest
|
|
483
|
+
*/
|
|
484
|
+
export type PluginInvokeGraphQLRequest = Message<"gestalt.provider.v1.PluginInvokeGraphQLRequest"> & {
|
|
485
|
+
/**
|
|
486
|
+
* @generated from field: string plugin = 1;
|
|
487
|
+
*/
|
|
488
|
+
plugin: string;
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* @generated from field: string document = 2;
|
|
492
|
+
*/
|
|
493
|
+
document: string;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* @generated from field: google.protobuf.Struct variables = 3;
|
|
497
|
+
*/
|
|
498
|
+
variables?: JsonObject;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* @generated from field: string connection = 4;
|
|
502
|
+
*/
|
|
503
|
+
connection: string;
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* @generated from field: string instance = 5;
|
|
507
|
+
*/
|
|
508
|
+
instance: string;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* @generated from field: string invocation_token = 6;
|
|
512
|
+
*/
|
|
513
|
+
invocationToken: string;
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Describes the message gestalt.provider.v1.PluginInvokeGraphQLRequest.
|
|
518
|
+
* Use `create(PluginInvokeGraphQLRequestSchema)` to create a new message.
|
|
519
|
+
*/
|
|
520
|
+
export const PluginInvokeGraphQLRequestSchema: GenMessage<PluginInvokeGraphQLRequest> = /*@__PURE__*/
|
|
521
|
+
messageDesc(file_v1_plugin, 11);
|
|
522
|
+
|
|
468
523
|
/**
|
|
469
524
|
* IntegrationToken is the host-managed token payload passed into post-connect
|
|
470
525
|
* hooks.
|
|
@@ -543,7 +598,7 @@ export type IntegrationToken = Message<"gestalt.provider.v1.IntegrationToken"> &
|
|
|
543
598
|
* Use `create(IntegrationTokenSchema)` to create a new message.
|
|
544
599
|
*/
|
|
545
600
|
export const IntegrationTokenSchema: GenMessage<IntegrationToken> = /*@__PURE__*/
|
|
546
|
-
messageDesc(file_v1_plugin,
|
|
601
|
+
messageDesc(file_v1_plugin, 12);
|
|
547
602
|
|
|
548
603
|
/**
|
|
549
604
|
* SubjectContext identifies the caller that initiated an operation.
|
|
@@ -577,7 +632,7 @@ export type SubjectContext = Message<"gestalt.provider.v1.SubjectContext"> & {
|
|
|
577
632
|
* Use `create(SubjectContextSchema)` to create a new message.
|
|
578
633
|
*/
|
|
579
634
|
export const SubjectContextSchema: GenMessage<SubjectContext> = /*@__PURE__*/
|
|
580
|
-
messageDesc(file_v1_plugin,
|
|
635
|
+
messageDesc(file_v1_plugin, 13);
|
|
581
636
|
|
|
582
637
|
/**
|
|
583
638
|
* CredentialContext describes the resolved credential used for an operation.
|
|
@@ -611,7 +666,7 @@ export type CredentialContext = Message<"gestalt.provider.v1.CredentialContext">
|
|
|
611
666
|
* Use `create(CredentialContextSchema)` to create a new message.
|
|
612
667
|
*/
|
|
613
668
|
export const CredentialContextSchema: GenMessage<CredentialContext> = /*@__PURE__*/
|
|
614
|
-
messageDesc(file_v1_plugin,
|
|
669
|
+
messageDesc(file_v1_plugin, 14);
|
|
615
670
|
|
|
616
671
|
/**
|
|
617
672
|
* AccessContext describes the host-side access decision for an operation.
|
|
@@ -635,7 +690,7 @@ export type AccessContext = Message<"gestalt.provider.v1.AccessContext"> & {
|
|
|
635
690
|
* Use `create(AccessContextSchema)` to create a new message.
|
|
636
691
|
*/
|
|
637
692
|
export const AccessContextSchema: GenMessage<AccessContext> = /*@__PURE__*/
|
|
638
|
-
messageDesc(file_v1_plugin,
|
|
693
|
+
messageDesc(file_v1_plugin, 15);
|
|
639
694
|
|
|
640
695
|
/**
|
|
641
696
|
* RequestContext bundles the caller, credential, and access metadata for one
|
|
@@ -670,7 +725,7 @@ export type RequestContext = Message<"gestalt.provider.v1.RequestContext"> & {
|
|
|
670
725
|
* Use `create(RequestContextSchema)` to create a new message.
|
|
671
726
|
*/
|
|
672
727
|
export const RequestContextSchema: GenMessage<RequestContext> = /*@__PURE__*/
|
|
673
|
-
messageDesc(file_v1_plugin,
|
|
728
|
+
messageDesc(file_v1_plugin, 16);
|
|
674
729
|
|
|
675
730
|
/**
|
|
676
731
|
* ExecuteRequest invokes one executable operation.
|
|
@@ -719,7 +774,7 @@ export type ExecuteRequest = Message<"gestalt.provider.v1.ExecuteRequest"> & {
|
|
|
719
774
|
* Use `create(ExecuteRequestSchema)` to create a new message.
|
|
720
775
|
*/
|
|
721
776
|
export const ExecuteRequestSchema: GenMessage<ExecuteRequest> = /*@__PURE__*/
|
|
722
|
-
messageDesc(file_v1_plugin,
|
|
777
|
+
messageDesc(file_v1_plugin, 17);
|
|
723
778
|
|
|
724
779
|
/**
|
|
725
780
|
* GetSessionCatalogRequest asks a provider for request-scoped catalog
|
|
@@ -754,7 +809,7 @@ export type GetSessionCatalogRequest = Message<"gestalt.provider.v1.GetSessionCa
|
|
|
754
809
|
* Use `create(GetSessionCatalogRequestSchema)` to create a new message.
|
|
755
810
|
*/
|
|
756
811
|
export const GetSessionCatalogRequestSchema: GenMessage<GetSessionCatalogRequest> = /*@__PURE__*/
|
|
757
|
-
messageDesc(file_v1_plugin,
|
|
812
|
+
messageDesc(file_v1_plugin, 18);
|
|
758
813
|
|
|
759
814
|
/**
|
|
760
815
|
* GetSessionCatalogResponse returns request-scoped catalog extensions.
|
|
@@ -773,7 +828,7 @@ export type GetSessionCatalogResponse = Message<"gestalt.provider.v1.GetSessionC
|
|
|
773
828
|
* Use `create(GetSessionCatalogResponseSchema)` to create a new message.
|
|
774
829
|
*/
|
|
775
830
|
export const GetSessionCatalogResponseSchema: GenMessage<GetSessionCatalogResponse> = /*@__PURE__*/
|
|
776
|
-
messageDesc(file_v1_plugin,
|
|
831
|
+
messageDesc(file_v1_plugin, 19);
|
|
777
832
|
|
|
778
833
|
/**
|
|
779
834
|
* PostConnectRequest notifies a provider that a connection has completed.
|
|
@@ -792,7 +847,7 @@ export type PostConnectRequest = Message<"gestalt.provider.v1.PostConnectRequest
|
|
|
792
847
|
* Use `create(PostConnectRequestSchema)` to create a new message.
|
|
793
848
|
*/
|
|
794
849
|
export const PostConnectRequestSchema: GenMessage<PostConnectRequest> = /*@__PURE__*/
|
|
795
|
-
messageDesc(file_v1_plugin,
|
|
850
|
+
messageDesc(file_v1_plugin, 20);
|
|
796
851
|
|
|
797
852
|
/**
|
|
798
853
|
* PostConnectResponse returns provider-defined metadata captured after
|
|
@@ -812,7 +867,7 @@ export type PostConnectResponse = Message<"gestalt.provider.v1.PostConnectRespon
|
|
|
812
867
|
* Use `create(PostConnectResponseSchema)` to create a new message.
|
|
813
868
|
*/
|
|
814
869
|
export const PostConnectResponseSchema: GenMessage<PostConnectResponse> = /*@__PURE__*/
|
|
815
|
-
messageDesc(file_v1_plugin,
|
|
870
|
+
messageDesc(file_v1_plugin, 21);
|
|
816
871
|
|
|
817
872
|
/**
|
|
818
873
|
* StartProviderRequest configures an integration provider for one runtime
|
|
@@ -842,7 +897,7 @@ export type StartProviderRequest = Message<"gestalt.provider.v1.StartProviderReq
|
|
|
842
897
|
* Use `create(StartProviderRequestSchema)` to create a new message.
|
|
843
898
|
*/
|
|
844
899
|
export const StartProviderRequestSchema: GenMessage<StartProviderRequest> = /*@__PURE__*/
|
|
845
|
-
messageDesc(file_v1_plugin,
|
|
900
|
+
messageDesc(file_v1_plugin, 22);
|
|
846
901
|
|
|
847
902
|
/**
|
|
848
903
|
* StartProviderResponse confirms the protocol version the provider is serving.
|
|
@@ -861,7 +916,7 @@ export type StartProviderResponse = Message<"gestalt.provider.v1.StartProviderRe
|
|
|
861
916
|
* Use `create(StartProviderResponseSchema)` to create a new message.
|
|
862
917
|
*/
|
|
863
918
|
export const StartProviderResponseSchema: GenMessage<StartProviderResponse> = /*@__PURE__*/
|
|
864
|
-
messageDesc(file_v1_plugin,
|
|
919
|
+
messageDesc(file_v1_plugin, 23);
|
|
865
920
|
|
|
866
921
|
/**
|
|
867
922
|
* ConnectionMode describes which credential sources a provider accepts.
|
|
@@ -965,6 +1020,14 @@ export const PluginInvoker: GenService<{
|
|
|
965
1020
|
input: typeof PluginInvokeRequestSchema;
|
|
966
1021
|
output: typeof OperationResultSchema;
|
|
967
1022
|
},
|
|
1023
|
+
/**
|
|
1024
|
+
* @generated from rpc gestalt.provider.v1.PluginInvoker.InvokeGraphQL
|
|
1025
|
+
*/
|
|
1026
|
+
invokeGraphQL: {
|
|
1027
|
+
methodKind: "unary";
|
|
1028
|
+
input: typeof PluginInvokeGraphQLRequestSchema;
|
|
1029
|
+
output: typeof OperationResultSchema;
|
|
1030
|
+
},
|
|
968
1031
|
}> = /*@__PURE__*/
|
|
969
1032
|
serviceDesc(file_v1_plugin, 1);
|
|
970
1033
|
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -53,6 +53,21 @@ export {
|
|
|
53
53
|
type CatalogParameter,
|
|
54
54
|
type CatalogSchema,
|
|
55
55
|
} from "./catalog.ts";
|
|
56
|
+
export {
|
|
57
|
+
hasPluginManifestMetadata,
|
|
58
|
+
manifestMetadataToYaml,
|
|
59
|
+
writeManifestMetadataYaml,
|
|
60
|
+
type HTTPAck,
|
|
61
|
+
type HTTPAuthScheme,
|
|
62
|
+
type HTTPBinding,
|
|
63
|
+
type HTTPIn,
|
|
64
|
+
type HTTPMediaType,
|
|
65
|
+
type HTTPRequestBody,
|
|
66
|
+
type HTTPSecretRef,
|
|
67
|
+
type HTTPSecurityScheme,
|
|
68
|
+
type HTTPSecuritySchemeType,
|
|
69
|
+
type PluginManifestMetadata,
|
|
70
|
+
} from "./manifest-metadata.ts";
|
|
56
71
|
export {
|
|
57
72
|
buildProviderBinary,
|
|
58
73
|
bunBuildCommand,
|
|
@@ -62,6 +77,8 @@ export {
|
|
|
62
77
|
export {
|
|
63
78
|
ENV_PLUGIN_INVOKER_SOCKET,
|
|
64
79
|
PluginInvoker,
|
|
80
|
+
type PluginGraphQLInvokeOptions,
|
|
81
|
+
type PluginInvocationGrant,
|
|
65
82
|
type PluginInvokeOptions,
|
|
66
83
|
} from "./invoker.ts";
|
|
67
84
|
export {
|
|
@@ -146,6 +163,7 @@ export {
|
|
|
146
163
|
ENV_PROVIDER_PARENT_PID,
|
|
147
164
|
ENV_PROVIDER_SOCKET,
|
|
148
165
|
ENV_WRITE_CATALOG,
|
|
166
|
+
ENV_WRITE_MANIFEST_METADATA,
|
|
149
167
|
createAuthenticationService,
|
|
150
168
|
createCacheService,
|
|
151
169
|
createSecretsService,
|
package/src/invoker.ts
CHANGED
|
@@ -16,7 +16,13 @@ export interface PluginInvokeOptions {
|
|
|
16
16
|
|
|
17
17
|
export interface PluginInvocationGrant {
|
|
18
18
|
plugin: string;
|
|
19
|
-
operations
|
|
19
|
+
operations?: string[];
|
|
20
|
+
surfaces?: string[];
|
|
21
|
+
allOperations?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface PluginGraphQLInvokeOptions extends PluginInvokeOptions {
|
|
25
|
+
variables?: Record<string, unknown>;
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
export class PluginInvoker {
|
|
@@ -62,6 +68,32 @@ export class PluginInvoker {
|
|
|
62
68
|
};
|
|
63
69
|
}
|
|
64
70
|
|
|
71
|
+
async invokeGraphQL(
|
|
72
|
+
plugin: string,
|
|
73
|
+
document: string,
|
|
74
|
+
options?: PluginGraphQLInvokeOptions,
|
|
75
|
+
): Promise<OperationResult> {
|
|
76
|
+
const trimmedDocument = document.trim();
|
|
77
|
+
if (!trimmedDocument) {
|
|
78
|
+
throw new Error("plugin invoker: graphql document is required");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const response = await this.client.invokeGraphQL({
|
|
82
|
+
invocationToken: this.invocationToken,
|
|
83
|
+
plugin,
|
|
84
|
+
document: trimmedDocument,
|
|
85
|
+
...(options?.variables
|
|
86
|
+
? { variables: toJsonObject(options.variables) }
|
|
87
|
+
: {}),
|
|
88
|
+
connection: options?.connection ?? "",
|
|
89
|
+
instance: options?.instance ?? "",
|
|
90
|
+
});
|
|
91
|
+
return {
|
|
92
|
+
status: response.status,
|
|
93
|
+
body: response.body,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
65
97
|
async exchangeInvocationToken(options?: {
|
|
66
98
|
grants?: PluginInvocationGrant[];
|
|
67
99
|
ttlSeconds?: number;
|
|
@@ -71,9 +103,13 @@ export class PluginInvoker {
|
|
|
71
103
|
grants: (options?.grants ?? [])
|
|
72
104
|
.map((grant) => ({
|
|
73
105
|
plugin: grant.plugin.trim(),
|
|
74
|
-
operations: grant.operations
|
|
106
|
+
operations: (grant.operations ?? [])
|
|
75
107
|
.map((operation) => operation.trim())
|
|
76
108
|
.filter(Boolean),
|
|
109
|
+
surfaces: (grant.surfaces ?? [])
|
|
110
|
+
.map((surface) => surface.trim().toLowerCase())
|
|
111
|
+
.filter(Boolean),
|
|
112
|
+
allOperations: grant.allOperations ?? false,
|
|
77
113
|
}))
|
|
78
114
|
.filter((grant) => grant.plugin.length > 0),
|
|
79
115
|
ttlSeconds: BigInt(Math.max(0, options?.ttlSeconds ?? 0)),
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { writeFileSync } from "node:fs";
|
|
2
|
+
|
|
3
|
+
import YAML from "yaml";
|
|
4
|
+
|
|
5
|
+
export type HTTPSecuritySchemeType =
|
|
6
|
+
| "slack_signature"
|
|
7
|
+
| "apiKey"
|
|
8
|
+
| "http"
|
|
9
|
+
| "none";
|
|
10
|
+
|
|
11
|
+
export type HTTPIn = "header" | "query";
|
|
12
|
+
|
|
13
|
+
export type HTTPAuthScheme = "basic" | "bearer";
|
|
14
|
+
|
|
15
|
+
export interface HTTPSecretRef {
|
|
16
|
+
env?: string;
|
|
17
|
+
secret?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface HTTPSecurityScheme {
|
|
21
|
+
type?: HTTPSecuritySchemeType;
|
|
22
|
+
description?: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
in?: HTTPIn;
|
|
25
|
+
scheme?: HTTPAuthScheme;
|
|
26
|
+
secret?: HTTPSecretRef;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface HTTPMediaType {}
|
|
30
|
+
|
|
31
|
+
export interface HTTPRequestBody {
|
|
32
|
+
required?: boolean;
|
|
33
|
+
content?: Record<string, HTTPMediaType>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface HTTPAck {
|
|
37
|
+
status?: number;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
body?: any;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface HTTPBinding {
|
|
43
|
+
path: string;
|
|
44
|
+
method: string;
|
|
45
|
+
requestBody?: HTTPRequestBody;
|
|
46
|
+
security: string;
|
|
47
|
+
target: string;
|
|
48
|
+
ack?: HTTPAck;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface PluginManifestMetadata {
|
|
52
|
+
securitySchemes?: Record<string, HTTPSecurityScheme>;
|
|
53
|
+
http?: Record<string, HTTPBinding>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function hasPluginManifestMetadata(
|
|
57
|
+
metadata: PluginManifestMetadata | null | undefined,
|
|
58
|
+
): boolean {
|
|
59
|
+
return !!(
|
|
60
|
+
metadata &&
|
|
61
|
+
((metadata.securitySchemes &&
|
|
62
|
+
Object.keys(metadata.securitySchemes).length > 0) ||
|
|
63
|
+
(metadata.http && Object.keys(metadata.http).length > 0))
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function manifestMetadataToYaml(
|
|
68
|
+
metadata: PluginManifestMetadata | Record<string, unknown>,
|
|
69
|
+
): string {
|
|
70
|
+
return YAML.stringify(toManifestMetadataJsonObject(metadata));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function writeManifestMetadataYaml(
|
|
74
|
+
path: string,
|
|
75
|
+
metadata: PluginManifestMetadata | Record<string, unknown>,
|
|
76
|
+
): void {
|
|
77
|
+
writeFileSync(path, manifestMetadataToYaml(metadata), "utf8");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function toManifestMetadataJsonObject(
|
|
81
|
+
metadata: PluginManifestMetadata | Record<string, unknown>,
|
|
82
|
+
): Record<string, unknown> {
|
|
83
|
+
if (!("securitySchemes" in metadata) && !("http" in metadata)) {
|
|
84
|
+
return {
|
|
85
|
+
...metadata,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const typedMetadata = metadata as PluginManifestMetadata;
|
|
90
|
+
const output: Record<string, unknown> = {};
|
|
91
|
+
if (
|
|
92
|
+
typedMetadata.securitySchemes &&
|
|
93
|
+
Object.keys(typedMetadata.securitySchemes).length > 0
|
|
94
|
+
) {
|
|
95
|
+
output.securitySchemes = typedMetadata.securitySchemes;
|
|
96
|
+
}
|
|
97
|
+
if (typedMetadata.http && Object.keys(typedMetadata.http).length > 0) {
|
|
98
|
+
output.http = typedMetadata.http;
|
|
99
|
+
}
|
|
100
|
+
return output;
|
|
101
|
+
}
|
package/src/plugin.ts
CHANGED
|
@@ -7,6 +7,15 @@ import {
|
|
|
7
7
|
schemaToParameters,
|
|
8
8
|
writeCatalogYaml,
|
|
9
9
|
} from "./catalog.ts";
|
|
10
|
+
import {
|
|
11
|
+
type HTTPAck,
|
|
12
|
+
type HTTPBinding,
|
|
13
|
+
type HTTPRequestBody,
|
|
14
|
+
type HTTPSecurityScheme,
|
|
15
|
+
type PluginManifestMetadata,
|
|
16
|
+
hasPluginManifestMetadata,
|
|
17
|
+
writeManifestMetadataYaml,
|
|
18
|
+
} from "./manifest-metadata.ts";
|
|
10
19
|
import {
|
|
11
20
|
errorMessage,
|
|
12
21
|
type MaybePromise,
|
|
@@ -82,6 +91,8 @@ export interface PluginDefinitionOptions extends RuntimeProviderOptions {
|
|
|
82
91
|
connectionMode?: ConnectionMode;
|
|
83
92
|
authTypes?: string[];
|
|
84
93
|
connectionParams?: Record<string, ConnectionParamDefinition>;
|
|
94
|
+
securitySchemes?: Record<string, HTTPSecurityScheme>;
|
|
95
|
+
http?: Record<string, HTTPBinding>;
|
|
85
96
|
iconSvg?: string;
|
|
86
97
|
operations: Array<OperationDefinition<any, any>>;
|
|
87
98
|
sessionCatalog?: SessionCatalogHandler;
|
|
@@ -134,6 +145,8 @@ export class PluginProvider extends RuntimeProvider {
|
|
|
134
145
|
readonly connectionMode: ConnectionMode;
|
|
135
146
|
readonly authTypes: string[];
|
|
136
147
|
readonly connectionParams: Record<string, ConnectionParamDefinition>;
|
|
148
|
+
readonly securitySchemes: Record<string, HTTPSecurityScheme>;
|
|
149
|
+
readonly http: Record<string, HTTPBinding>;
|
|
137
150
|
|
|
138
151
|
private readonly sessionCatalogHandler: SessionCatalogHandler | undefined;
|
|
139
152
|
private readonly operations = new Map<string, OperationDefinition<any, any>>();
|
|
@@ -144,6 +157,8 @@ export class PluginProvider extends RuntimeProvider {
|
|
|
144
157
|
this.connectionMode = options.connectionMode ?? "unspecified";
|
|
145
158
|
this.authTypes = [...(options.authTypes ?? [])];
|
|
146
159
|
this.connectionParams = normalizeConnectionParams(options.connectionParams);
|
|
160
|
+
this.securitySchemes = normalizeHTTPSecuritySchemes(options.securitySchemes);
|
|
161
|
+
this.http = normalizeHTTPBindings(options.http);
|
|
147
162
|
this.sessionCatalogHandler = options.sessionCatalog;
|
|
148
163
|
|
|
149
164
|
for (const rawEntry of options.operations) {
|
|
@@ -255,6 +270,38 @@ export class PluginProvider extends RuntimeProvider {
|
|
|
255
270
|
return catalogToJson(this.staticCatalog());
|
|
256
271
|
}
|
|
257
272
|
|
|
273
|
+
/**
|
|
274
|
+
* Returns generated manifest-backed HTTP/security metadata for the provider.
|
|
275
|
+
*/
|
|
276
|
+
staticManifestMetadata(): PluginManifestMetadata {
|
|
277
|
+
const metadata: PluginManifestMetadata = {};
|
|
278
|
+
if (Object.keys(this.securitySchemes).length > 0) {
|
|
279
|
+
metadata.securitySchemes = cloneHTTPSecuritySchemes(this.securitySchemes);
|
|
280
|
+
}
|
|
281
|
+
if (Object.keys(this.http).length > 0) {
|
|
282
|
+
metadata.http = cloneHTTPBindings(this.http);
|
|
283
|
+
}
|
|
284
|
+
return metadata;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Reports whether the provider emits manifest metadata in addition to catalog metadata.
|
|
289
|
+
*/
|
|
290
|
+
supportsManifestMetadata(): boolean {
|
|
291
|
+
return hasPluginManifestMetadata(this.staticManifestMetadata());
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Writes generated manifest metadata to disk as YAML.
|
|
296
|
+
*/
|
|
297
|
+
writeManifestMetadata(path: string): void {
|
|
298
|
+
const metadata = this.staticManifestMetadata();
|
|
299
|
+
if (!hasPluginManifestMetadata(metadata)) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
writeManifestMetadataYaml(path, metadata);
|
|
303
|
+
}
|
|
304
|
+
|
|
258
305
|
/**
|
|
259
306
|
* Executes an operation against validated input and request metadata.
|
|
260
307
|
*/
|
|
@@ -349,6 +396,121 @@ function normalizeConnectionParams(
|
|
|
349
396
|
return output;
|
|
350
397
|
}
|
|
351
398
|
|
|
399
|
+
function normalizeHTTPSecuritySchemes(
|
|
400
|
+
input: Record<string, HTTPSecurityScheme> | undefined,
|
|
401
|
+
): Record<string, HTTPSecurityScheme> {
|
|
402
|
+
const output: Record<string, HTTPSecurityScheme> = {};
|
|
403
|
+
for (const [key, value] of Object.entries(input ?? {})) {
|
|
404
|
+
output[key] = cloneHTTPSecurityScheme(value);
|
|
405
|
+
}
|
|
406
|
+
return output;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function cloneHTTPSecuritySchemes(
|
|
410
|
+
input: Record<string, HTTPSecurityScheme>,
|
|
411
|
+
): Record<string, HTTPSecurityScheme> {
|
|
412
|
+
const output: Record<string, HTTPSecurityScheme> = {};
|
|
413
|
+
for (const [key, value] of Object.entries(input)) {
|
|
414
|
+
output[key] = cloneHTTPSecurityScheme(value);
|
|
415
|
+
}
|
|
416
|
+
return output;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function cloneHTTPSecurityScheme(value: HTTPSecurityScheme): HTTPSecurityScheme {
|
|
420
|
+
const output: HTTPSecurityScheme = {};
|
|
421
|
+
if (value.type !== undefined) {
|
|
422
|
+
output.type = value.type;
|
|
423
|
+
}
|
|
424
|
+
if (value.description !== undefined) {
|
|
425
|
+
output.description = value.description;
|
|
426
|
+
}
|
|
427
|
+
if (value.name !== undefined) {
|
|
428
|
+
output.name = value.name;
|
|
429
|
+
}
|
|
430
|
+
if (value.in !== undefined) {
|
|
431
|
+
output.in = value.in;
|
|
432
|
+
}
|
|
433
|
+
if (value.scheme !== undefined) {
|
|
434
|
+
output.scheme = value.scheme;
|
|
435
|
+
}
|
|
436
|
+
if (value.secret) {
|
|
437
|
+
output.secret = {
|
|
438
|
+
...value.secret,
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
return output;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
function normalizeHTTPBindings(
|
|
445
|
+
input: Record<string, HTTPBinding> | undefined,
|
|
446
|
+
): Record<string, HTTPBinding> {
|
|
447
|
+
const output: Record<string, HTTPBinding> = {};
|
|
448
|
+
for (const [key, value] of Object.entries(input ?? {})) {
|
|
449
|
+
output[key] = cloneHTTPBinding(value);
|
|
450
|
+
}
|
|
451
|
+
return output;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function cloneHTTPBindings(
|
|
455
|
+
input: Record<string, HTTPBinding>,
|
|
456
|
+
): Record<string, HTTPBinding> {
|
|
457
|
+
const output: Record<string, HTTPBinding> = {};
|
|
458
|
+
for (const [key, value] of Object.entries(input)) {
|
|
459
|
+
output[key] = cloneHTTPBinding(value);
|
|
460
|
+
}
|
|
461
|
+
return output;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
function cloneHTTPBinding(value: HTTPBinding): HTTPBinding {
|
|
465
|
+
const output: HTTPBinding = {
|
|
466
|
+
path: value.path,
|
|
467
|
+
method: value.method,
|
|
468
|
+
security: value.security,
|
|
469
|
+
target: value.target,
|
|
470
|
+
};
|
|
471
|
+
if (value.requestBody) {
|
|
472
|
+
output.requestBody = cloneHTTPRequestBody(value.requestBody);
|
|
473
|
+
}
|
|
474
|
+
if (value.ack) {
|
|
475
|
+
output.ack = cloneHTTPAck(value.ack);
|
|
476
|
+
}
|
|
477
|
+
return output;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function cloneHTTPRequestBody(value: HTTPRequestBody): HTTPRequestBody {
|
|
481
|
+
const output: HTTPRequestBody = {};
|
|
482
|
+
if (value.required !== undefined) {
|
|
483
|
+
output.required = value.required;
|
|
484
|
+
}
|
|
485
|
+
if (value.content) {
|
|
486
|
+
output.content = {};
|
|
487
|
+
for (const key of Object.keys(value.content)) {
|
|
488
|
+
output.content[key] = {};
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return output;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
function cloneHTTPAck(value: HTTPAck): HTTPAck {
|
|
495
|
+
const output: HTTPAck = {};
|
|
496
|
+
if (value.status !== undefined) {
|
|
497
|
+
output.status = value.status;
|
|
498
|
+
}
|
|
499
|
+
if (value.headers) {
|
|
500
|
+
output.headers = {
|
|
501
|
+
...value.headers,
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
if (value.body !== undefined) {
|
|
505
|
+
output.body = cloneHTTPBodyValue(value.body);
|
|
506
|
+
}
|
|
507
|
+
return output;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function cloneHTTPBodyValue<T>(value: T): T {
|
|
511
|
+
return structuredClone(value);
|
|
512
|
+
}
|
|
513
|
+
|
|
352
514
|
function isResponse(value: unknown): value is Response<unknown> {
|
|
353
515
|
if (typeof value !== "object" || value === null) {
|
|
354
516
|
return false;
|
package/src/runtime.ts
CHANGED
|
@@ -106,6 +106,11 @@ export const ENV_PROVIDER_PARENT_PID = "GESTALT_PLUGIN_PARENT_PID";
|
|
|
106
106
|
* Environment variable used to request static catalog generation.
|
|
107
107
|
*/
|
|
108
108
|
export const ENV_WRITE_CATALOG = "GESTALT_PLUGIN_WRITE_CATALOG";
|
|
109
|
+
/**
|
|
110
|
+
* Environment variable used to request generated manifest metadata export.
|
|
111
|
+
*/
|
|
112
|
+
export const ENV_WRITE_MANIFEST_METADATA =
|
|
113
|
+
"GESTALT_PLUGIN_WRITE_MANIFEST_METADATA";
|
|
109
114
|
/**
|
|
110
115
|
* Protocol version currently implemented by the TypeScript runtime.
|
|
111
116
|
*/
|
|
@@ -288,13 +293,19 @@ export async function runLoadedProvider(
|
|
|
288
293
|
}
|
|
289
294
|
|
|
290
295
|
const catalogPath = process.env[ENV_WRITE_CATALOG];
|
|
291
|
-
|
|
296
|
+
const manifestMetadataPath = process.env[ENV_WRITE_MANIFEST_METADATA];
|
|
297
|
+
if (catalogPath || manifestMetadataPath) {
|
|
292
298
|
if (!isPluginProvider(provider)) {
|
|
293
299
|
throw new Error(
|
|
294
|
-
"static catalog generation
|
|
300
|
+
"static catalog and manifest metadata generation are only supported for plugin providers",
|
|
295
301
|
);
|
|
296
302
|
}
|
|
297
|
-
|
|
303
|
+
if (catalogPath) {
|
|
304
|
+
writeFileSync(catalogPath, catalogToYaml(provider.staticCatalog()), "utf8");
|
|
305
|
+
}
|
|
306
|
+
if (manifestMetadataPath && provider.supportsManifestMetadata()) {
|
|
307
|
+
provider.writeManifestMetadata(manifestMetadataPath);
|
|
308
|
+
}
|
|
298
309
|
return;
|
|
299
310
|
}
|
|
300
311
|
|