@azure-tools/typespec-ts 0.18.0 → 0.19.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/CHANGELOG.md +8 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +36 -20
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +4 -1
- package/dist/src/lib.js.map +1 -1
- package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalClient.js +50 -51
- package/dist/src/modular/buildClassicalClient.js.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.d.ts +4 -0
- package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +1 -0
- package/dist/src/modular/buildClassicalOperationGroups.js +79 -0
- package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -0
- package/dist/src/modular/buildClientContext.d.ts.map +1 -1
- package/dist/src/modular/buildClientContext.js +3 -2
- package/dist/src/modular/buildClientContext.js.map +1 -1
- package/dist/src/modular/buildCodeModel.d.ts.map +1 -1
- package/dist/src/modular/buildCodeModel.js +69 -23
- package/dist/src/modular/buildCodeModel.js.map +1 -1
- package/dist/src/modular/buildOperations.d.ts +1 -1
- package/dist/src/modular/buildOperations.d.ts.map +1 -1
- package/dist/src/modular/buildOperations.js +21 -13
- package/dist/src/modular/buildOperations.js.map +1 -1
- package/dist/src/modular/buildProjectFiles.d.ts.map +1 -1
- package/dist/src/modular/buildProjectFiles.js +183 -73
- package/dist/src/modular/buildProjectFiles.js.map +1 -1
- package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
- package/dist/src/modular/buildRootIndex.js +7 -5
- package/dist/src/modular/buildRootIndex.js.map +1 -1
- package/dist/src/modular/buildSubpathIndex.d.ts +5 -1
- package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
- package/dist/src/modular/buildSubpathIndex.js +32 -4
- package/dist/src/modular/buildSubpathIndex.js.map +1 -1
- package/dist/src/modular/emitModels.d.ts.map +1 -1
- package/dist/src/modular/emitModels.js +3 -2
- package/dist/src/modular/emitModels.js.map +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +4 -0
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/classicalOperationHelpers.js +127 -0
- package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -0
- package/dist/src/modular/helpers/clientHelpers.d.ts +2 -1
- package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.js +3 -2
- package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts +2 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.js +14 -0
- package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.d.ts +4 -3
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.js +63 -48
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
- package/dist/src/modular/modularCodeModel.d.ts +4 -0
- package/dist/src/modular/modularCodeModel.d.ts.map +1 -1
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +7 -5
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transformParameters.d.ts +2 -2
- package/dist/src/transform/transformParameters.d.ts.map +1 -1
- package/dist/src/transform/transformParameters.js +2 -2
- package/dist/src/transform/transformParameters.js.map +1 -1
- package/dist/src/transform/transformResponses.d.ts +2 -2
- package/dist/src/transform/transformResponses.d.ts.map +1 -1
- package/dist/src/transform/transformResponses.js +2 -2
- package/dist/src/transform/transformResponses.js.map +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
- package/dist/src/transform/transfromRLCOptions.js +30 -4
- package/dist/src/transform/transfromRLCOptions.js.map +1 -1
- package/dist/src/utils/emitUtil.d.ts.map +1 -1
- package/dist/src/utils/emitUtil.js +12 -5
- package/dist/src/utils/emitUtil.js.map +1 -1
- package/dist/src/utils/modelUtils.d.ts.map +1 -1
- package/dist/src/utils/modelUtils.js +17 -9
- package/dist/src/utils/modelUtils.js.map +1 -1
- package/dist/src/utils/namespaceUtils.d.ts +6 -0
- package/dist/src/utils/namespaceUtils.d.ts.map +1 -0
- package/dist/src/utils/namespaceUtils.js +54 -0
- package/dist/src/utils/namespaceUtils.js.map +1 -0
- package/dist/src/utils/operationUtil.d.ts.map +1 -1
- package/dist/src/utils/operationUtil.js +9 -13
- package/dist/src/utils/operationUtil.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -4
- package/src/index.ts +29 -12
- package/src/lib.ts +4 -1
- package/src/modular/buildClassicalClient.ts +90 -69
- package/src/modular/buildClassicalOperationGroups.ts +151 -0
- package/src/modular/buildClientContext.ts +3 -2
- package/src/modular/buildCodeModel.ts +82 -18
- package/src/modular/buildOperations.ts +41 -16
- package/src/modular/buildProjectFiles.ts +224 -87
- package/src/modular/buildRootIndex.ts +34 -5
- package/src/modular/buildSubpathIndex.ts +41 -6
- package/src/modular/emitModels.ts +9 -2
- package/src/modular/helpers/classicalOperationHelpers.ts +212 -0
- package/src/modular/helpers/clientHelpers.ts +7 -2
- package/src/modular/helpers/namingHelpers.ts +25 -1
- package/src/modular/helpers/operationHelpers.ts +101 -46
- package/src/modular/modularCodeModel.ts +4 -0
- package/src/transform/transform.ts +10 -6
- package/src/transform/transformParameters.ts +3 -3
- package/src/transform/transformResponses.ts +4 -4
- package/src/transform/transfromRLCOptions.ts +43 -4
- package/src/utils/emitUtil.ts +10 -4
- package/src/utils/modelUtils.ts +11 -1
- package/src/utils/namespaceUtils.ts +74 -0
- package/src/utils/operationUtil.ts +10 -19
- package/dist/src/modular/helpers/credentialHelpers.d.ts +0 -7
- package/dist/src/modular/helpers/credentialHelpers.d.ts.map +0 -1
- package/dist/src/modular/helpers/credentialHelpers.js +0 -32
- package/dist/src/modular/helpers/credentialHelpers.js.map +0 -1
- package/src/modular/helpers/credentialHelpers.ts +0 -40
package/src/utils/emitUtil.ts
CHANGED
|
@@ -8,13 +8,14 @@ import { prettierJSONOptions, prettierTypeScriptOptions } from "../lib.js";
|
|
|
8
8
|
|
|
9
9
|
export async function emitModels(rlcModels: RLCModel, program: Program) {
|
|
10
10
|
const schemaOutput = buildSchemaTypes(rlcModels);
|
|
11
|
+
const isBranded = rlcModels?.options?.branded ?? true;
|
|
11
12
|
if (schemaOutput) {
|
|
12
13
|
const { inputModelFile, outputModelFile } = schemaOutput;
|
|
13
14
|
if (inputModelFile) {
|
|
14
|
-
await emitFile(inputModelFile, program);
|
|
15
|
+
await emitFile(inputModelFile, program, isBranded);
|
|
15
16
|
}
|
|
16
17
|
if (outputModelFile) {
|
|
17
|
-
await emitFile(outputModelFile, program);
|
|
18
|
+
await emitFile(outputModelFile, program, isBranded);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
}
|
|
@@ -28,6 +29,7 @@ export async function emitContentByBuilder(
|
|
|
28
29
|
if (!Array.isArray(builderFnOrList)) {
|
|
29
30
|
builderFnOrList = [builderFnOrList];
|
|
30
31
|
}
|
|
32
|
+
const isBranded = rlcModels?.options?.branded ?? true;
|
|
31
33
|
for (const builderFn of builderFnOrList) {
|
|
32
34
|
let contentFiles: File[] | File | undefined = builderFn(rlcModels);
|
|
33
35
|
if (!contentFiles) {
|
|
@@ -37,7 +39,7 @@ export async function emitContentByBuilder(
|
|
|
37
39
|
contentFiles = [contentFiles];
|
|
38
40
|
}
|
|
39
41
|
for (const file of contentFiles) {
|
|
40
|
-
await emitFile(file, program, emitterOutputDir);
|
|
42
|
+
await emitFile(file, program, isBranded, emitterOutputDir);
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
}
|
|
@@ -45,13 +47,17 @@ export async function emitContentByBuilder(
|
|
|
45
47
|
async function emitFile(
|
|
46
48
|
file: File,
|
|
47
49
|
program: Program,
|
|
50
|
+
isBranded: boolean,
|
|
48
51
|
emitterOutputDir?: string
|
|
49
52
|
) {
|
|
50
53
|
const host: CompilerHost = program.host;
|
|
51
54
|
const filePath = join(emitterOutputDir ?? "", file.path);
|
|
52
55
|
const isJson = /\.json$/gi.test(filePath);
|
|
53
56
|
const isSourceCode = /\.(ts|js)$/gi.test(filePath);
|
|
54
|
-
const
|
|
57
|
+
const microsoftHeader = isBranded
|
|
58
|
+
? `// Copyright (c) Microsoft Corporation.\n`
|
|
59
|
+
: "";
|
|
60
|
+
const licenseHeader = `${microsoftHeader}// Licensed under the MIT license.\n`;
|
|
55
61
|
let prettierFileContent = file.content;
|
|
56
62
|
|
|
57
63
|
if (isSourceCode) {
|
package/src/utils/modelUtils.ts
CHANGED
|
@@ -70,6 +70,7 @@ import {
|
|
|
70
70
|
isApiVersion
|
|
71
71
|
} from "@azure-tools/typespec-client-generator-core";
|
|
72
72
|
import { SdkContext } from "./interfaces.js";
|
|
73
|
+
import { getModelNamespaceName } from "./namespaceUtils.js";
|
|
73
74
|
|
|
74
75
|
export function getBinaryType(usage: SchemaContext[]) {
|
|
75
76
|
return usage.includes(SchemaContext.Output)
|
|
@@ -503,7 +504,16 @@ function getSchemaForModel(
|
|
|
503
504
|
const program = dpgContext.program;
|
|
504
505
|
const overridedModelName =
|
|
505
506
|
getFriendlyName(program, model) ?? getProjectedName(program, model, "json");
|
|
506
|
-
|
|
507
|
+
const fullNamespaceName =
|
|
508
|
+
overridedModelName ??
|
|
509
|
+
getModelNamespaceName(dpgContext, model.namespace!)
|
|
510
|
+
.map((nsName) => {
|
|
511
|
+
return normalizeName(nsName, NameType.Interface);
|
|
512
|
+
})
|
|
513
|
+
.join("") + model.name;
|
|
514
|
+
let name = dpgContext.rlcOptions?.enableModelNamespace
|
|
515
|
+
? fullNamespaceName
|
|
516
|
+
: model.name;
|
|
507
517
|
if (
|
|
508
518
|
!overridedModelName &&
|
|
509
519
|
model.templateMapper &&
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { getAllModels } from "@azure-tools/typespec-client-generator-core";
|
|
2
|
+
import {
|
|
3
|
+
Namespace,
|
|
4
|
+
isGlobalNamespace,
|
|
5
|
+
isService,
|
|
6
|
+
Operation
|
|
7
|
+
} from "@typespec/compiler";
|
|
8
|
+
import { SdkContext } from "../utils/interfaces.js";
|
|
9
|
+
|
|
10
|
+
export function getModelNamespaceName(
|
|
11
|
+
dpgContext: SdkContext,
|
|
12
|
+
namespace: Namespace
|
|
13
|
+
): string[] {
|
|
14
|
+
const result: string[] = [];
|
|
15
|
+
namespace &&
|
|
16
|
+
!isGlobalNamespace(dpgContext.program, namespace) &&
|
|
17
|
+
!isService(dpgContext.program, namespace)
|
|
18
|
+
? (result.push(...getModelNamespaceName(dpgContext, namespace.namespace!)),
|
|
19
|
+
result.push(namespace.name))
|
|
20
|
+
: result;
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function getOperationNamespaceInterfaceName(
|
|
25
|
+
dpgContext: SdkContext,
|
|
26
|
+
operation: Operation
|
|
27
|
+
): string[] {
|
|
28
|
+
const result: string[] = [];
|
|
29
|
+
if (
|
|
30
|
+
dpgContext.rlcOptions?.hierarchyClient === false &&
|
|
31
|
+
dpgContext.rlcOptions?.enableOperationGroup !== true
|
|
32
|
+
) {
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
if (operation.interface) {
|
|
36
|
+
if (
|
|
37
|
+
dpgContext.rlcOptions?.enableOperationGroup === true &&
|
|
38
|
+
dpgContext.rlcOptions?.hierarchyClient === false
|
|
39
|
+
) {
|
|
40
|
+
result.push(operation.interface.name);
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
if (operation.interface.namespace) {
|
|
44
|
+
result.push(
|
|
45
|
+
...getModelNamespaceName(dpgContext, operation.interface.namespace)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
result.push(operation.interface.name);
|
|
49
|
+
} else if (operation.namespace) {
|
|
50
|
+
!isGlobalNamespace(dpgContext.program, operation.namespace) &&
|
|
51
|
+
!isService(dpgContext.program, operation.namespace)
|
|
52
|
+
? (result.push(
|
|
53
|
+
...getModelNamespaceName(dpgContext, operation.namespace.namespace!)
|
|
54
|
+
),
|
|
55
|
+
result.push(operation.namespace.name))
|
|
56
|
+
: result;
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function detectModelConflicts(dpgContext: SdkContext) {
|
|
62
|
+
const allModels = getAllModels(dpgContext);
|
|
63
|
+
const nameSet = new Set<string>();
|
|
64
|
+
for (const model of allModels) {
|
|
65
|
+
if (model.name === "") {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (nameSet.has(model.name)) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
nameSet.add(model.name);
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
@@ -13,8 +13,6 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
getProjectedName,
|
|
15
15
|
ignoreDiagnostics,
|
|
16
|
-
isGlobalNamespace,
|
|
17
|
-
isService,
|
|
18
16
|
Model,
|
|
19
17
|
Operation,
|
|
20
18
|
Program,
|
|
@@ -44,6 +42,7 @@ import {
|
|
|
44
42
|
} from "@azure-tools/rlc-common";
|
|
45
43
|
import { isByteOrByteUnion } from "./modelUtils.js";
|
|
46
44
|
import { SdkContext } from "./interfaces.js";
|
|
45
|
+
import { getOperationNamespaceInterfaceName } from "./namespaceUtils.js";
|
|
47
46
|
|
|
48
47
|
// Sorts the responses by status code
|
|
49
48
|
export function sortedOperationResponses(responses: HttpOperationResponse[]) {
|
|
@@ -142,29 +141,21 @@ export function getOperationGroupName(
|
|
|
142
141
|
if (!dpgContext.rlcOptions?.enableOperationGroup || !operationOrRoute) {
|
|
143
142
|
return "";
|
|
144
143
|
}
|
|
145
|
-
const program = dpgContext.program;
|
|
146
144
|
// If this is a HttpOperation
|
|
147
145
|
if ((operationOrRoute as any).kind !== "Operation") {
|
|
148
146
|
operationOrRoute = (operationOrRoute as HttpOperation).operation;
|
|
149
147
|
}
|
|
150
148
|
const operation = operationOrRoute as Operation;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
true
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
const namespace = operation.namespace;
|
|
159
|
-
if (
|
|
160
|
-
namespace === undefined ||
|
|
161
|
-
isGlobalNamespace(program, namespace) ||
|
|
162
|
-
isService(program, namespace)
|
|
163
|
-
) {
|
|
164
|
-
return "";
|
|
165
|
-
}
|
|
149
|
+
const namespaceNames = getOperationNamespaceInterfaceName(
|
|
150
|
+
dpgContext,
|
|
151
|
+
operation
|
|
152
|
+
);
|
|
166
153
|
|
|
167
|
-
return
|
|
154
|
+
return namespaceNames
|
|
155
|
+
.map((name) => {
|
|
156
|
+
return normalizeName(name, NameType.Interface, true);
|
|
157
|
+
})
|
|
158
|
+
.join("");
|
|
168
159
|
}
|
|
169
160
|
|
|
170
161
|
export function getOperationName(program: Program, operation: Operation) {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SourceFile } from "ts-morph";
|
|
2
|
-
import { Type } from "../modularCodeModel.js";
|
|
3
|
-
/**
|
|
4
|
-
* This function adds an import to the soruce file to import the right credential
|
|
5
|
-
*/
|
|
6
|
-
export declare function importCredential(credential: Type, clientSourceFile: SourceFile): void;
|
|
7
|
-
//# sourceMappingURL=credentialHelpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credentialHelpers.d.ts","sourceRoot":"","sources":["../../../../src/modular/helpers/credentialHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,IAAI,EAChB,gBAAgB,EAAE,UAAU,GAC3B,IAAI,CA8BN"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This function adds an import to the soruce file to import the right credential
|
|
3
|
-
*/
|
|
4
|
-
export function importCredential(credential, clientSourceFile) {
|
|
5
|
-
switch (credential.type) {
|
|
6
|
-
case "Key":
|
|
7
|
-
clientSourceFile.addImportDeclaration({
|
|
8
|
-
moduleSpecifier: "@azure/core-auth",
|
|
9
|
-
namedImports: ["KeyCredential"]
|
|
10
|
-
});
|
|
11
|
-
return;
|
|
12
|
-
case "OAuth2":
|
|
13
|
-
clientSourceFile.addImportDeclaration({
|
|
14
|
-
moduleSpecifier: "@azure/core-auth",
|
|
15
|
-
namedImports: ["TokenCredential"]
|
|
16
|
-
});
|
|
17
|
-
return;
|
|
18
|
-
case "combined":
|
|
19
|
-
if (!credential.types) {
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
for (const cred of credential.types) {
|
|
23
|
-
if (cred.type === "Key" || cred.type === "OAuth2") {
|
|
24
|
-
importCredential(cred, clientSourceFile);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
break;
|
|
28
|
-
default:
|
|
29
|
-
throw new Error(`Credential of type ${credential.type} is not yet supported`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=credentialHelpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credentialHelpers.js","sourceRoot":"","sources":["../../../../src/modular/helpers/credentialHelpers.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,UAAgB,EAChB,gBAA4B;IAE5B,QAAQ,UAAU,CAAC,IAAI,EAAE;QACvB,KAAK,KAAK;YACR,gBAAgB,CAAC,oBAAoB,CAAC;gBACpC,eAAe,EAAE,kBAAkB;gBACnC,YAAY,EAAE,CAAC,eAAe,CAAC;aAChC,CAAC,CAAC;YACH,OAAO;QACT,KAAK,QAAQ;YACX,gBAAgB,CAAC,oBAAoB,CAAC;gBACpC,eAAe,EAAE,kBAAkB;gBACnC,YAAY,EAAE,CAAC,iBAAiB,CAAC;aAClC,CAAC,CAAC;YACH,OAAO;QACT,KAAK,UAAU;YACb,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;gBACrB,MAAM;aACP;YAED,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,KAAK,EAAE;gBACnC,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;oBACjD,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;iBAC1C;aACF;YACD,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CACb,sBAAsB,UAAU,CAAC,IAAI,uBAAuB,CAC7D,CAAC;KACL;AACH,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { SourceFile } from "ts-morph";
|
|
2
|
-
import { Type } from "../modularCodeModel.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This function adds an import to the soruce file to import the right credential
|
|
6
|
-
*/
|
|
7
|
-
export function importCredential(
|
|
8
|
-
credential: Type,
|
|
9
|
-
clientSourceFile: SourceFile
|
|
10
|
-
): void {
|
|
11
|
-
switch (credential.type) {
|
|
12
|
-
case "Key":
|
|
13
|
-
clientSourceFile.addImportDeclaration({
|
|
14
|
-
moduleSpecifier: "@azure/core-auth",
|
|
15
|
-
namedImports: ["KeyCredential"]
|
|
16
|
-
});
|
|
17
|
-
return;
|
|
18
|
-
case "OAuth2":
|
|
19
|
-
clientSourceFile.addImportDeclaration({
|
|
20
|
-
moduleSpecifier: "@azure/core-auth",
|
|
21
|
-
namedImports: ["TokenCredential"]
|
|
22
|
-
});
|
|
23
|
-
return;
|
|
24
|
-
case "combined":
|
|
25
|
-
if (!credential.types) {
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
for (const cred of credential.types) {
|
|
30
|
-
if (cred.type === "Key" || cred.type === "OAuth2") {
|
|
31
|
-
importCredential(cred, clientSourceFile);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
break;
|
|
35
|
-
default:
|
|
36
|
-
throw new Error(
|
|
37
|
-
`Credential of type ${credential.type} is not yet supported`
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
}
|