@conduit-client/generator-ts 2.1.0 → 3.2.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.
|
@@ -33,6 +33,7 @@ export declare class BindingsGenerator {
|
|
|
33
33
|
protected adapterBindingsGeneratorFactory: typeof defaultAdapterBindingsGeneratorFactory;
|
|
34
34
|
constructor(services: NamedAPIService & NamedFileService & NamedTypeDefinitionService & NamedTypeRegistryGeneratorService & NamedGraphQLTypeRegistryGeneratorService, commandModels: ICommandModel[], adapterBindingsGeneratorFactory?: typeof defaultAdapterBindingsGeneratorFactory);
|
|
35
35
|
protected adapterDeclarationSymbol: symbol;
|
|
36
|
+
protected bindingsServicesDeclarationSymbol: symbol;
|
|
36
37
|
protected serviceRequirementsSymbol: symbol;
|
|
37
38
|
protected adapterInvocationSymbol: symbol;
|
|
38
39
|
protected typeRegistryInstantiationSymbol: symbol;
|
|
@@ -65,5 +66,14 @@ export declare class BindingsGenerator {
|
|
|
65
66
|
protected buildRequirements(): Code;
|
|
66
67
|
protected get hasRESTNormalization(): boolean;
|
|
67
68
|
protected get hasGraphQL(): boolean;
|
|
69
|
+
protected get hasWireBindings(): boolean;
|
|
68
70
|
protected get hasImperativeBindings(): boolean;
|
|
71
|
+
protected get hasDefaultImperativeBindings(): boolean;
|
|
72
|
+
protected get hasQueryImperativeBindings(): boolean;
|
|
73
|
+
protected get hasSubscribableImperativeBindings(): boolean;
|
|
74
|
+
protected get hasLegacyImperativeBindings(): boolean;
|
|
75
|
+
protected get hasGraphQLImperativeBindings(): boolean;
|
|
76
|
+
protected get hasGraphQLLegacyImperativeBindings(): boolean;
|
|
77
|
+
protected get hasGraphQLMutationBindings(): boolean;
|
|
78
|
+
protected get hasGraphQLWireBindings(): boolean;
|
|
69
79
|
}
|
package/dist/v1/index.js
CHANGED
|
@@ -2735,38 +2735,23 @@ class AuraResourceCacheControlCommandGenerator extends AuraCommandGenerator {
|
|
|
2735
2735
|
];
|
|
2736
2736
|
}
|
|
2737
2737
|
}
|
|
2738
|
-
const BUILD_ASYNC_IMPERATIVE_INVOKER = {
|
|
2739
|
-
module: "@conduit-client/lwc-bindings",
|
|
2740
|
-
exportedSymbol: "buildAsyncImperativeInvoker",
|
|
2741
|
-
isType: false
|
|
2742
|
-
};
|
|
2743
2738
|
const DEFAULT_IMPERATIVE_RETURN_SHAPE = {
|
|
2744
|
-
module: "@conduit-client/
|
|
2739
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
2745
2740
|
exportedSymbol: "DefaultImperativeResult",
|
|
2746
2741
|
isType: true
|
|
2747
2742
|
};
|
|
2748
2743
|
const QUERY_IMPERATIVE_RETURN_SHAPE = {
|
|
2749
|
-
module: "@conduit-client/
|
|
2744
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
2750
2745
|
exportedSymbol: "QueryImperativeResult",
|
|
2751
2746
|
isType: true
|
|
2752
2747
|
};
|
|
2753
|
-
const BUILD_ASYNC_IMPERATIVE_SUBSCRIBABLE_INVOKER = {
|
|
2754
|
-
module: "@conduit-client/lwc-bindings",
|
|
2755
|
-
exportedSymbol: "buildAsyncImperativeSubscribableInvoker",
|
|
2756
|
-
isType: false
|
|
2757
|
-
};
|
|
2758
|
-
const BUILD_ASYNC_QUERY_IMPERATIVE_INVOKER = {
|
|
2759
|
-
module: "@conduit-client/lwc-bindings",
|
|
2760
|
-
exportedSymbol: "buildAsyncQueryImperativeInvoker",
|
|
2761
|
-
isType: false
|
|
2762
|
-
};
|
|
2763
2748
|
const SUBSCRIBABLE_IMPERATIVE_RESULT = {
|
|
2764
|
-
module: "@conduit-client/
|
|
2749
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
2765
2750
|
exportedSymbol: "SubscribableImperativeResult",
|
|
2766
2751
|
isType: true
|
|
2767
2752
|
};
|
|
2768
2753
|
const SUBSCRIBABLE_REFRESHABLE_IMPERATIVE_RESULT = {
|
|
2769
|
-
module: "@conduit-client/
|
|
2754
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
2770
2755
|
exportedSymbol: "SubscribableRefreshableImperativeResult",
|
|
2771
2756
|
isType: true
|
|
2772
2757
|
};
|
|
@@ -2780,6 +2765,9 @@ const APPLY_DECORATORS$2 = {
|
|
|
2780
2765
|
exportedSymbol: "applyDecorators",
|
|
2781
2766
|
isType: false
|
|
2782
2767
|
};
|
|
2768
|
+
const DEFAULT_IMPERATIVE_BINDINGS = "defaultImperativeBindings";
|
|
2769
|
+
const SUBSCRIBABLE_IMPERATIVE_BINDINGS = "subscribableImperativeBindings";
|
|
2770
|
+
const QUERY_IMPERATIVE_BINDINGS = "queryImperativeBindings";
|
|
2783
2771
|
class ImperativeAdapterBindingGenerator {
|
|
2784
2772
|
constructor(services, commandModel, binding) {
|
|
2785
2773
|
this.services = services;
|
|
@@ -2838,12 +2826,12 @@ class ImperativeAdapterBindingGenerator {
|
|
|
2838
2826
|
}
|
|
2839
2827
|
get invoker() {
|
|
2840
2828
|
if (this.isSubscribable()) {
|
|
2841
|
-
return code
|
|
2829
|
+
return code`services.${SUBSCRIBABLE_IMPERATIVE_BINDINGS}.bind`;
|
|
2842
2830
|
}
|
|
2843
2831
|
if (this.commandModel.operationType === "query") {
|
|
2844
|
-
return code
|
|
2832
|
+
return code`services.${QUERY_IMPERATIVE_BINDINGS}.bind`;
|
|
2845
2833
|
}
|
|
2846
|
-
return code
|
|
2834
|
+
return code`services.${DEFAULT_IMPERATIVE_BINDINGS}.bind`;
|
|
2847
2835
|
}
|
|
2848
2836
|
get exposeRefresh() {
|
|
2849
2837
|
if (this.isSubscribable()) {
|
|
@@ -2870,13 +2858,8 @@ class ImperativeAdapterBindingGenerator {
|
|
|
2870
2858
|
},${this.exposeRefresh}) as ${this.bindingTypeCode};`;
|
|
2871
2859
|
}
|
|
2872
2860
|
}
|
|
2873
|
-
const BUILD_ASYNC_IMPERATIVE_LEGACY_INVOKER = {
|
|
2874
|
-
module: "@conduit-client/lwc-bindings",
|
|
2875
|
-
exportedSymbol: "buildAsyncImperativeLegacyInvoker",
|
|
2876
|
-
isType: false
|
|
2877
|
-
};
|
|
2878
2861
|
const LEGACY_IMPERATIVE_RETURN_SHAPE = {
|
|
2879
|
-
module: "@conduit-client/
|
|
2862
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
2880
2863
|
exportedSymbol: "LegacyImperativeShape",
|
|
2881
2864
|
isType: true
|
|
2882
2865
|
};
|
|
@@ -2885,6 +2868,7 @@ const JSON_SCHEMA_TYPE$3 = {
|
|
|
2885
2868
|
exportedSymbol: "JSONSchema",
|
|
2886
2869
|
isType: true
|
|
2887
2870
|
};
|
|
2871
|
+
const LEGACY_IMPERATIVE_BINDINGS = "legacyImperativeBindings";
|
|
2888
2872
|
class ImperativeAdapterLegacyBindingGenerator {
|
|
2889
2873
|
constructor(services, commandModel, binding) {
|
|
2890
2874
|
this.services = services;
|
|
@@ -2924,7 +2908,7 @@ class ImperativeAdapterLegacyBindingGenerator {
|
|
|
2924
2908
|
buildInvocation(servicesName = "services") {
|
|
2925
2909
|
const requiresTypeRegistry = this.commandModel.cacheStrategy.type === "normalized" || this.commandModel.invalidationConfigs.length > 0;
|
|
2926
2910
|
return code`const ${this.localCommandConstructorName} = services.instrumentCommand(${this.classBuilderImport}(${servicesName}.${this.commandModel.serviceDependencies.baseClass.localName}), '${this.commandModel.className}');
|
|
2927
|
-
${this.binding.identifier}
|
|
2911
|
+
${this.binding.identifier}=services.${LEGACY_IMPERATIVE_BINDINGS}.bind<${this.commandConfigTypeImport},${this.responseTypeCode}>(
|
|
2928
2912
|
({config,assertIsValid})=>{
|
|
2929
2913
|
const _:<T>(data:unknown,_:${JSON_SCHEMA_TYPE$3})=>asserts data is T=assertIsValid;
|
|
2930
2914
|
_<${this.commandConfigTypeImport}>(config,${this.commandConfigSchemaImport});
|
|
@@ -2934,13 +2918,8 @@ class ImperativeAdapterLegacyBindingGenerator {
|
|
|
2934
2918
|
}
|
|
2935
2919
|
const QUERY_TYPE_VARIABLE_NAME = "queryType";
|
|
2936
2920
|
const MUTATION_TYPE_VARIABLE_NAME = "mutationType";
|
|
2937
|
-
const BUILD_ASYNC_GRAPHQL_IMPERATIVE_LEGACY_INVOKER = {
|
|
2938
|
-
module: "@conduit-client/lwc-bindings",
|
|
2939
|
-
exportedSymbol: "buildAsyncGraphQLImperativeLegacyInvoker",
|
|
2940
|
-
isType: false
|
|
2941
|
-
};
|
|
2942
2921
|
const LEGACY_GRAPHQL_IMPERATIVE_RETURN_SHAPE = {
|
|
2943
|
-
module: "@conduit-client/
|
|
2922
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
2944
2923
|
exportedSymbol: "LegacyGraphQLImperativeShape",
|
|
2945
2924
|
isType: true
|
|
2946
2925
|
};
|
|
@@ -2949,6 +2928,7 @@ const JSON_SCHEMA_TYPE$2 = {
|
|
|
2949
2928
|
exportedSymbol: "JSONSchema",
|
|
2950
2929
|
isType: true
|
|
2951
2930
|
};
|
|
2931
|
+
const GRAPHQL_LEGACY_IMPERATIVE_BINDINGS = "graphQLLegacyImperativeBindings";
|
|
2952
2932
|
class GraphQLImperativeAdapterLegacyBindingGenerator {
|
|
2953
2933
|
constructor(services, commandModel, binding) {
|
|
2954
2934
|
this.services = services;
|
|
@@ -2987,7 +2967,7 @@ class GraphQLImperativeAdapterLegacyBindingGenerator {
|
|
|
2987
2967
|
}
|
|
2988
2968
|
buildInvocation(servicesName = "services") {
|
|
2989
2969
|
return code`const ${this.localCommandConstructorName} = services.instrumentCommand(${this.classBuilderImport}(${servicesName}.${this.commandModel.serviceDependencies.baseClass.localName}), '${this.commandModel.className}');
|
|
2990
|
-
${this.binding.identifier}
|
|
2970
|
+
${this.binding.identifier}=services.${GRAPHQL_LEGACY_IMPERATIVE_BINDINGS}.bind<${this.commandConfigTypeImport}>(
|
|
2991
2971
|
({config,assertIsValid})=>{
|
|
2992
2972
|
const _:<T>(data:unknown,_:${JSON_SCHEMA_TYPE$2})=>asserts data is T=assertIsValid;
|
|
2993
2973
|
_<${this.commandConfigTypeImport}>(config,${this.commandConfigSchemaImport});
|
|
@@ -2996,15 +2976,11 @@ class GraphQLImperativeAdapterLegacyBindingGenerator {
|
|
|
2996
2976
|
}
|
|
2997
2977
|
}
|
|
2998
2978
|
const WIRE_ADAPTER_CONSTRUCTOR$1 = {
|
|
2999
|
-
module: "@conduit-client/
|
|
2979
|
+
module: "@conduit-client/service-bindings-lwc/v1",
|
|
3000
2980
|
exportedSymbol: "WireAdapterConstructor",
|
|
3001
2981
|
isType: true
|
|
3002
2982
|
};
|
|
3003
|
-
const
|
|
3004
|
-
module: "@conduit-client/lwc-bindings",
|
|
3005
|
-
exportedSymbol: "CommandWireAdapterConstructor",
|
|
3006
|
-
isType: false
|
|
3007
|
-
};
|
|
2983
|
+
const LWC_WIRE_BINDINGS = "lwcWireBindings";
|
|
3008
2984
|
class WireAdapterBindingGenerator {
|
|
3009
2985
|
constructor(services, commandModel, binding) {
|
|
3010
2986
|
this.services = services;
|
|
@@ -3043,10 +3019,8 @@ class WireAdapterBindingGenerator {
|
|
|
3043
3019
|
}
|
|
3044
3020
|
buildInvocation(servicesName = "services") {
|
|
3045
3021
|
return code`const ${this.localCommandConstructorName} = services.instrumentCommand(${this.classBuilderImport}(${servicesName}.${this.commandModel.serviceDependencies.baseClass.localName}), '${this.commandModel.className}');
|
|
3046
|
-
${this.binding.identifier}=
|
|
3047
|
-
|
|
3048
|
-
exposeRefresh=${this.commandModel.exposeRefresh};
|
|
3049
|
-
getCommand(){return new ${this.localCommandConstructorName}(this.config!,${this.getTypeRegistryArgument()}${servicesName});}};`;
|
|
3022
|
+
${this.binding.identifier}=services.${LWC_WIRE_BINDINGS}.bind<${this.responseTypeCode}, ${this.commandConfigTypeImport}>(
|
|
3023
|
+
(config: ${this.commandConfigTypeImport}) => new ${this.localCommandConstructorName}(config!,${this.getTypeRegistryArgument()}${servicesName}),${this.commandConfigSchemaImport},${this.commandModel.exposeRefresh});`;
|
|
3050
3024
|
}
|
|
3051
3025
|
getTypeRegistryArgument() {
|
|
3052
3026
|
if (this.commandModel.cacheStrategy.type === "normalized" || this.commandModel.invalidationConfigs.length > 0) {
|
|
@@ -3055,13 +3029,8 @@ class WireAdapterBindingGenerator {
|
|
|
3055
3029
|
return code``;
|
|
3056
3030
|
}
|
|
3057
3031
|
}
|
|
3058
|
-
const BUILD_ASYNC_GRAPHQL_IMPERATIVE_INVOKER = {
|
|
3059
|
-
module: "@conduit-client/lwc-bindings",
|
|
3060
|
-
exportedSymbol: "buildAsyncGraphQLImperativeInvoker",
|
|
3061
|
-
isType: false
|
|
3062
|
-
};
|
|
3063
3032
|
const SUBSCRIBABLE_REFRESHABLE_GRAPHQL_IMPERATIVE_RESULT = {
|
|
3064
|
-
module: "@conduit-client/
|
|
3033
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3065
3034
|
exportedSymbol: "SubscribableRefreshableGraphQLImperativeResult",
|
|
3066
3035
|
isType: true
|
|
3067
3036
|
};
|
|
@@ -3075,6 +3044,7 @@ const APPLY_DECORATORS$1 = {
|
|
|
3075
3044
|
exportedSymbol: "applyDecorators",
|
|
3076
3045
|
isType: false
|
|
3077
3046
|
};
|
|
3047
|
+
const GRAPHQL_IMPERATIVE_BINDINGS = "graphQLImperativeBindings";
|
|
3078
3048
|
class GraphQLImperativeAdapterBindingGenerator {
|
|
3079
3049
|
constructor(services, commandModel, binding) {
|
|
3080
3050
|
this.services = services;
|
|
@@ -3117,7 +3087,7 @@ class GraphQLImperativeAdapterBindingGenerator {
|
|
|
3117
3087
|
return code`${SUBSCRIBABLE_REFRESHABLE_GRAPHQL_IMPERATIVE_RESULT}`;
|
|
3118
3088
|
}
|
|
3119
3089
|
get invoker() {
|
|
3120
|
-
return code
|
|
3090
|
+
return code`services.${GRAPHQL_IMPERATIVE_BINDINGS}.bind`;
|
|
3121
3091
|
}
|
|
3122
3092
|
get exposeRefresh() {
|
|
3123
3093
|
if (this.isSubscribable()) {
|
|
@@ -3143,15 +3113,11 @@ class GraphQLImperativeAdapterBindingGenerator {
|
|
|
3143
3113
|
}
|
|
3144
3114
|
}
|
|
3145
3115
|
const WIRE_ADAPTER_CONSTRUCTOR = {
|
|
3146
|
-
module: "@conduit-client/
|
|
3116
|
+
module: "@conduit-client/service-bindings-lwc/v1",
|
|
3147
3117
|
exportedSymbol: "WireAdapterConstructor",
|
|
3148
3118
|
isType: true
|
|
3149
3119
|
};
|
|
3150
|
-
const
|
|
3151
|
-
module: "@conduit-client/lwc-bindings",
|
|
3152
|
-
exportedSymbol: "GraphQLCommandWireAdapterConstructor",
|
|
3153
|
-
isType: false
|
|
3154
|
-
};
|
|
3120
|
+
const GRAPHQL_WIRE_BINDINGS = "lwcGraphQLWireBindings";
|
|
3155
3121
|
class GraphQLWireAdapterBindingGenerator {
|
|
3156
3122
|
constructor(services, commandModel, binding) {
|
|
3157
3123
|
this.services = services;
|
|
@@ -3190,19 +3156,11 @@ class GraphQLWireAdapterBindingGenerator {
|
|
|
3190
3156
|
}
|
|
3191
3157
|
buildInvocation(servicesName = "services") {
|
|
3192
3158
|
return code`const ${this.localCommandConstructorName} = services.instrumentCommand(${this.classBuilderImport}(${servicesName}.${this.commandModel.serviceDependencies.baseClass.localName}), '${this.commandModel.className}');
|
|
3193
|
-
${this.binding.identifier}=
|
|
3194
|
-
configSchema=${this.commandConfigSchemaImport};
|
|
3195
|
-
exposeRefresh=${this.commandModel.exposeRefresh};
|
|
3196
|
-
getCommand(){return new ${this.localCommandConstructorName}(this.config as any,${QUERY_TYPE_VARIABLE_NAME},${servicesName});}};`;
|
|
3159
|
+
${this.binding.identifier}=services.${GRAPHQL_WIRE_BINDINGS}.bind<${this.commandConfigTypeImport}>((config: ${this.commandConfigTypeImport}) => new ${this.localCommandConstructorName}(config,${QUERY_TYPE_VARIABLE_NAME},${servicesName}), ${this.commandConfigSchemaImport}, ${this.commandModel.exposeRefresh});`;
|
|
3197
3160
|
}
|
|
3198
3161
|
}
|
|
3199
|
-
const BUILD_ASYNC_GRAPHQL_MUTATION_INVOKER = {
|
|
3200
|
-
module: "@conduit-client/lwc-bindings",
|
|
3201
|
-
exportedSymbol: "buildAsyncGraphQLMutationInvoker",
|
|
3202
|
-
isType: false
|
|
3203
|
-
};
|
|
3204
3162
|
const GRAPHQL_MUTATION_RESULT = {
|
|
3205
|
-
module: "@conduit-client/
|
|
3163
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3206
3164
|
exportedSymbol: "GraphQLMutationResult",
|
|
3207
3165
|
isType: true
|
|
3208
3166
|
};
|
|
@@ -3216,6 +3174,7 @@ const APPLY_DECORATORS = {
|
|
|
3216
3174
|
exportedSymbol: "applyDecorators",
|
|
3217
3175
|
isType: false
|
|
3218
3176
|
};
|
|
3177
|
+
const GRAPHQL_MUTATION_BINDINGS = "graphQLMutationBindings";
|
|
3219
3178
|
class GraphQLMutationAdapterBindingGenerator {
|
|
3220
3179
|
constructor(services, commandModel, binding) {
|
|
3221
3180
|
this.services = services;
|
|
@@ -3258,7 +3217,7 @@ class GraphQLMutationAdapterBindingGenerator {
|
|
|
3258
3217
|
return code`${GRAPHQL_MUTATION_RESULT}`;
|
|
3259
3218
|
}
|
|
3260
3219
|
get invoker() {
|
|
3261
|
-
return code
|
|
3220
|
+
return code`services.${GRAPHQL_MUTATION_BINDINGS}.bind`;
|
|
3262
3221
|
}
|
|
3263
3222
|
buildInvocation(servicesName = "services") {
|
|
3264
3223
|
return code`const ${this.localCommandConstructorName} = services.instrumentCommand(${this.classBuilderImport}(${servicesName}.${this.commandModel.serviceDependencies.baseClass.localName}), '${this.commandModel.className}');
|
|
@@ -3328,6 +3287,96 @@ const NAMED_FETCH_NETWORK_COMMAND_SERVICE$1 = {
|
|
|
3328
3287
|
exportedSymbol: "NamedFetchNetworkCommandService",
|
|
3329
3288
|
isType: true
|
|
3330
3289
|
};
|
|
3290
|
+
const LWC_BINDINGS_SERVICE_DESCRIPTOR = {
|
|
3291
|
+
module: "@conduit-client/service-bindings-lwc/v1",
|
|
3292
|
+
exportedSymbol: "LWCWireBindingsServiceDescriptor",
|
|
3293
|
+
isType: true
|
|
3294
|
+
};
|
|
3295
|
+
const NAMED_LWC_BINDINGS_SERVICE = {
|
|
3296
|
+
module: "@conduit-client/service-bindings-lwc/v1",
|
|
3297
|
+
exportedSymbol: "NamedLWCWireBindingsService",
|
|
3298
|
+
isType: true
|
|
3299
|
+
};
|
|
3300
|
+
const LWC_GRAPHQL_BINDINGS_SERVICE_DESCRIPTOR = {
|
|
3301
|
+
module: "@conduit-client/service-bindings-lwc/v1",
|
|
3302
|
+
exportedSymbol: "LWCGraphQLWireBindingsServiceDescriptor",
|
|
3303
|
+
isType: true
|
|
3304
|
+
};
|
|
3305
|
+
const NAMED_LWC_GRAPHQL_BINDINGS_SERVICE = {
|
|
3306
|
+
module: "@conduit-client/service-bindings-lwc/v1",
|
|
3307
|
+
exportedSymbol: "NamedLWCGraphQLWireBindingsService",
|
|
3308
|
+
isType: true
|
|
3309
|
+
};
|
|
3310
|
+
const DEFAULT_IMPERATIVE_BINDINGS_SERVICE_DESCRIPTOR = {
|
|
3311
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3312
|
+
exportedSymbol: "DefaultImperativeBindingsServiceDescriptor",
|
|
3313
|
+
isType: true
|
|
3314
|
+
};
|
|
3315
|
+
const NAMED_DEFAULT_IMPERATIVE_BINDINGS_SERVICE = {
|
|
3316
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3317
|
+
exportedSymbol: "NamedDefaultImperativeBindingsService",
|
|
3318
|
+
isType: true
|
|
3319
|
+
};
|
|
3320
|
+
const QUERY_IMPERATIVE_BINDINGS_SERVICE_DESCRIPTOR = {
|
|
3321
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3322
|
+
exportedSymbol: "QueryImperativeBindingsServiceDescriptor",
|
|
3323
|
+
isType: true
|
|
3324
|
+
};
|
|
3325
|
+
const NAMED_QUERY_IMPERATIVE_BINDINGS_SERVICE = {
|
|
3326
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3327
|
+
exportedSymbol: "NamedQueryImperativeBindingsService",
|
|
3328
|
+
isType: true
|
|
3329
|
+
};
|
|
3330
|
+
const SUBSCRIBABLE_IMPERATIVE_BINDINGS_SERVICE_DESCRIPTOR = {
|
|
3331
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3332
|
+
exportedSymbol: "SubscribableImperativeBindingsServiceDescriptor",
|
|
3333
|
+
isType: true
|
|
3334
|
+
};
|
|
3335
|
+
const NAMED_SUBSCRIBABLE_IMPERATIVE_BINDINGS_SERVICE = {
|
|
3336
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3337
|
+
exportedSymbol: "NamedSubscribableImperativeBindingsService",
|
|
3338
|
+
isType: true
|
|
3339
|
+
};
|
|
3340
|
+
const LEGACY_IMPERATIVE_BINDINGS_SERVICE_DESCRIPTOR = {
|
|
3341
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3342
|
+
exportedSymbol: "LegacyImperativeBindingsServiceDescriptor",
|
|
3343
|
+
isType: true
|
|
3344
|
+
};
|
|
3345
|
+
const NAMED_LEGACY_IMPERATIVE_BINDINGS_SERVICE = {
|
|
3346
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3347
|
+
exportedSymbol: "NamedLegacyImperativeBindingsService",
|
|
3348
|
+
isType: true
|
|
3349
|
+
};
|
|
3350
|
+
const GRAPHQL_IMPERATIVE_BINDINGS_SERVICE_DESCRIPTOR = {
|
|
3351
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3352
|
+
exportedSymbol: "GraphQLImperativeBindingsServiceDescriptor",
|
|
3353
|
+
isType: true
|
|
3354
|
+
};
|
|
3355
|
+
const NAMED_GRAPHQL_IMPERATIVE_BINDINGS_SERVICE = {
|
|
3356
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3357
|
+
exportedSymbol: "NamedGraphQLImperativeBindingsService",
|
|
3358
|
+
isType: true
|
|
3359
|
+
};
|
|
3360
|
+
const GRAPHQL_LEGACY_IMPERATIVE_BINDINGS_SERVICE_DESCRIPTOR = {
|
|
3361
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3362
|
+
exportedSymbol: "GraphQLLegacyImperativeBindingsServiceDescriptor",
|
|
3363
|
+
isType: true
|
|
3364
|
+
};
|
|
3365
|
+
const NAMED_GRAPHQL_LEGACY_IMPERATIVE_BINDINGS_SERVICE = {
|
|
3366
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3367
|
+
exportedSymbol: "NamedGraphQLLegacyImperativeBindingsService",
|
|
3368
|
+
isType: true
|
|
3369
|
+
};
|
|
3370
|
+
const GRAPHQL_MUTATION_BINDINGS_SERVICE_DESCRIPTOR = {
|
|
3371
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3372
|
+
exportedSymbol: "GraphQLMutationBindingsServiceDescriptor",
|
|
3373
|
+
isType: true
|
|
3374
|
+
};
|
|
3375
|
+
const NAMED_GRAPHQL_MUTATION_BINDINGS_SERVICE = {
|
|
3376
|
+
module: "@conduit-client/service-bindings-imperative/v1",
|
|
3377
|
+
exportedSymbol: "NamedGraphQLMutationBindingsService",
|
|
3378
|
+
isType: true
|
|
3379
|
+
};
|
|
3331
3380
|
function defaultAdapterBindingsGeneratorFactory(services, model, binding) {
|
|
3332
3381
|
const restBindingGenerators = {
|
|
3333
3382
|
imperative: ImperativeAdapterBindingGenerator,
|
|
@@ -3359,6 +3408,7 @@ class BindingsGenerator {
|
|
|
3359
3408
|
this.commandModels = commandModels;
|
|
3360
3409
|
this.adapterBindingsGeneratorFactory = adapterBindingsGeneratorFactory;
|
|
3361
3410
|
this.adapterDeclarationSymbol = Symbol.for("adapterDeclarations");
|
|
3411
|
+
this.bindingsServicesDeclarationSymbol = Symbol.for("bindingsServicesDeclaration");
|
|
3362
3412
|
this.serviceRequirementsSymbol = Symbol.for("serviceRequirements");
|
|
3363
3413
|
this.adapterInvocationSymbol = Symbol.for("adapterInvocation");
|
|
3364
3414
|
this.typeRegistryInstantiationSymbol = Symbol.for("typeRegistryInstantiation");
|
|
@@ -3380,6 +3430,7 @@ class BindingsGenerator {
|
|
|
3380
3430
|
*/
|
|
3381
3431
|
get template() {
|
|
3382
3432
|
return [
|
|
3433
|
+
this.bindingsServicesDeclarationSymbol,
|
|
3383
3434
|
this.adapterDeclarationSymbol,
|
|
3384
3435
|
this.typeInvalidationDeclarationSymbol,
|
|
3385
3436
|
code`const serviceRequirements=`,
|
|
@@ -3431,6 +3482,87 @@ class BindingsGenerator {
|
|
|
3431
3482
|
serviceName: "fetchNetworkCommandBaseClass"
|
|
3432
3483
|
});
|
|
3433
3484
|
}
|
|
3485
|
+
if (this.hasDefaultImperativeBindings) {
|
|
3486
|
+
deps.push({
|
|
3487
|
+
version: "1.0",
|
|
3488
|
+
descriptor: DEFAULT_IMPERATIVE_BINDINGS_SERVICE_DESCRIPTOR,
|
|
3489
|
+
namedService: NAMED_DEFAULT_IMPERATIVE_BINDINGS_SERVICE,
|
|
3490
|
+
localName: "defaultImperativeBindings",
|
|
3491
|
+
serviceName: "defaultImperativeBindings"
|
|
3492
|
+
});
|
|
3493
|
+
}
|
|
3494
|
+
if (this.hasQueryImperativeBindings) {
|
|
3495
|
+
deps.push({
|
|
3496
|
+
version: "1.0",
|
|
3497
|
+
descriptor: QUERY_IMPERATIVE_BINDINGS_SERVICE_DESCRIPTOR,
|
|
3498
|
+
namedService: NAMED_QUERY_IMPERATIVE_BINDINGS_SERVICE,
|
|
3499
|
+
localName: "queryImperativeBindings",
|
|
3500
|
+
serviceName: "queryImperativeBindings"
|
|
3501
|
+
});
|
|
3502
|
+
}
|
|
3503
|
+
if (this.hasSubscribableImperativeBindings) {
|
|
3504
|
+
deps.push({
|
|
3505
|
+
version: "1.0",
|
|
3506
|
+
descriptor: SUBSCRIBABLE_IMPERATIVE_BINDINGS_SERVICE_DESCRIPTOR,
|
|
3507
|
+
namedService: NAMED_SUBSCRIBABLE_IMPERATIVE_BINDINGS_SERVICE,
|
|
3508
|
+
localName: "subscribableImperativeBindings",
|
|
3509
|
+
serviceName: "subscribableImperativeBindings"
|
|
3510
|
+
});
|
|
3511
|
+
}
|
|
3512
|
+
if (this.hasLegacyImperativeBindings) {
|
|
3513
|
+
deps.push({
|
|
3514
|
+
version: "1.0",
|
|
3515
|
+
descriptor: LEGACY_IMPERATIVE_BINDINGS_SERVICE_DESCRIPTOR,
|
|
3516
|
+
namedService: NAMED_LEGACY_IMPERATIVE_BINDINGS_SERVICE,
|
|
3517
|
+
localName: "legacyImperativeBindings",
|
|
3518
|
+
serviceName: "legacyImperativeBindings"
|
|
3519
|
+
});
|
|
3520
|
+
}
|
|
3521
|
+
if (this.hasGraphQLImperativeBindings) {
|
|
3522
|
+
deps.push({
|
|
3523
|
+
version: "1.0",
|
|
3524
|
+
descriptor: GRAPHQL_IMPERATIVE_BINDINGS_SERVICE_DESCRIPTOR,
|
|
3525
|
+
namedService: NAMED_GRAPHQL_IMPERATIVE_BINDINGS_SERVICE,
|
|
3526
|
+
localName: "graphQLImperativeBindings",
|
|
3527
|
+
serviceName: "graphQLImperativeBindings"
|
|
3528
|
+
});
|
|
3529
|
+
}
|
|
3530
|
+
if (this.hasGraphQLLegacyImperativeBindings) {
|
|
3531
|
+
deps.push({
|
|
3532
|
+
version: "1.0",
|
|
3533
|
+
descriptor: GRAPHQL_LEGACY_IMPERATIVE_BINDINGS_SERVICE_DESCRIPTOR,
|
|
3534
|
+
namedService: NAMED_GRAPHQL_LEGACY_IMPERATIVE_BINDINGS_SERVICE,
|
|
3535
|
+
localName: "graphQLLegacyImperativeBindings",
|
|
3536
|
+
serviceName: "graphQLLegacyImperativeBindings"
|
|
3537
|
+
});
|
|
3538
|
+
}
|
|
3539
|
+
if (this.hasGraphQLMutationBindings) {
|
|
3540
|
+
deps.push({
|
|
3541
|
+
version: "1.0",
|
|
3542
|
+
descriptor: GRAPHQL_MUTATION_BINDINGS_SERVICE_DESCRIPTOR,
|
|
3543
|
+
namedService: NAMED_GRAPHQL_MUTATION_BINDINGS_SERVICE,
|
|
3544
|
+
localName: "graphQLMutationBindings",
|
|
3545
|
+
serviceName: "graphQLMutationBindings"
|
|
3546
|
+
});
|
|
3547
|
+
}
|
|
3548
|
+
if (this.hasWireBindings) {
|
|
3549
|
+
deps.push({
|
|
3550
|
+
version: "1.0",
|
|
3551
|
+
descriptor: LWC_BINDINGS_SERVICE_DESCRIPTOR,
|
|
3552
|
+
namedService: NAMED_LWC_BINDINGS_SERVICE,
|
|
3553
|
+
localName: "lwcWireBindings",
|
|
3554
|
+
serviceName: "lwcWireBindings"
|
|
3555
|
+
});
|
|
3556
|
+
}
|
|
3557
|
+
if (this.hasGraphQLWireBindings) {
|
|
3558
|
+
deps.push({
|
|
3559
|
+
version: "1.0",
|
|
3560
|
+
descriptor: LWC_GRAPHQL_BINDINGS_SERVICE_DESCRIPTOR,
|
|
3561
|
+
namedService: NAMED_LWC_GRAPHQL_BINDINGS_SERVICE,
|
|
3562
|
+
localName: "lwcGraphQLWireBindings",
|
|
3563
|
+
serviceName: "lwcGraphQLWireBindings"
|
|
3564
|
+
});
|
|
3565
|
+
}
|
|
3434
3566
|
return deps;
|
|
3435
3567
|
}
|
|
3436
3568
|
/**
|
|
@@ -3438,7 +3570,7 @@ class BindingsGenerator {
|
|
|
3438
3570
|
* This method coordinates with individual binding generators to compile the necessary elements into a single file.
|
|
3439
3571
|
*/
|
|
3440
3572
|
build() {
|
|
3441
|
-
const filename = "artifacts/
|
|
3573
|
+
const filename = "artifacts/bindings.ts";
|
|
3442
3574
|
const file = this.services.file.build(filename);
|
|
3443
3575
|
file.template = this.template;
|
|
3444
3576
|
if (this.hasRESTNormalization) {
|
|
@@ -3628,10 +3760,69 @@ class BindingsGenerator {
|
|
|
3628
3760
|
get hasGraphQL() {
|
|
3629
3761
|
return this.commandModels.some((model) => model.operationType === "graphql");
|
|
3630
3762
|
}
|
|
3763
|
+
get hasWireBindings() {
|
|
3764
|
+
return this.commandModels.some(
|
|
3765
|
+
(model) => model.bindings.some((binding) => binding.type === "wire")
|
|
3766
|
+
);
|
|
3767
|
+
}
|
|
3631
3768
|
get hasImperativeBindings() {
|
|
3632
3769
|
return this.commandModels.some(
|
|
3633
3770
|
(model) => model.bindings.some(
|
|
3634
|
-
(binding) => binding.type === "imperative" || binding.type
|
|
3771
|
+
(binding) => binding.type === "imperative" || binding.type === "mutation"
|
|
3772
|
+
)
|
|
3773
|
+
);
|
|
3774
|
+
}
|
|
3775
|
+
get hasDefaultImperativeBindings() {
|
|
3776
|
+
return this.commandModels.some(
|
|
3777
|
+
(model) => model.bindings.some(
|
|
3778
|
+
(binding) => binding.type === "imperative" && model.operationType !== "query" && model.operationType !== "graphql"
|
|
3779
|
+
)
|
|
3780
|
+
);
|
|
3781
|
+
}
|
|
3782
|
+
get hasQueryImperativeBindings() {
|
|
3783
|
+
return this.commandModels.some(
|
|
3784
|
+
(model) => model.bindings.some(
|
|
3785
|
+
(binding) => binding.type === "imperative" && model.operationType === "query"
|
|
3786
|
+
)
|
|
3787
|
+
);
|
|
3788
|
+
}
|
|
3789
|
+
get hasSubscribableImperativeBindings() {
|
|
3790
|
+
return this.commandModels.some(
|
|
3791
|
+
(model) => model.bindings.some(
|
|
3792
|
+
(binding) => binding.type === "imperative" && model.operationType === "query" && model.cacheStrategy.type !== "none"
|
|
3793
|
+
)
|
|
3794
|
+
);
|
|
3795
|
+
}
|
|
3796
|
+
get hasLegacyImperativeBindings() {
|
|
3797
|
+
return this.commandModels.some(
|
|
3798
|
+
(model) => model.bindings.some((binding) => binding.type === "imperative-legacy")
|
|
3799
|
+
);
|
|
3800
|
+
}
|
|
3801
|
+
get hasGraphQLImperativeBindings() {
|
|
3802
|
+
return this.commandModels.some(
|
|
3803
|
+
(model) => model.bindings.some(
|
|
3804
|
+
(binding) => binding.type === "imperative" && model.operationType === "graphql"
|
|
3805
|
+
)
|
|
3806
|
+
);
|
|
3807
|
+
}
|
|
3808
|
+
get hasGraphQLLegacyImperativeBindings() {
|
|
3809
|
+
return this.commandModels.some(
|
|
3810
|
+
(model) => model.bindings.some(
|
|
3811
|
+
(binding) => binding.type === "imperative-legacy" && model.operationType === "graphql"
|
|
3812
|
+
)
|
|
3813
|
+
);
|
|
3814
|
+
}
|
|
3815
|
+
get hasGraphQLMutationBindings() {
|
|
3816
|
+
return this.commandModels.some(
|
|
3817
|
+
(model) => model.bindings.some(
|
|
3818
|
+
(binding) => binding.type === "mutation" && model.operationType === "graphql"
|
|
3819
|
+
)
|
|
3820
|
+
);
|
|
3821
|
+
}
|
|
3822
|
+
get hasGraphQLWireBindings() {
|
|
3823
|
+
return this.commandModels.some(
|
|
3824
|
+
(model) => model.bindings.some(
|
|
3825
|
+
(binding) => binding.type === "wire" && model.operationType === "graphql"
|
|
3635
3826
|
)
|
|
3636
3827
|
);
|
|
3637
3828
|
}
|