@azure-tools/rlc-common 1.0.0-beta.8 → 1.0.0-beta.9
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/.rush/temp/package-deps_build.json +15 -12
- package/.rush/temp/shrinkwrap-deps.json +13 -13
- package/CHANGELOG.md +7 -0
- package/dist/buildClient.js +22 -11
- package/dist/buildClient.js.map +1 -1
- package/dist/buildIndexFile.js +18 -0
- package/dist/buildIndexFile.js.map +1 -1
- package/dist/buildSerializeHelper.js +35 -0
- package/dist/buildSerializeHelper.js.map +1 -0
- package/dist/buildTopLevelIndexFile.js +2 -1
- package/dist/buildTopLevelIndexFile.js.map +1 -1
- package/dist/helpers/operationHelpers.js +21 -1
- package/dist/helpers/operationHelpers.js.map +1 -1
- package/dist/helpers/pathUtils.js +12 -0
- package/dist/helpers/pathUtils.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/metadata/buildPackageFile.js +43 -16
- package/dist/metadata/buildPackageFile.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/static/pollingContent.js +26 -6
- package/dist/static/pollingContent.js.map +1 -1
- package/dist/static/serializeHelper.js +30 -0
- package/dist/static/serializeHelper.js.map +1 -0
- package/dist/test/template.js +0 -2
- package/dist/test/template.js.map +1 -1
- package/dist-esm/buildClient.js +22 -11
- package/dist-esm/buildClient.js.map +1 -1
- package/dist-esm/buildIndexFile.js +19 -1
- package/dist-esm/buildIndexFile.js.map +1 -1
- package/dist-esm/buildSerializeHelper.js +31 -0
- package/dist-esm/buildSerializeHelper.js.map +1 -0
- package/dist-esm/buildTopLevelIndexFile.js +2 -1
- package/dist-esm/buildTopLevelIndexFile.js.map +1 -1
- package/dist-esm/helpers/operationHelpers.js +12 -0
- package/dist-esm/helpers/operationHelpers.js.map +1 -1
- package/dist-esm/helpers/pathUtils.js +8 -0
- package/dist-esm/helpers/pathUtils.js.map +1 -0
- package/dist-esm/index.js +1 -0
- package/dist-esm/index.js.map +1 -1
- package/dist-esm/interfaces.js.map +1 -1
- package/dist-esm/metadata/buildPackageFile.js +43 -16
- package/dist-esm/metadata/buildPackageFile.js.map +1 -1
- package/dist-esm/package.json +1 -1
- package/dist-esm/static/pollingContent.js +26 -6
- package/dist-esm/static/pollingContent.js.map +1 -1
- package/dist-esm/static/serializeHelper.js +27 -0
- package/dist-esm/static/serializeHelper.js.map +1 -0
- package/dist-esm/test/template.js +0 -2
- package/dist-esm/test/template.js.map +1 -1
- package/package.json +1 -1
- package/src/buildClient.ts +23 -12
- package/src/buildIndexFile.ts +28 -0
- package/src/buildSerializeHelper.ts +42 -0
- package/src/buildTopLevelIndexFile.ts +6 -2
- package/src/helpers/operationHelpers.ts +16 -0
- package/src/helpers/pathUtils.ts +7 -0
- package/src/index.ts +1 -0
- package/src/interfaces.ts +5 -0
- package/src/metadata/buildPackageFile.ts +52 -16
- package/src/static/pollingContent.ts +26 -6
- package/src/static/serializeHelper.ts +29 -0
- package/src/test/template.ts +0 -2
- package/types/buildSerializeHelper.d.ts +5 -0
- package/types/helpers/operationHelpers.d.ts +4 -0
- package/types/helpers/pathUtils.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/interfaces.d.ts +5 -0
- package/types/static/pollingContent.d.ts +1 -1
- package/types/static/serializeHelper.d.ts +4 -0
- package/types/test/template.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPackageFile.js","sourceRoot":"","sources":["../../src/metadata/buildPackageFile.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"buildPackageFile.js","sourceRoot":"","sources":["../../src/metadata/buildPackageFile.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,k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I,KAAK,CAAC,WAAW;YAClE,YAAY,EAAE,CAAC,OAAO,CAAC;YACvB,aAAa,EAAE,IAAI;YACnB,UAAU,EAAE,6CAA6C,iBAAiB,GAAG,uBAAuB,EAAE;SACvG,CAAC;QACF,IAAI,aAAa,EAAE;YACjB,WAAW,CAAC,OAAO,CAAC,iBAAiB,CAAC;gBACpC,kCAAkC,CAAC;SACtC;KACF;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,oBAAoB,CAC3B,YAAsB,EACtB,cAAwB;IAExB,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,YAAY,EAAE;QAChB,IAAI,GAAG,IAAI,GAAG,iBAAiB,CAAC;KACjC;IACD,IAAI,cAAc,EAAE;QAClB,IAAI,GAAG,IAAI,GAAG,wBAAwB,CAAC;KACxC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,kBAAkB,CAAC,YAAsB;IAChD,OAAO,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AACpC,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAe;IACxC,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC1B,MAAM,eAAe,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAC5D,MAAM,cAAc,GAAG,aAAa,CAAC,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvE,OAAO,eAAe;QACpB,CAAC,CAAC,OAAO,eAAe,IAAI,cAAc,KAAK;QAC/C,CAAC,CAAC,OAAO,cAAc,KAAK,CAAC;AACjC,CAAC"}
|
package/dist-esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@azure-tools/rlc-common","version":"1.0.0-beta.
|
|
1
|
+
{"name":"@azure-tools/rlc-common","version":"1.0.0-beta.9","description":"","type":"module","main":"dist/index.js","module":"dist-esm/index.js","exports":{".":{"types":"./types/index.d.ts","require":"./dist/index.js","import":"./dist-esm/index.js"}},"types":"./types/index.d.ts","scripts":{"lint":"eslint src --ext .ts --max-warnings=0","lint:fix":"eslint src --fix --ext .ts","format":"npm run -s prettier -- --write","check-format":"npm run prettier -- --check","prettier":"prettier --config ./.prettierrc src/**/*.ts","build":"rimraf dist/* dist-esm/* types/* && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node publishPackage.js","build:cjs":"rimraf dist/* dist-esm/* types/* && tsc -p tsconfig-cjs.json && node publishPackage.js","build:esm":"rimraf dist/* dist-esm/* types/* && tsc -p tsconfig.json && node publishPackage.js","test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":"","license":"ISC","dependencies":{"ts-morph":"^15.1.0","lodash":"^4.17.21","handlebars":"^4.7.7"},"devDependencies":{"@types/node":"^18.0.0","eslint":"^8.9.0","prettier":"~2.7.1","typescript":"~4.8.0","rimraf":"^3.0.2","@types/lodash":"^4.14.182","fs-extra":"^10.0.0","@types/fs-extra":"^8.1.0","ts-node":"^10.7.0"}}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const pollingContent = `
|
|
2
2
|
import { Client, HttpResponse } from "@azure-rest/core-client";
|
|
3
|
+
{{#if useLegacyLro}}
|
|
3
4
|
import {
|
|
4
5
|
LongRunningOperation,
|
|
5
6
|
LroEngine,
|
|
@@ -8,7 +9,16 @@ import {
|
|
|
8
9
|
PollerLike,
|
|
9
10
|
PollOperationState
|
|
10
11
|
} from "@azure/core-lro";
|
|
11
|
-
|
|
12
|
+
{{else}}
|
|
13
|
+
import {
|
|
14
|
+
CreateHttpPollerOptions,
|
|
15
|
+
LongRunningOperation,
|
|
16
|
+
LroResponse,
|
|
17
|
+
OperationState,
|
|
18
|
+
SimplePollerLike,
|
|
19
|
+
createHttpPoller
|
|
20
|
+
} from "@azure/core-lro";
|
|
21
|
+
{{/if}}
|
|
12
22
|
/**
|
|
13
23
|
* Helper function that builds a Poller object to help polling a long running operation.
|
|
14
24
|
* @param client - Client to use for sending the request to get additional pages.
|
|
@@ -16,12 +26,17 @@ import {
|
|
|
16
26
|
* @param options - Options to set a resume state or custom polling interval.
|
|
17
27
|
* @returns - A poller object to poll for operation state updates and eventually get the final response.
|
|
18
28
|
*/
|
|
19
|
-
export function getLongRunningPoller<TResult extends HttpResponse>(
|
|
29
|
+
export {{#unless useLegacyLro}}async {{/unless}}function getLongRunningPoller<TResult extends HttpResponse>(
|
|
20
30
|
client: Client,
|
|
21
31
|
initialResponse: TResult,
|
|
32
|
+
{{#if useLegacyLro}}
|
|
22
33
|
options: LroEngineOptions<TResult, PollOperationState<TResult>> = {}
|
|
23
|
-
): PollerLike<PollOperationState<TResult>, TResult> {
|
|
24
|
-
|
|
34
|
+
): PollerLike<PollOperationState<TResult>, TResult> {
|
|
35
|
+
{{else}}
|
|
36
|
+
options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {}
|
|
37
|
+
): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {
|
|
38
|
+
{{/if}}
|
|
39
|
+
const poller: LongRunningOperation<TResult> = {
|
|
25
40
|
requestMethod: initialResponse.request.method,
|
|
26
41
|
requestPath: initialResponse.request.url,
|
|
27
42
|
sendInitialRequest: async () => {
|
|
@@ -45,13 +60,18 @@ export function getLongRunningPoller<TResult extends HttpResponse>(
|
|
|
45
60
|
}
|
|
46
61
|
};
|
|
47
62
|
|
|
63
|
+
{{#if useLegacyLro}}
|
|
48
64
|
return new LroEngine(poller, options);
|
|
65
|
+
{{else}}
|
|
66
|
+
options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;
|
|
67
|
+
return await createHttpPoller(poller, options);
|
|
68
|
+
{{/if}}
|
|
49
69
|
}
|
|
50
70
|
|
|
51
71
|
/**
|
|
52
|
-
* Converts a Rest Client response to a response that the LRO
|
|
72
|
+
* Converts a Rest Client response to a response that the LRO implementation understands
|
|
53
73
|
* @param response - a rest client http response
|
|
54
|
-
* @returns - An LRO response that the LRO
|
|
74
|
+
* @returns - An LRO response that the LRO implementation understands
|
|
55
75
|
*/
|
|
56
76
|
function getLroResponse<TResult extends HttpResponse>(
|
|
57
77
|
response: TResult
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollingContent.js","sourceRoot":"","sources":["../../src/static/pollingContent.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG
|
|
1
|
+
{"version":3,"file":"pollingContent.js","sourceRoot":"","sources":["../../src/static/pollingContent.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6F7B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const buildMultiCollectionContent = `
|
|
2
|
+
export function buildMultiCollection(
|
|
3
|
+
queryParameters: string[],
|
|
4
|
+
parameterName: string
|
|
5
|
+
) {
|
|
6
|
+
return queryParameters
|
|
7
|
+
.map((item, index) => {
|
|
8
|
+
if (index === 0) {
|
|
9
|
+
return item;
|
|
10
|
+
}
|
|
11
|
+
return \`\${parameterName}=\${item}\`;
|
|
12
|
+
})
|
|
13
|
+
.join("&");
|
|
14
|
+
}`;
|
|
15
|
+
export const buildPipeCollectionContent = `
|
|
16
|
+
export function buildPipeCollection(queryParameters: string[]): string {
|
|
17
|
+
return queryParameters.join("|");
|
|
18
|
+
}`;
|
|
19
|
+
export const buildSsvCollectionContent = `
|
|
20
|
+
export function buildSsvCollection(queryParameters: string[]): string {
|
|
21
|
+
return queryParameters.join(" ");
|
|
22
|
+
}`;
|
|
23
|
+
export const buildTsvCollectionContent = `
|
|
24
|
+
export function buildTsvCollection(queryParameters: string[]) {
|
|
25
|
+
return queryParameters.join("\\t");
|
|
26
|
+
}`;
|
|
27
|
+
//# sourceMappingURL=serializeHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializeHelper.js","sourceRoot":"","sources":["../../src/static/serializeHelper.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;EAazC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;EAGxC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;EAGvC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;EAGvC,CAAC"}
|
|
@@ -28,9 +28,7 @@ module.exports = function (config) {
|
|
|
28
28
|
"karma-mocha",
|
|
29
29
|
"karma-mocha-reporter",
|
|
30
30
|
"karma-chrome-launcher",
|
|
31
|
-
"karma-edge-launcher",
|
|
32
31
|
"karma-firefox-launcher",
|
|
33
|
-
"karma-ie-launcher",
|
|
34
32
|
"karma-env-preprocessor",
|
|
35
33
|
"karma-coverage",
|
|
36
34
|
"karma-sourcemap-loader",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/test/template.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;;;;CAIzB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;CAIhC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/test/template.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;;;;CAIzB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;CAIhC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8H1B,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BpC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBhC,CAAC"}
|
package/package.json
CHANGED
package/src/buildClient.ts
CHANGED
|
@@ -94,27 +94,38 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
94
94
|
...(addCredentials === false ||
|
|
95
95
|
!isSecurityInfoDefined(credentialScopes, credentialKeyHeaderName)
|
|
96
96
|
? []
|
|
97
|
-
: [
|
|
97
|
+
: [
|
|
98
|
+
{
|
|
99
|
+
name: "credentials",
|
|
100
|
+
type: credentialTypes.join(" | "),
|
|
101
|
+
description: `uniquely identify client credential`
|
|
102
|
+
}
|
|
103
|
+
])
|
|
98
104
|
];
|
|
99
105
|
|
|
106
|
+
const allClientParams = [
|
|
107
|
+
...commonClientParams,
|
|
108
|
+
{
|
|
109
|
+
name: "options",
|
|
110
|
+
type: `${clientOptionsInterface?.name ?? "ClientOptions"} = {}`,
|
|
111
|
+
description: "the parameter for all optional parameters"
|
|
112
|
+
}
|
|
113
|
+
];
|
|
100
114
|
const functionStatement = {
|
|
101
115
|
isExported: true,
|
|
102
116
|
name: `createClient`,
|
|
103
|
-
parameters:
|
|
104
|
-
...commonClientParams,
|
|
105
|
-
{
|
|
106
|
-
name: "options",
|
|
107
|
-
type: `${clientOptionsInterface?.name ?? "ClientOptions"} = {}`
|
|
108
|
-
}
|
|
109
|
-
],
|
|
117
|
+
parameters: allClientParams,
|
|
110
118
|
docs: [
|
|
111
119
|
{
|
|
112
120
|
description:
|
|
113
|
-
`Initialize a new instance of
|
|
114
|
-
|
|
121
|
+
`Initialize a new instance of \`${clientInterfaceName}\` \n` +
|
|
122
|
+
allClientParams
|
|
115
123
|
.map((param) => {
|
|
116
|
-
return `@param ${param.name} type: ${param.type
|
|
117
|
-
|
|
124
|
+
return `@param ${param.name} type: ${param.type
|
|
125
|
+
.split("=")[0]
|
|
126
|
+
.split(" ")
|
|
127
|
+
.join("")}, ${
|
|
128
|
+
param.description ?? "The parameter " + param.name
|
|
118
129
|
}`;
|
|
119
130
|
})
|
|
120
131
|
.join("\n")
|
package/src/buildIndexFile.ts
CHANGED
|
@@ -5,9 +5,13 @@ import { Project, SourceFile } from "ts-morph";
|
|
|
5
5
|
import { NameType, normalizeName } from "./helpers/nameUtils.js";
|
|
6
6
|
import {
|
|
7
7
|
hasInputModels,
|
|
8
|
+
hasMultiCollection,
|
|
8
9
|
hasOutputModels,
|
|
9
10
|
hasPagingOperations,
|
|
11
|
+
hasPipeCollection,
|
|
10
12
|
hasPollingOperations,
|
|
13
|
+
hasSsvCollection,
|
|
14
|
+
hasTsvCollection,
|
|
11
15
|
hasUnexpectedHelper
|
|
12
16
|
} from "./helpers/operationHelpers.js";
|
|
13
17
|
import { RLCModel } from "./interfaces.js";
|
|
@@ -89,6 +93,19 @@ function generateRLCIndexForMultiClient(file: SourceFile, model: RLCModel) {
|
|
|
89
93
|
exports.push("PollingHelper");
|
|
90
94
|
}
|
|
91
95
|
|
|
96
|
+
if (
|
|
97
|
+
hasMultiCollection(model) ||
|
|
98
|
+
hasSsvCollection(model) ||
|
|
99
|
+
hasPipeCollection(model) ||
|
|
100
|
+
hasTsvCollection(model)
|
|
101
|
+
) {
|
|
102
|
+
file.addImportDeclaration({
|
|
103
|
+
namespaceImport: "SerializeHelper",
|
|
104
|
+
moduleSpecifier: "./serializeHelper"
|
|
105
|
+
});
|
|
106
|
+
exports.push("SerializeHelper");
|
|
107
|
+
}
|
|
108
|
+
|
|
92
109
|
file.addExportDeclarations([
|
|
93
110
|
{
|
|
94
111
|
moduleSpecifier: `./${moduleName}`,
|
|
@@ -165,6 +182,17 @@ function generateRLCIndex(file: SourceFile, model: RLCModel) {
|
|
|
165
182
|
]);
|
|
166
183
|
}
|
|
167
184
|
|
|
185
|
+
if (
|
|
186
|
+
hasMultiCollection(model) ||
|
|
187
|
+
hasSsvCollection(model) ||
|
|
188
|
+
hasPipeCollection(model) ||
|
|
189
|
+
hasTsvCollection(model)
|
|
190
|
+
) {
|
|
191
|
+
file.addExportDeclarations([{
|
|
192
|
+
moduleSpecifier: "./serializeHelper"
|
|
193
|
+
}]);
|
|
194
|
+
}
|
|
195
|
+
|
|
168
196
|
file.addExportAssignment({
|
|
169
197
|
expression: createClientFuncName,
|
|
170
198
|
isExportEquals: false
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RLCModel } from "./interfaces.js";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
// @ts-ignore: to fix the handlebars issue
|
|
4
|
+
import hbs from "handlebars";
|
|
5
|
+
import {
|
|
6
|
+
hasMultiCollection,
|
|
7
|
+
hasPipeCollection,
|
|
8
|
+
hasSsvCollection,
|
|
9
|
+
hasTsvCollection
|
|
10
|
+
} from "./helpers/operationHelpers.js";
|
|
11
|
+
import {
|
|
12
|
+
buildMultiCollectionContent,
|
|
13
|
+
buildPipeCollectionContent,
|
|
14
|
+
buildSsvCollectionContent,
|
|
15
|
+
buildTsvCollectionContent
|
|
16
|
+
} from "./static/serializeHelper.js";
|
|
17
|
+
|
|
18
|
+
export function buildSerializeHelper(model: RLCModel) {
|
|
19
|
+
let serializeHelperContent = "";
|
|
20
|
+
if (hasMultiCollection(model)) {
|
|
21
|
+
serializeHelperContent += "\n" + buildMultiCollectionContent;
|
|
22
|
+
}
|
|
23
|
+
if (hasPipeCollection(model)) {
|
|
24
|
+
serializeHelperContent += "\n" + buildPipeCollectionContent;
|
|
25
|
+
}
|
|
26
|
+
if (hasSsvCollection(model)) {
|
|
27
|
+
serializeHelperContent += "\n" + buildSsvCollectionContent;
|
|
28
|
+
}
|
|
29
|
+
if (hasTsvCollection(model)) {
|
|
30
|
+
serializeHelperContent += "\n" + buildTsvCollectionContent;
|
|
31
|
+
}
|
|
32
|
+
if (serializeHelperContent !== "") {
|
|
33
|
+
const readmeFileContents = hbs.compile(serializeHelperContent, {
|
|
34
|
+
noEscape: true
|
|
35
|
+
});
|
|
36
|
+
const { srcPath } = model;
|
|
37
|
+
return {
|
|
38
|
+
path: path.join(srcPath, "serializeHelper.ts"),
|
|
39
|
+
content: readmeFileContents({})
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -5,6 +5,7 @@ import { NameType, normalizeName } from "./helpers/nameUtils.js";
|
|
|
5
5
|
import { RLCModel } from "./interfaces.js";
|
|
6
6
|
import { Project } from "ts-morph";
|
|
7
7
|
import * as path from "path";
|
|
8
|
+
import { getRelativePartFromSrcPath } from "./helpers/pathUtils.js";
|
|
8
9
|
|
|
9
10
|
const batchOutputFolder: [string, string, string][] = [];
|
|
10
11
|
|
|
@@ -18,7 +19,7 @@ export function buildTopLevelIndex(model: RLCModel) {
|
|
|
18
19
|
if (srcPath) {
|
|
19
20
|
const clientName = model.libraryName;
|
|
20
21
|
const moduleName = normalizeName(clientName, NameType.File);
|
|
21
|
-
const relativePath = "
|
|
22
|
+
const relativePath = "./" + getRelativePartFromSrcPath(srcPath);
|
|
22
23
|
batchOutputFolder.push([relativePath, clientName, moduleName]);
|
|
23
24
|
}
|
|
24
25
|
if (
|
|
@@ -42,7 +43,10 @@ export function buildTopLevelIndex(model: RLCModel) {
|
|
|
42
43
|
namedExports: [...allModules]
|
|
43
44
|
});
|
|
44
45
|
const content = indexFile.getFullText();
|
|
45
|
-
const filePath = path.join(
|
|
46
|
+
const filePath = path.join(
|
|
47
|
+
srcPath.substring(0, srcPath.indexOf("/src/") + 5),
|
|
48
|
+
`index.ts`
|
|
49
|
+
);
|
|
46
50
|
return { path: filePath, content };
|
|
47
51
|
}
|
|
48
52
|
}
|
|
@@ -67,6 +67,22 @@ export function hasPollingOperations(model: RLCModel) {
|
|
|
67
67
|
return Boolean(model.annotations?.hasLongRunning);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
export function hasMultiCollection(model: RLCModel) {
|
|
71
|
+
return Boolean(model.annotations?.hasMultiCollection);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function hasPipeCollection(model: RLCModel) {
|
|
75
|
+
return Boolean(model.annotations?.hasPipeCollection);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function hasSsvCollection(model: RLCModel) {
|
|
79
|
+
return Boolean(model.annotations?.hasSsvCollection);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function hasTsvCollection(model: RLCModel) {
|
|
83
|
+
return Boolean(model.annotations?.hasTsvCollection);
|
|
84
|
+
}
|
|
85
|
+
|
|
70
86
|
export function hasUnexpectedHelper(model: RLCModel) {
|
|
71
87
|
const pathDictionary = model.paths;
|
|
72
88
|
for (const details of Object.values(pathDictionary)) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// FIXME https://github.com/Azure/autorest.typescript/issues/1720
|
|
2
|
+
export function getRelativePartFromSrcPath(srcPath: string) {
|
|
3
|
+
const relativePart = srcPath.substring(srcPath.indexOf("/src/") + 4);
|
|
4
|
+
return relativePart.startsWith("/")
|
|
5
|
+
? relativePart.substring(1)
|
|
6
|
+
: relativePart;
|
|
7
|
+
}
|
package/src/index.ts
CHANGED
package/src/interfaces.ts
CHANGED
|
@@ -28,6 +28,10 @@ export interface AnnotationDetails {
|
|
|
28
28
|
hasPaging?: boolean;
|
|
29
29
|
hasLongRunning?: boolean;
|
|
30
30
|
pageDetails?: PagingDetails;
|
|
31
|
+
hasMultiCollection?: boolean;
|
|
32
|
+
hasPipeCollection?: boolean;
|
|
33
|
+
hasSsvCollection?: boolean;
|
|
34
|
+
hasTsvCollection?: boolean;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
export interface PagingDetails {
|
|
@@ -96,6 +100,7 @@ export interface RLCOptions {
|
|
|
96
100
|
productDocLink?: string;
|
|
97
101
|
serviceInfo?: ServiceInfo;
|
|
98
102
|
azureArm?: boolean;
|
|
103
|
+
sourceFrom?: "Cadl" | "Swagger";
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
export interface ServiceInfo {
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import { Project } from "ts-morph";
|
|
5
|
+
import { NameType, normalizeName } from "../helpers/nameUtils.js";
|
|
5
6
|
import {
|
|
6
7
|
hasPagingOperations,
|
|
7
8
|
hasPollingOperations
|
|
8
9
|
} from "../helpers/operationHelpers.js";
|
|
10
|
+
import { getRelativePartFromSrcPath } from "../helpers/pathUtils.js";
|
|
9
11
|
import { RLCModel } from "../interfaces.js";
|
|
10
12
|
|
|
11
13
|
let hasPaging = false;
|
|
12
14
|
let hasLRO = false;
|
|
15
|
+
let clientFilePaths: string[] = [];
|
|
16
|
+
|
|
13
17
|
export function buildPackageFile(model: RLCModel, hasSamplesGenerated = false) {
|
|
14
18
|
const generateMetadata = Boolean(model.options?.generateMetadata);
|
|
15
19
|
if (!generateMetadata) {
|
|
@@ -45,22 +49,36 @@ function restLevelPackage(model: RLCModel, hasSamplesGenerated: boolean) {
|
|
|
45
49
|
return;
|
|
46
50
|
}
|
|
47
51
|
|
|
52
|
+
clientFilePaths.push(getClientFilePath(model));
|
|
53
|
+
hasPaging = hasPaging || hasPagingOperations(model);
|
|
54
|
+
hasLRO = hasLRO || hasPollingOperations(model);
|
|
55
|
+
|
|
48
56
|
const {
|
|
49
57
|
packageDetails,
|
|
50
58
|
generateTest,
|
|
51
59
|
generateSample,
|
|
52
60
|
azureOutputDirectory,
|
|
53
61
|
azureSdkForJs,
|
|
54
|
-
isCadlTest
|
|
62
|
+
isCadlTest,
|
|
63
|
+
sourceFrom,
|
|
64
|
+
multiClient,
|
|
65
|
+
batch
|
|
55
66
|
} = model.options;
|
|
67
|
+
if (
|
|
68
|
+
multiClient &&
|
|
69
|
+
batch &&
|
|
70
|
+
batch.length > 1 &&
|
|
71
|
+
clientFilePaths.length < batch.length
|
|
72
|
+
) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
56
75
|
|
|
57
76
|
const clientPackageName = packageDetails.name;
|
|
58
77
|
let apiRefUrlQueryParameter: string = "";
|
|
59
78
|
if (packageDetails.version.includes("beta")) {
|
|
60
79
|
apiRefUrlQueryParameter = "?view=azure-node-preview";
|
|
61
80
|
}
|
|
62
|
-
|
|
63
|
-
hasLRO = hasLRO || hasPollingOperations(model);
|
|
81
|
+
|
|
64
82
|
const packageInfo: Record<string, any> = {
|
|
65
83
|
name: `${packageDetails.name}`,
|
|
66
84
|
"sdk-type": "client",
|
|
@@ -111,7 +129,9 @@ function restLevelPackage(model: RLCModel, hasSamplesGenerated: boolean) {
|
|
|
111
129
|
generateSample
|
|
112
130
|
)}`,
|
|
113
131
|
"generate:client":
|
|
114
|
-
|
|
132
|
+
sourceFrom === "Swagger"
|
|
133
|
+
? "autorest --typescript swagger/README.md && npm run format"
|
|
134
|
+
: "echo skipped",
|
|
115
135
|
"integration-test:browser": "echo skipped",
|
|
116
136
|
"integration-test:node": "echo skipped",
|
|
117
137
|
"integration-test": "echo skipped",
|
|
@@ -141,17 +161,18 @@ function restLevelPackage(model: RLCModel, hasSamplesGenerated: boolean) {
|
|
|
141
161
|
"@azure/core-paging": "^1.2.0"
|
|
142
162
|
}),
|
|
143
163
|
...(hasLRO && {
|
|
144
|
-
"@azure/core-lro": "^2.
|
|
164
|
+
"@azure/core-lro": "^2.5.0",
|
|
165
|
+
"@azure/abort-controller": "^1.0.0"
|
|
145
166
|
})
|
|
146
167
|
},
|
|
147
168
|
devDependencies: {
|
|
148
169
|
"@microsoft/api-extractor": "^7.31.1",
|
|
149
170
|
autorest: "latest",
|
|
150
171
|
"@types/node": "^14.0.0",
|
|
151
|
-
dotenv: "^
|
|
172
|
+
dotenv: "^16.0.0",
|
|
152
173
|
eslint: "^8.0.0",
|
|
153
|
-
mkdirp: "^1.
|
|
154
|
-
prettier: "2.
|
|
174
|
+
mkdirp: "^2.1.2",
|
|
175
|
+
prettier: "^2.5.1",
|
|
155
176
|
rimraf: "^3.0.0",
|
|
156
177
|
"source-map-support": "^0.5.9",
|
|
157
178
|
typescript: "~4.8.0"
|
|
@@ -164,13 +185,21 @@ function restLevelPackage(model: RLCModel, hasSamplesGenerated: boolean) {
|
|
|
164
185
|
|
|
165
186
|
if (azureSdkForJs) {
|
|
166
187
|
packageInfo["//metadata"] = {
|
|
167
|
-
constantPaths: [
|
|
168
|
-
{
|
|
169
|
-
path: "swagger/README.md",
|
|
170
|
-
prefix: "package-version"
|
|
171
|
-
}
|
|
172
|
-
]
|
|
188
|
+
constantPaths: []
|
|
173
189
|
};
|
|
190
|
+
clientFilePaths.forEach((path) => {
|
|
191
|
+
packageInfo["//metadata"].constantPaths.push({
|
|
192
|
+
path,
|
|
193
|
+
prefix: "userAgentInfo"
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
// Only generate this from Swagger spec
|
|
197
|
+
if (sourceFrom === "Swagger") {
|
|
198
|
+
packageInfo["//metadata"].constantPaths.push({
|
|
199
|
+
path: "swagger/README.md",
|
|
200
|
+
prefix: "package-version"
|
|
201
|
+
});
|
|
202
|
+
}
|
|
174
203
|
packageInfo.scripts["build"] =
|
|
175
204
|
"npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && api-extractor run --local";
|
|
176
205
|
packageInfo.scripts["build:debug"] =
|
|
@@ -212,10 +241,8 @@ function restLevelPackage(model: RLCModel, hasSamplesGenerated: boolean) {
|
|
|
212
241
|
packageInfo.devDependencies["cross-env"] = "^7.0.2";
|
|
213
242
|
packageInfo.devDependencies["karma-chrome-launcher"] = "^3.0.0";
|
|
214
243
|
packageInfo.devDependencies["karma-coverage"] = "^2.0.0";
|
|
215
|
-
packageInfo.devDependencies["karma-edge-launcher"] = "^0.4.2";
|
|
216
244
|
packageInfo.devDependencies["karma-env-preprocessor"] = "^0.1.1";
|
|
217
245
|
packageInfo.devDependencies["karma-firefox-launcher"] = "^1.1.0";
|
|
218
|
-
packageInfo.devDependencies["karma-ie-launcher"] = "^1.0.0";
|
|
219
246
|
packageInfo.devDependencies["karma-junit-reporter"] = "^2.0.1";
|
|
220
247
|
packageInfo.devDependencies["karma-mocha-reporter"] = "^2.2.5";
|
|
221
248
|
packageInfo.devDependencies["karma-mocha"] = "^2.0.1";
|
|
@@ -296,3 +323,12 @@ function appendPathWhenFormat(
|
|
|
296
323
|
function appednPathWhenLint(generateTest?: boolean) {
|
|
297
324
|
return generateTest ? "test" : "";
|
|
298
325
|
}
|
|
326
|
+
|
|
327
|
+
function getClientFilePath(model: RLCModel) {
|
|
328
|
+
const { srcPath } = model;
|
|
329
|
+
const sdkReletivePart = getRelativePartFromSrcPath(srcPath);
|
|
330
|
+
const clientFilename = normalizeName(model.libraryName, NameType.File);
|
|
331
|
+
return sdkReletivePart
|
|
332
|
+
? `src/${sdkReletivePart}/${clientFilename}.ts`
|
|
333
|
+
: `src/${clientFilename}.ts`;
|
|
334
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const pollingContent = `
|
|
2
2
|
import { Client, HttpResponse } from "@azure-rest/core-client";
|
|
3
|
+
{{#if useLegacyLro}}
|
|
3
4
|
import {
|
|
4
5
|
LongRunningOperation,
|
|
5
6
|
LroEngine,
|
|
@@ -8,7 +9,16 @@ import {
|
|
|
8
9
|
PollerLike,
|
|
9
10
|
PollOperationState
|
|
10
11
|
} from "@azure/core-lro";
|
|
11
|
-
|
|
12
|
+
{{else}}
|
|
13
|
+
import {
|
|
14
|
+
CreateHttpPollerOptions,
|
|
15
|
+
LongRunningOperation,
|
|
16
|
+
LroResponse,
|
|
17
|
+
OperationState,
|
|
18
|
+
SimplePollerLike,
|
|
19
|
+
createHttpPoller
|
|
20
|
+
} from "@azure/core-lro";
|
|
21
|
+
{{/if}}
|
|
12
22
|
/**
|
|
13
23
|
* Helper function that builds a Poller object to help polling a long running operation.
|
|
14
24
|
* @param client - Client to use for sending the request to get additional pages.
|
|
@@ -16,12 +26,17 @@ import {
|
|
|
16
26
|
* @param options - Options to set a resume state or custom polling interval.
|
|
17
27
|
* @returns - A poller object to poll for operation state updates and eventually get the final response.
|
|
18
28
|
*/
|
|
19
|
-
export function getLongRunningPoller<TResult extends HttpResponse>(
|
|
29
|
+
export {{#unless useLegacyLro}}async {{/unless}}function getLongRunningPoller<TResult extends HttpResponse>(
|
|
20
30
|
client: Client,
|
|
21
31
|
initialResponse: TResult,
|
|
32
|
+
{{#if useLegacyLro}}
|
|
22
33
|
options: LroEngineOptions<TResult, PollOperationState<TResult>> = {}
|
|
23
|
-
): PollerLike<PollOperationState<TResult>, TResult> {
|
|
24
|
-
|
|
34
|
+
): PollerLike<PollOperationState<TResult>, TResult> {
|
|
35
|
+
{{else}}
|
|
36
|
+
options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {}
|
|
37
|
+
): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {
|
|
38
|
+
{{/if}}
|
|
39
|
+
const poller: LongRunningOperation<TResult> = {
|
|
25
40
|
requestMethod: initialResponse.request.method,
|
|
26
41
|
requestPath: initialResponse.request.url,
|
|
27
42
|
sendInitialRequest: async () => {
|
|
@@ -45,13 +60,18 @@ export function getLongRunningPoller<TResult extends HttpResponse>(
|
|
|
45
60
|
}
|
|
46
61
|
};
|
|
47
62
|
|
|
63
|
+
{{#if useLegacyLro}}
|
|
48
64
|
return new LroEngine(poller, options);
|
|
65
|
+
{{else}}
|
|
66
|
+
options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;
|
|
67
|
+
return await createHttpPoller(poller, options);
|
|
68
|
+
{{/if}}
|
|
49
69
|
}
|
|
50
70
|
|
|
51
71
|
/**
|
|
52
|
-
* Converts a Rest Client response to a response that the LRO
|
|
72
|
+
* Converts a Rest Client response to a response that the LRO implementation understands
|
|
53
73
|
* @param response - a rest client http response
|
|
54
|
-
* @returns - An LRO response that the LRO
|
|
74
|
+
* @returns - An LRO response that the LRO implementation understands
|
|
55
75
|
*/
|
|
56
76
|
function getLroResponse<TResult extends HttpResponse>(
|
|
57
77
|
response: TResult
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const buildMultiCollectionContent = `
|
|
2
|
+
export function buildMultiCollection(
|
|
3
|
+
queryParameters: string[],
|
|
4
|
+
parameterName: string
|
|
5
|
+
) {
|
|
6
|
+
return queryParameters
|
|
7
|
+
.map((item, index) => {
|
|
8
|
+
if (index === 0) {
|
|
9
|
+
return item;
|
|
10
|
+
}
|
|
11
|
+
return \`\${parameterName}=\${item}\`;
|
|
12
|
+
})
|
|
13
|
+
.join("&");
|
|
14
|
+
}`;
|
|
15
|
+
|
|
16
|
+
export const buildPipeCollectionContent = `
|
|
17
|
+
export function buildPipeCollection(queryParameters: string[]): string {
|
|
18
|
+
return queryParameters.join("|");
|
|
19
|
+
}`;
|
|
20
|
+
|
|
21
|
+
export const buildSsvCollectionContent = `
|
|
22
|
+
export function buildSsvCollection(queryParameters: string[]): string {
|
|
23
|
+
return queryParameters.join(" ");
|
|
24
|
+
}`;
|
|
25
|
+
|
|
26
|
+
export const buildTsvCollectionContent = `
|
|
27
|
+
export function buildTsvCollection(queryParameters: string[]) {
|
|
28
|
+
return queryParameters.join("\\t");
|
|
29
|
+
}`;
|