@conduit-client/generator-ts 3.9.0 → 3.11.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/dist/types/v1/generators/aura-command-generator.d.ts +1 -0
- package/dist/types/v1/generators/aura-resource-cache-control-command-generator.d.ts +2 -1
- package/dist/types/v1/generators/base-command-generator.d.ts +19 -0
- package/dist/types/v1/generators/graphql-normalized-cache-control-generator-mixin.d.ts +1 -1
- package/dist/types/v1/generators/http-command-generator.d.ts +1 -0
- package/dist/types/v1/generators/normalized-cache-control-generator-mixin.d.ts +2 -1
- package/dist/v1/index.js +172 -12
- package/dist/v1/index.js.map +1 -1
- package/package.json +7 -7
|
@@ -11,6 +11,7 @@ import { HttpCommandGenerator } from './http-command-generator';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class AuraCommandGenerator extends HttpCommandGenerator {
|
|
13
13
|
commandBaseClass: ImportableTypeReference;
|
|
14
|
+
get commandGeneratedClass(): ImportableTypeReference;
|
|
14
15
|
/**
|
|
15
16
|
* Constructs and returns an array of code blocks that form the body of the Aura-specific command class.
|
|
16
17
|
* @returns {Code[]} An array of code snippets that define the command class body, tailored for Aura components.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AuraCommandGenerator } from './aura-command-generator';
|
|
2
|
-
import type { Code } from '../files';
|
|
2
|
+
import type { Code, ImportableTypeReference } from '../files';
|
|
3
3
|
/**
|
|
4
4
|
* Extends AuraCommandGenerator to add cache control strategies specific to resource caching in Aura components.
|
|
5
5
|
*
|
|
@@ -14,6 +14,7 @@ export declare class AuraResourceCacheControlCommandGenerator extends AuraComman
|
|
|
14
14
|
readonly exportedSymbol: "AuraResourceCacheControlCommand";
|
|
15
15
|
readonly isType: true;
|
|
16
16
|
};
|
|
17
|
+
get commandGeneratedClass(): ImportableTypeReference;
|
|
17
18
|
/**
|
|
18
19
|
* Generates a method to build cache control metadata based on the response type and cache strategy defined in the command model.
|
|
19
20
|
* Throws an error if the cache strategy is set to 'none'.
|
|
@@ -43,7 +43,14 @@ export declare abstract class CommandGenerator {
|
|
|
43
43
|
protected commandConfigTypeSymbol: symbol;
|
|
44
44
|
protected commandClassBodySymbol: symbol;
|
|
45
45
|
protected commandOptionsTypeSymbol: symbol;
|
|
46
|
+
protected commandBuildCommandClassReturnTypeSymbol: symbol;
|
|
47
|
+
protected commandBuildCommandClassReturnAssertionSymbol: symbol;
|
|
46
48
|
abstract get commandBaseClass(): ImportableTypeReference;
|
|
49
|
+
/**
|
|
50
|
+
* When set, the generated buildCommandClass is strongly typed to return this declare class type
|
|
51
|
+
* (e.g. GeneratedFetchNetworkCommand) and the return statement uses a type assertion.
|
|
52
|
+
*/
|
|
53
|
+
get commandGeneratedClass(): ImportableTypeReference | undefined;
|
|
47
54
|
get classBody(): Code[];
|
|
48
55
|
get commandTypeConstructorArgs(): Code;
|
|
49
56
|
get commandConstructorArgs(): Code;
|
|
@@ -77,6 +84,18 @@ export declare abstract class CommandGenerator {
|
|
|
77
84
|
protected buildCommandConfigType(): Code;
|
|
78
85
|
protected buildCommandConfigSchema(): Code;
|
|
79
86
|
protected buildCommandOptionsType(): Code;
|
|
87
|
+
/**
|
|
88
|
+
* Type arguments for the Generated class in the buildCommandClass return type.
|
|
89
|
+
* Default: same as buildCommandTypeGenerics(). Override (e.g. normalized cache control)
|
|
90
|
+
* to pass a full generic tuple so execute() and bindings are correctly typed.
|
|
91
|
+
*/
|
|
92
|
+
protected getBuildCommandClassReturnTypeGenerics(): Code;
|
|
93
|
+
/**
|
|
94
|
+
* Constructor parameter list for the buildCommandClass return type signature.
|
|
95
|
+
* Default: commandTypeConstructorArgs + ...args: CommandConstructorParams.
|
|
96
|
+
* Override (e.g. GraphQL) when the constructor has a fixed param list with no rest.
|
|
97
|
+
*/
|
|
98
|
+
protected getBuildCommandClassConstructorParams(): Code;
|
|
80
99
|
protected buildCommandTypeGenerics(): Code;
|
|
81
100
|
protected buildExtraServices(): Code | undefined;
|
|
82
101
|
protected generateAfterRequestHooks(): Code;
|
|
@@ -9,5 +9,5 @@ type Constructor = new (...args: any[]) => CommandGenerator & NormalizedCacheCon
|
|
|
9
9
|
* 2. Adding documentRootType parameter to constructor
|
|
10
10
|
* 3. Generating GraphQL-specific methods like buildRequestQuery
|
|
11
11
|
*/
|
|
12
|
-
export declare function GraphQLNormalizedCacheControlGeneratorMixin(Base: Constructor, commandBaseClass: ImportableTypeReference): Constructor;
|
|
12
|
+
export declare function GraphQLNormalizedCacheControlGeneratorMixin(Base: Constructor, commandBaseClass: ImportableTypeReference, commandGeneratedClass?: ImportableTypeReference): Constructor;
|
|
13
13
|
export {};
|
|
@@ -12,6 +12,7 @@ export declare const MEDIATYPE_APP_JSON = "application/json";
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class HttpCommandGenerator extends CommandGenerator {
|
|
14
14
|
commandBaseClass: ImportableTypeReference;
|
|
15
|
+
get commandGeneratedClass(): ImportableTypeReference;
|
|
15
16
|
/**
|
|
16
17
|
* Constructs and returns an array of code blocks that form the body of the HTTP command class.
|
|
17
18
|
* Includes methods for generating fetch parameters and error coercion logic.
|
|
@@ -9,7 +9,8 @@ type NormalizedCacheControlConstructor = new (...args: any[]) => CommandGenerato
|
|
|
9
9
|
*
|
|
10
10
|
* @param Base The base class to mix in the normalized code generation logic to
|
|
11
11
|
* @param commandBaseClass An importable refernce to the command base class to use in the generated code
|
|
12
|
+
* @param commandGeneratedClass Optional importable reference to the declare-block type for strong typing (e.g. GeneratedHttpNormalizedCacheControlCommand)
|
|
12
13
|
* @returns A new class with the normalized generation behavior mixed in
|
|
13
14
|
*/
|
|
14
|
-
export declare function NormalizedCacheControlGeneratorMixin(Base: Constructor, commandBaseClass: ImportableTypeReference): NormalizedCacheControlConstructor;
|
|
15
|
+
export declare function NormalizedCacheControlGeneratorMixin(Base: Constructor, commandBaseClass: ImportableTypeReference, commandGeneratedClass?: ImportableTypeReference): NormalizedCacheControlConstructor;
|
|
15
16
|
export {};
|
package/dist/v1/index.js
CHANGED
|
@@ -962,6 +962,11 @@ const BUILD_READ_WRITE_RESULT = {
|
|
|
962
962
|
exportedSymbol: "buildReadWriteResult",
|
|
963
963
|
isType: false
|
|
964
964
|
};
|
|
965
|
+
const READ_RESULT = {
|
|
966
|
+
module: "@conduit-client/type-normalization/v1",
|
|
967
|
+
exportedSymbol: "ReadResult",
|
|
968
|
+
isType: true
|
|
969
|
+
};
|
|
965
970
|
const DEEP_EQUALS = {
|
|
966
971
|
module: "@conduit-client/utils",
|
|
967
972
|
exportedSymbol: "deepEquals",
|
|
@@ -1121,7 +1126,7 @@ function generateUnidentifiableType(services, type, options) {
|
|
|
1121
1126
|
return ${BUILD_READ_WRITE_RESULT}<NormalizedReference, ${WRITE_ERRORS}>(normalized, errors)
|
|
1122
1127
|
}
|
|
1123
1128
|
|
|
1124
|
-
read(cache: ${READONLY_CACHE}, input: ${readInput}){
|
|
1129
|
+
read(cache: ${READONLY_CACHE}, input: ${readInput}): ${READ_RESULT}<Data>{
|
|
1125
1130
|
const errors: ${READ_ERRORS} = []
|
|
1126
1131
|
const denormalized = ${normalizationCode.denormalize}
|
|
1127
1132
|
return ${BUILD_READ_WRITE_RESULT}<Data, ${READ_ERRORS}>(denormalized, errors)
|
|
@@ -2146,6 +2151,19 @@ class CommandGenerator {
|
|
|
2146
2151
|
this.commandConfigTypeSymbol = Symbol.for("commandConfigType");
|
|
2147
2152
|
this.commandClassBodySymbol = Symbol.for("commandClassBody");
|
|
2148
2153
|
this.commandOptionsTypeSymbol = Symbol.for("commandOptionsType");
|
|
2154
|
+
this.commandBuildCommandClassReturnTypeSymbol = Symbol.for(
|
|
2155
|
+
"commandBuildCommandClassReturnType"
|
|
2156
|
+
);
|
|
2157
|
+
this.commandBuildCommandClassReturnAssertionSymbol = Symbol.for(
|
|
2158
|
+
"commandBuildCommandClassReturnAssertion"
|
|
2159
|
+
);
|
|
2160
|
+
}
|
|
2161
|
+
/**
|
|
2162
|
+
* When set, the generated buildCommandClass is strongly typed to return this declare class type
|
|
2163
|
+
* (e.g. GeneratedFetchNetworkCommand) and the return statement uses a type assertion.
|
|
2164
|
+
*/
|
|
2165
|
+
get commandGeneratedClass() {
|
|
2166
|
+
return void 0;
|
|
2149
2167
|
}
|
|
2150
2168
|
get classBody() {
|
|
2151
2169
|
return [];
|
|
@@ -2213,14 +2231,18 @@ class CommandGenerator {
|
|
|
2213
2231
|
code`>;`,
|
|
2214
2232
|
code`export type CommandConstructorParams=ConstructorParameters<CommandConstructorType>;`,
|
|
2215
2233
|
this.generateCommandType(),
|
|
2216
|
-
code`export function buildCommandClass(baseClass: CommandConstructorType):
|
|
2234
|
+
code`export function buildCommandClass(baseClass: CommandConstructorType): `,
|
|
2235
|
+
this.commandBuildCommandClassReturnTypeSymbol,
|
|
2236
|
+
code`{`,
|
|
2217
2237
|
code`return class extends baseClass{`,
|
|
2218
2238
|
this.generateConstructor(),
|
|
2219
2239
|
...this.classBody,
|
|
2220
2240
|
this.exposeSubscribeAndRefresh,
|
|
2221
2241
|
this.generateOperationType(),
|
|
2222
2242
|
this.generateAfterRequestHooks(),
|
|
2223
|
-
code`}
|
|
2243
|
+
code`}`,
|
|
2244
|
+
this.commandBuildCommandClassReturnAssertionSymbol,
|
|
2245
|
+
code`};`
|
|
2224
2246
|
];
|
|
2225
2247
|
}
|
|
2226
2248
|
/**
|
|
@@ -2235,6 +2257,18 @@ class CommandGenerator {
|
|
|
2235
2257
|
file.pushTo(this.commandOptionsTypeSymbol, this.buildCommandOptionsType());
|
|
2236
2258
|
file.pushTo(this.commandTypeGenericsSymbol, this.buildCommandTypeGenerics());
|
|
2237
2259
|
file.pushTo(this.commandClassBodySymbol, ...this.classBody);
|
|
2260
|
+
const generatedClass = this.commandGeneratedClass;
|
|
2261
|
+
if (generatedClass) {
|
|
2262
|
+
const constructorSignature = code`new (${this.getBuildCommandClassConstructorParams()}) => ${generatedClass}<${this.getBuildCommandClassReturnTypeGenerics()}>`;
|
|
2263
|
+
file.pushTo(this.commandBuildCommandClassReturnTypeSymbol, constructorSignature);
|
|
2264
|
+
file.pushTo(
|
|
2265
|
+
this.commandBuildCommandClassReturnAssertionSymbol,
|
|
2266
|
+
code` as unknown as ${constructorSignature}`
|
|
2267
|
+
);
|
|
2268
|
+
} else {
|
|
2269
|
+
file.pushTo(this.commandBuildCommandClassReturnTypeSymbol, code`Command`);
|
|
2270
|
+
file.pushTo(this.commandBuildCommandClassReturnAssertionSymbol, code``);
|
|
2271
|
+
}
|
|
2238
2272
|
}
|
|
2239
2273
|
buildCommandConfigType() {
|
|
2240
2274
|
return this.services.typeDefinition.build(this.commandModel.configType);
|
|
@@ -2246,6 +2280,22 @@ class CommandGenerator {
|
|
|
2246
2280
|
const commandName = this.commandModel.className;
|
|
2247
2281
|
return code`export type ${commandName}Options = ${ABORTABLE_COMMAND_OPTIONS};`;
|
|
2248
2282
|
}
|
|
2283
|
+
/**
|
|
2284
|
+
* Type arguments for the Generated class in the buildCommandClass return type.
|
|
2285
|
+
* Default: same as buildCommandTypeGenerics(). Override (e.g. normalized cache control)
|
|
2286
|
+
* to pass a full generic tuple so execute() and bindings are correctly typed.
|
|
2287
|
+
*/
|
|
2288
|
+
getBuildCommandClassReturnTypeGenerics() {
|
|
2289
|
+
return this.buildCommandTypeGenerics();
|
|
2290
|
+
}
|
|
2291
|
+
/**
|
|
2292
|
+
* Constructor parameter list for the buildCommandClass return type signature.
|
|
2293
|
+
* Default: commandTypeConstructorArgs + ...args: CommandConstructorParams.
|
|
2294
|
+
* Override (e.g. GraphQL) when the constructor has a fixed param list with no rest.
|
|
2295
|
+
*/
|
|
2296
|
+
getBuildCommandClassConstructorParams() {
|
|
2297
|
+
return code`${this.commandTypeConstructorArgs}, ...args: CommandConstructorParams`;
|
|
2298
|
+
}
|
|
2249
2299
|
buildCommandTypeGenerics() {
|
|
2250
2300
|
var _a;
|
|
2251
2301
|
const extraServicesCode = this.buildExtraServices();
|
|
@@ -2417,6 +2467,11 @@ const FETCH_COMMAND_BASE_CLASS = {
|
|
|
2417
2467
|
exportedSymbol: "FetchNetworkCommand",
|
|
2418
2468
|
isType: true
|
|
2419
2469
|
};
|
|
2470
|
+
const GENERATED_FETCH_NETWORK_COMMAND = {
|
|
2471
|
+
module: "@conduit-client/command-fetch-network/v1",
|
|
2472
|
+
exportedSymbol: "GeneratedFetchNetworkCommand",
|
|
2473
|
+
isType: true
|
|
2474
|
+
};
|
|
2420
2475
|
const FETCH_RESPONSE$1 = {
|
|
2421
2476
|
module: "@conduit-client/utils",
|
|
2422
2477
|
exportedSymbol: "FetchResponse",
|
|
@@ -2438,6 +2493,9 @@ class HttpCommandGenerator extends CommandGenerator {
|
|
|
2438
2493
|
super(...arguments);
|
|
2439
2494
|
this.commandBaseClass = FETCH_COMMAND_BASE_CLASS;
|
|
2440
2495
|
}
|
|
2496
|
+
get commandGeneratedClass() {
|
|
2497
|
+
return GENERATED_FETCH_NETWORK_COMMAND;
|
|
2498
|
+
}
|
|
2441
2499
|
/**
|
|
2442
2500
|
* Constructs and returns an array of code blocks that form the body of the HTTP command class.
|
|
2443
2501
|
* Includes methods for generating fetch parameters and error coercion logic.
|
|
@@ -2604,11 +2662,19 @@ const AURA_COMMAND_BASE_CLASS = {
|
|
|
2604
2662
|
exportedSymbol: "AuraNetworkCommand",
|
|
2605
2663
|
isType: true
|
|
2606
2664
|
};
|
|
2665
|
+
const GENERATED_AURA_NETWORK_COMMAND = {
|
|
2666
|
+
module: "@conduit-client/command-aura-network/v1",
|
|
2667
|
+
exportedSymbol: "GeneratedAuraNetworkCommand",
|
|
2668
|
+
isType: true
|
|
2669
|
+
};
|
|
2607
2670
|
class AuraCommandGenerator extends HttpCommandGenerator {
|
|
2608
2671
|
constructor() {
|
|
2609
2672
|
super(...arguments);
|
|
2610
2673
|
this.commandBaseClass = AURA_COMMAND_BASE_CLASS;
|
|
2611
2674
|
}
|
|
2675
|
+
get commandGeneratedClass() {
|
|
2676
|
+
return GENERATED_AURA_NETWORK_COMMAND;
|
|
2677
|
+
}
|
|
2612
2678
|
/**
|
|
2613
2679
|
* Constructs and returns an array of code blocks that form the body of the Aura-specific command class.
|
|
2614
2680
|
* @returns {Code[]} An array of code snippets that define the command class body, tailored for Aura components.
|
|
@@ -2709,11 +2775,19 @@ const AURA_CACHE_CONTROL_COMMAND_BASE_CLASS = {
|
|
|
2709
2775
|
exportedSymbol: "AuraResourceCacheControlCommand",
|
|
2710
2776
|
isType: true
|
|
2711
2777
|
};
|
|
2778
|
+
const GENERATED_AURA_RESOURCE_CACHE_CONTROL_COMMAND = {
|
|
2779
|
+
module: "@conduit-client/command-aura-resource-cache-control/v1",
|
|
2780
|
+
exportedSymbol: "GeneratedAuraResourceCacheControlCommand",
|
|
2781
|
+
isType: true
|
|
2782
|
+
};
|
|
2712
2783
|
class AuraResourceCacheControlCommandGenerator extends AuraCommandGenerator {
|
|
2713
2784
|
constructor() {
|
|
2714
2785
|
super(...arguments);
|
|
2715
2786
|
this.commandBaseClass = AURA_CACHE_CONTROL_COMMAND_BASE_CLASS;
|
|
2716
2787
|
}
|
|
2788
|
+
get commandGeneratedClass() {
|
|
2789
|
+
return GENERATED_AURA_RESOURCE_CACHE_CONTROL_COMMAND;
|
|
2790
|
+
}
|
|
2717
2791
|
/**
|
|
2718
2792
|
* Generates a method to build cache control metadata based on the response type and cache strategy defined in the command model.
|
|
2719
2793
|
* Throws an error if the cache strategy is set to 'none'.
|
|
@@ -3003,6 +3077,11 @@ const WIRE_ADAPTER_CONSTRUCTOR$1 = {
|
|
|
3003
3077
|
exportedSymbol: "WireAdapterConstructor",
|
|
3004
3078
|
isType: true
|
|
3005
3079
|
};
|
|
3080
|
+
const WIRE_ADAPTER_RESULT = {
|
|
3081
|
+
module: "@conduit-client/service-bindings-lwc/v1",
|
|
3082
|
+
exportedSymbol: "WireAdapterResult",
|
|
3083
|
+
isType: true
|
|
3084
|
+
};
|
|
3006
3085
|
const LWC_WIRE_BINDINGS = "lwcWireBindings";
|
|
3007
3086
|
class WireAdapterBindingGenerator {
|
|
3008
3087
|
constructor(services, commandModel, binding) {
|
|
@@ -3032,7 +3111,7 @@ class WireAdapterBindingGenerator {
|
|
|
3032
3111
|
);
|
|
3033
3112
|
}
|
|
3034
3113
|
buildDeclaration() {
|
|
3035
|
-
return code`export let ${this.binding.identifier}:${WIRE_ADAPTER_CONSTRUCTOR$1}<${this.commandConfigTypeImport}, ${this.responseTypeCode}
|
|
3114
|
+
return code`export let ${this.binding.identifier}:${WIRE_ADAPTER_CONSTRUCTOR$1}<${this.commandConfigTypeImport}, ${WIRE_ADAPTER_RESULT}<${this.responseTypeCode}>, {}>;`;
|
|
3036
3115
|
}
|
|
3037
3116
|
get localCommandConstructorName() {
|
|
3038
3117
|
return `${this.binding.identifier}_ctor`;
|
|
@@ -3140,6 +3219,11 @@ const WIRE_ADAPTER_CONSTRUCTOR = {
|
|
|
3140
3219
|
exportedSymbol: "WireAdapterConstructor",
|
|
3141
3220
|
isType: true
|
|
3142
3221
|
};
|
|
3222
|
+
const GRAPHQL_WIRE_ADAPTER_RESULT = {
|
|
3223
|
+
module: "@conduit-client/service-bindings-lwc/v1",
|
|
3224
|
+
exportedSymbol: "GraphQLWireAdapterResult",
|
|
3225
|
+
isType: true
|
|
3226
|
+
};
|
|
3143
3227
|
const GRAPHQL_WIRE_BINDINGS = "lwcGraphQLWireBindings";
|
|
3144
3228
|
class GraphQLWireAdapterBindingGenerator {
|
|
3145
3229
|
constructor(services, commandModel, binding) {
|
|
@@ -3169,7 +3253,7 @@ class GraphQLWireAdapterBindingGenerator {
|
|
|
3169
3253
|
);
|
|
3170
3254
|
}
|
|
3171
3255
|
buildDeclaration() {
|
|
3172
|
-
return code`export let ${this.binding.identifier}:${WIRE_ADAPTER_CONSTRUCTOR}<${this.commandConfigTypeImport}, ${
|
|
3256
|
+
return code`export let ${this.binding.identifier}:${WIRE_ADAPTER_CONSTRUCTOR}<${this.commandConfigTypeImport}, ${GRAPHQL_WIRE_ADAPTER_RESULT}, {}>;`;
|
|
3173
3257
|
}
|
|
3174
3258
|
get localCommandConstructorName() {
|
|
3175
3259
|
return `${this.binding.identifier}_ctor`;
|
|
@@ -3998,12 +4082,30 @@ const DATA_OF = {
|
|
|
3998
4082
|
exportedSymbol: "DataOf",
|
|
3999
4083
|
isType: true
|
|
4000
4084
|
};
|
|
4001
|
-
|
|
4085
|
+
const READ_INPUT_OF = {
|
|
4086
|
+
module: "@conduit-client/type-normalization/v1",
|
|
4087
|
+
exportedSymbol: "ReadInputOf",
|
|
4088
|
+
isType: true
|
|
4089
|
+
};
|
|
4090
|
+
const WRITE_RESPONSE_OF = {
|
|
4091
|
+
module: "@conduit-client/type-normalization/v1",
|
|
4092
|
+
exportedSymbol: "WriteResponseOf",
|
|
4093
|
+
isType: true
|
|
4094
|
+
};
|
|
4095
|
+
const WRITE_INPUT_OF = {
|
|
4096
|
+
module: "@conduit-client/type-normalization/v1",
|
|
4097
|
+
exportedSymbol: "WriteInputOf",
|
|
4098
|
+
isType: true
|
|
4099
|
+
};
|
|
4100
|
+
function NormalizedCacheControlGeneratorMixin(Base, commandBaseClass, commandGeneratedClass) {
|
|
4002
4101
|
return class NormalizedCacheControl extends Base {
|
|
4003
4102
|
constructor() {
|
|
4004
4103
|
super(...arguments);
|
|
4005
4104
|
this.commandBaseClass = commandBaseClass;
|
|
4006
4105
|
}
|
|
4106
|
+
get commandGeneratedClass() {
|
|
4107
|
+
return commandGeneratedClass;
|
|
4108
|
+
}
|
|
4007
4109
|
get commandTypeConstructorArgs() {
|
|
4008
4110
|
return code`config: Config, typeRegistry: ${this.services.typeRegistryGenerator.build()}`;
|
|
4009
4111
|
}
|
|
@@ -4015,6 +4117,22 @@ function NormalizedCacheControlGeneratorMixin(Base, commandBaseClass) {
|
|
|
4015
4117
|
const builtType = this.buildResponseType();
|
|
4016
4118
|
return code`${builtType.typeClassRef}${extraServicesCode ? code`, ${extraServicesCode}` : ""}`;
|
|
4017
4119
|
}
|
|
4120
|
+
/**
|
|
4121
|
+
* Pass all 7 type args to the Generated declare class so Data, ReadInput, etc. are
|
|
4122
|
+
* inferred and execute() / bindings match (e.g. GetCommand<Pet[], Config>).
|
|
4123
|
+
* Only override when commandGeneratedClass is set (HTTP/Aura normalized); when this
|
|
4124
|
+
* mixin is used without it (e.g. as base for GraphQL), we do not add the 7-tuple so
|
|
4125
|
+
* the GraphQL mixin's single-type override is used.
|
|
4126
|
+
*/
|
|
4127
|
+
getBuildCommandClassReturnTypeGenerics() {
|
|
4128
|
+
if (!commandGeneratedClass) {
|
|
4129
|
+
return super.getBuildCommandClassReturnTypeGenerics();
|
|
4130
|
+
}
|
|
4131
|
+
const builtType = this.buildResponseType();
|
|
4132
|
+
const extraServicesCode = this.buildExtraServices();
|
|
4133
|
+
const resultType = builtType.typeClassRef;
|
|
4134
|
+
return code`${resultType}, ${DATA_OF}<${resultType}>, ${DATA_OF}<${resultType}>, ${READ_INPUT_OF}<${resultType}>, ${WRITE_RESPONSE_OF}<${resultType}>, ${WRITE_INPUT_OF}<${resultType}>${extraServicesCode ? code`, ${extraServicesCode}` : code`, object`}`;
|
|
4135
|
+
}
|
|
4018
4136
|
get classBody() {
|
|
4019
4137
|
return [
|
|
4020
4138
|
...super.classBody,
|
|
@@ -4145,13 +4263,16 @@ const NAMED_FETCH_SERVICE$2 = {
|
|
|
4145
4263
|
exportedSymbol: "NamedFetchService",
|
|
4146
4264
|
isType: true
|
|
4147
4265
|
};
|
|
4148
|
-
function GraphQLNormalizedCacheControlGeneratorMixin(Base, commandBaseClass) {
|
|
4266
|
+
function GraphQLNormalizedCacheControlGeneratorMixin(Base, commandBaseClass, commandGeneratedClass) {
|
|
4149
4267
|
return class GraphQLNormalizedCacheControl extends Base {
|
|
4150
4268
|
constructor() {
|
|
4151
4269
|
super(...arguments);
|
|
4152
4270
|
this.commandBaseClass = commandBaseClass;
|
|
4153
4271
|
this.documentRootTypeSymbol = Symbol.for("documentRootType");
|
|
4154
4272
|
}
|
|
4273
|
+
get commandGeneratedClass() {
|
|
4274
|
+
return commandGeneratedClass;
|
|
4275
|
+
}
|
|
4155
4276
|
get template() {
|
|
4156
4277
|
return [
|
|
4157
4278
|
code`export type DocumentRootType = ${GRAPHQL_DOCUMENT_ROOT_TYPE_REPOSITORY}<${GRAPHQL_DATA$1}, ${GRAPHQL_DATA$1}>;`,
|
|
@@ -4167,6 +4288,18 @@ function GraphQLNormalizedCacheControlGeneratorMixin(Base, commandBaseClass) {
|
|
|
4167
4288
|
get commandTypeConstructorArgs() {
|
|
4168
4289
|
return code`config: Config, documentRootType: DocumentRootType, services: ${NAMED_CACHE_CONTROLLER_SERVICE} & ${NAMED_PUBSUB_SERVICE$3} & ${this.buildNetworkServicesCode()} & object`;
|
|
4169
4290
|
}
|
|
4291
|
+
/**
|
|
4292
|
+
* GraphQL command constructor has exactly 3 params; no rest. Avoids "Expected 6 arguments, but got 3".
|
|
4293
|
+
*/
|
|
4294
|
+
getBuildCommandClassConstructorParams() {
|
|
4295
|
+
return this.commandTypeConstructorArgs;
|
|
4296
|
+
}
|
|
4297
|
+
/**
|
|
4298
|
+
* GraphQL Generated class has only ExtraServices; use buildCommandTypeGenerics() (do not use 7-tuple from mixin).
|
|
4299
|
+
*/
|
|
4300
|
+
getBuildCommandClassReturnTypeGenerics() {
|
|
4301
|
+
return this.buildCommandTypeGenerics();
|
|
4302
|
+
}
|
|
4170
4303
|
get commandConstructorArgs() {
|
|
4171
4304
|
return code`protected config: Config, protected documentRootType: DocumentRootType, protected services: ${NAMED_CACHE_CONTROLLER_SERVICE} & ${NAMED_PUBSUB_SERVICE$3} & ${this.buildNetworkServicesCode()} & object`;
|
|
4172
4305
|
}
|
|
@@ -4230,9 +4363,12 @@ function GraphQLNormalizedCacheControlGeneratorMixin(Base, commandBaseClass) {
|
|
|
4230
4363
|
generateConstructor() {
|
|
4231
4364
|
return code`constructor(${this.commandConstructorArgs}){${this.commandConstructorBody}}`;
|
|
4232
4365
|
}
|
|
4366
|
+
/**
|
|
4367
|
+
* GraphQL command has a single type param (ExtraServices). Return one type, no leading comma.
|
|
4368
|
+
*/
|
|
4233
4369
|
buildCommandTypeGenerics() {
|
|
4234
4370
|
const extraServicesCode = this.buildExtraServices();
|
|
4235
|
-
return
|
|
4371
|
+
return extraServicesCode ? extraServicesCode : code`object`;
|
|
4236
4372
|
}
|
|
4237
4373
|
};
|
|
4238
4374
|
}
|
|
@@ -4241,13 +4377,19 @@ const HTTP_GRAPHQL_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS = {
|
|
|
4241
4377
|
exportedSymbol: "HttpGraphQLNormalizedCacheControlCommand",
|
|
4242
4378
|
isType: true
|
|
4243
4379
|
};
|
|
4380
|
+
const GENERATED_HTTP_GRAPHQL_NORMALIZED_CACHE_CONTROL_COMMAND = {
|
|
4381
|
+
module: "@conduit-client/command-http-graphql-normalized-cache-control/v1",
|
|
4382
|
+
exportedSymbol: "GeneratedHttpGraphQLNormalizedCacheControlCommand",
|
|
4383
|
+
isType: true
|
|
4384
|
+
};
|
|
4244
4385
|
const HttpNormalizedCacheControlCommandGenerator$1 = NormalizedCacheControlGeneratorMixin(
|
|
4245
4386
|
HttpCommandGenerator,
|
|
4246
4387
|
HTTP_GRAPHQL_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS
|
|
4247
4388
|
);
|
|
4248
4389
|
const HttpGraphQLNormalizedCacheControlCommandGenerator = GraphQLNormalizedCacheControlGeneratorMixin(
|
|
4249
4390
|
HttpNormalizedCacheControlCommandGenerator$1,
|
|
4250
|
-
HTTP_GRAPHQL_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS
|
|
4391
|
+
HTTP_GRAPHQL_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS,
|
|
4392
|
+
GENERATED_HTTP_GRAPHQL_NORMALIZED_CACHE_CONTROL_COMMAND
|
|
4251
4393
|
);
|
|
4252
4394
|
class BaseCommandModel {
|
|
4253
4395
|
constructor(operation) {
|
|
@@ -4658,18 +4800,30 @@ const AURA_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS = {
|
|
|
4658
4800
|
exportedSymbol: "AuraNormalizedCacheControlCommand",
|
|
4659
4801
|
isType: true
|
|
4660
4802
|
};
|
|
4803
|
+
const GENERATED_AURA_NORMALIZED_CACHE_CONTROL_COMMAND = {
|
|
4804
|
+
module: "@conduit-client/command-aura-normalized-cache-control/v1",
|
|
4805
|
+
exportedSymbol: "GeneratedAuraNormalizedCacheControlCommand",
|
|
4806
|
+
isType: true
|
|
4807
|
+
};
|
|
4661
4808
|
const AuraNormalizedCacheControlCommandGenerator$1 = NormalizedCacheControlGeneratorMixin(
|
|
4662
4809
|
AuraCommandGenerator,
|
|
4663
|
-
AURA_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS
|
|
4810
|
+
AURA_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS,
|
|
4811
|
+
GENERATED_AURA_NORMALIZED_CACHE_CONTROL_COMMAND
|
|
4664
4812
|
);
|
|
4665
4813
|
const HTTP_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS = {
|
|
4666
4814
|
module: "@conduit-client/command-http-normalized-cache-control/v1",
|
|
4667
4815
|
exportedSymbol: "HttpNormalizedCacheControlCommand",
|
|
4668
4816
|
isType: true
|
|
4669
4817
|
};
|
|
4818
|
+
const GENERATED_HTTP_NORMALIZED_CACHE_CONTROL_COMMAND = {
|
|
4819
|
+
module: "@conduit-client/command-http-normalized-cache-control/v1",
|
|
4820
|
+
exportedSymbol: "GeneratedHttpNormalizedCacheControlCommand",
|
|
4821
|
+
isType: true
|
|
4822
|
+
};
|
|
4670
4823
|
const HttpNormalizedCacheControlCommandGenerator = NormalizedCacheControlGeneratorMixin(
|
|
4671
4824
|
HttpCommandGenerator,
|
|
4672
|
-
HTTP_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS
|
|
4825
|
+
HTTP_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS,
|
|
4826
|
+
GENERATED_HTTP_NORMALIZED_CACHE_CONTROL_COMMAND
|
|
4673
4827
|
);
|
|
4674
4828
|
const HTTP_CACHE_CONTROL_COMMAND_BASE_CLASS_DESCRIPTOR = {
|
|
4675
4829
|
module: "@conduit-client/command-http-normalized-cache-control/v1",
|
|
@@ -11189,13 +11343,19 @@ const AURA_GRAPHQL_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS = {
|
|
|
11189
11343
|
exportedSymbol: "AuraGraphQLNormalizedCacheControlCommand",
|
|
11190
11344
|
isType: true
|
|
11191
11345
|
};
|
|
11346
|
+
const GENERATED_AURA_GRAPHQL_NORMALIZED_CACHE_CONTROL_COMMAND = {
|
|
11347
|
+
module: "@conduit-client/command-aura-graphql-normalized-cache-control/v1",
|
|
11348
|
+
exportedSymbol: "GeneratedAuraGraphQLNormalizedCacheControlCommand",
|
|
11349
|
+
isType: true
|
|
11350
|
+
};
|
|
11192
11351
|
const AuraNormalizedCacheControlCommandGenerator = NormalizedCacheControlGeneratorMixin(
|
|
11193
11352
|
AuraCommandGenerator,
|
|
11194
11353
|
AURA_GRAPHQL_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS
|
|
11195
11354
|
);
|
|
11196
11355
|
const AuraGraphQLNormalizedCacheControlCommandGenerator = GraphQLNormalizedCacheControlGeneratorMixin(
|
|
11197
11356
|
AuraNormalizedCacheControlCommandGenerator,
|
|
11198
|
-
AURA_GRAPHQL_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS
|
|
11357
|
+
AURA_GRAPHQL_NORMALIZED_CACHE_CONTROL_COMMAND_BASE_CLASS,
|
|
11358
|
+
GENERATED_AURA_GRAPHQL_NORMALIZED_CACHE_CONTROL_COMMAND
|
|
11199
11359
|
);
|
|
11200
11360
|
function defaultCommandModelFactory(operation) {
|
|
11201
11361
|
let commandModel;
|