@azure-tools/typespec-ts 0.44.1 → 0.45.1-alpha.20251013.1

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/src/index.js +1 -1
  3. package/dist/src/index.js.map +1 -1
  4. package/dist/src/lib.d.ts +64 -1
  5. package/dist/src/lib.d.ts.map +1 -1
  6. package/dist/src/lib.js +42 -0
  7. package/dist/src/lib.js.map +1 -1
  8. package/dist/src/modular/buildRootIndex.d.ts +1 -1
  9. package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
  10. package/dist/src/modular/buildRootIndex.js +19 -3
  11. package/dist/src/modular/buildRootIndex.js.map +1 -1
  12. package/dist/src/modular/emitModels.d.ts.map +1 -1
  13. package/dist/src/modular/emitModels.js +9 -5
  14. package/dist/src/modular/emitModels.js.map +1 -1
  15. package/dist/src/modular/emitSamples.js +31 -6
  16. package/dist/src/modular/emitSamples.js.map +1 -1
  17. package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
  18. package/dist/src/modular/helpers/operationHelpers.js +10 -1
  19. package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
  20. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +1 -1
  21. package/dist/src/modular/serialization/buildDeserializerFunction.js +28 -6
  22. package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
  23. package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +1 -1
  24. package/dist/src/modular/serialization/buildSerializerFunction.js +28 -6
  25. package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
  26. package/dist/src/transform/transformApiVersionInfo.d.ts.map +1 -1
  27. package/dist/src/transform/transformApiVersionInfo.js +2 -1
  28. package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
  29. package/dist/src/transform/transformParameters.js +1 -1
  30. package/dist/src/transform/transformParameters.js.map +1 -1
  31. package/dist/src/transform/transformPaths.js +1 -1
  32. package/dist/src/transform/transformPaths.js.map +1 -1
  33. package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
  34. package/dist/src/transform/transfromRLCOptions.js +1 -5
  35. package/dist/src/transform/transfromRLCOptions.js.map +1 -1
  36. package/dist/src/utils/emitUtil.d.ts.map +1 -1
  37. package/dist/src/utils/emitUtil.js +12 -3
  38. package/dist/src/utils/emitUtil.js.map +1 -1
  39. package/dist/src/utils/modelUtils.d.ts +0 -2
  40. package/dist/src/utils/modelUtils.d.ts.map +1 -1
  41. package/dist/src/utils/modelUtils.js +3 -22
  42. package/dist/src/utils/modelUtils.js.map +1 -1
  43. package/dist/src/utils/operationUtil.d.ts +1 -5
  44. package/dist/src/utils/operationUtil.d.ts.map +1 -1
  45. package/dist/src/utils/operationUtil.js +2 -52
  46. package/dist/src/utils/operationUtil.js.map +1 -1
  47. package/dist/tsconfig.tsbuildinfo +1 -1
  48. package/package.json +22 -22
  49. package/src/index.ts +1 -1
  50. package/src/lib.ts +42 -0
  51. package/src/modular/buildRootIndex.ts +19 -7
  52. package/src/modular/emitModels.ts +9 -8
  53. package/src/modular/emitSamples.ts +29 -4
  54. package/src/modular/helpers/operationHelpers.ts +11 -1
  55. package/src/modular/serialization/buildDeserializerFunction.ts +28 -6
  56. package/src/modular/serialization/buildSerializerFunction.ts +28 -6
  57. package/src/transform/transformApiVersionInfo.ts +2 -1
  58. package/src/transform/transformParameters.ts +1 -1
  59. package/src/transform/transformPaths.ts +1 -1
  60. package/src/transform/transfromRLCOptions.ts +1 -5
  61. package/src/utils/emitUtil.ts +16 -4
  62. package/src/utils/modelUtils.ts +3 -37
  63. package/src/utils/operationUtil.ts +1 -60
@@ -13,11 +13,7 @@ import {
13
13
  ResponseMetadata,
14
14
  ResponseTypes
15
15
  } from "@azure-tools/rlc-common";
16
- import {
17
- getLroMetadata,
18
- getPagedResult,
19
- PagedResultMetadata
20
- } from "@azure-tools/typespec-azure-core";
16
+ import { getLroMetadata } from "@azure-tools/typespec-azure-core";
21
17
  import {
22
18
  getHttpOperationWithCache,
23
19
  getWireName,
@@ -34,7 +30,6 @@ import {
34
30
  } from "@azure-tools/typespec-client-generator-core";
35
31
  import {
36
32
  isList,
37
- Model,
38
33
  ModelProperty,
39
34
  NoTarget,
40
35
  Operation,
@@ -392,19 +387,6 @@ export function extractPageDetails(
392
387
  nextLinkNames: [nextLinkNames],
393
388
  itemNames: [itemNames]
394
389
  };
395
- } else {
396
- // TODO: remember to remove this once Azure Paging is removed.
397
- for (const response of operation.responses) {
398
- const paged = extractPagedMetadataNested(program, response.type as Model);
399
- if (paged) {
400
- const nextLinkName = parseNextLinkName(paged) ?? "nextLink";
401
- const itemName = parseItemName(paged) ?? "value";
402
- return {
403
- nextLinkNames: [nextLinkName],
404
- itemNames: [itemName]
405
- };
406
- }
407
- }
408
390
  }
409
391
  return undefined;
410
392
  }
@@ -470,36 +452,6 @@ export function hasPagingOperations(client: SdkClient, dpgContext: SdkContext) {
470
452
  return false;
471
453
  }
472
454
 
473
- export function extractPagedMetadataNested(
474
- program: Program,
475
- type: Model
476
- ): PagedResultMetadata | undefined {
477
- // This only works for `is Page<T>` not `extends Page<T>`.
478
- let paged = getPagedResult(program, type);
479
- if (paged) {
480
- return paged;
481
- }
482
- if (type.baseModel) {
483
- paged = getPagedResult(program, type.baseModel);
484
- }
485
- if (paged) {
486
- return paged;
487
- }
488
- const templateArguments = type.templateMapper?.args;
489
- if (templateArguments) {
490
- for (const argument of templateArguments) {
491
- const modelArgument = argument as Model;
492
- if (modelArgument) {
493
- paged = extractPagedMetadataNested(program, modelArgument);
494
- if (paged) {
495
- return paged;
496
- }
497
- }
498
- }
499
- }
500
- return paged;
501
- }
502
-
503
455
  export function hasCollectionFormatInfo(
504
456
  paramType: string,
505
457
  paramFormat: string
@@ -626,17 +578,6 @@ export function isIgnoredHeaderParam(param: HttpOperationParameter) {
626
578
  );
627
579
  }
628
580
 
629
- export function parseNextLinkName(
630
- paged: PagedResultMetadata
631
- ): string | undefined {
632
- return paged.nextLinkProperty?.name;
633
- }
634
-
635
- export function parseItemName(paged: PagedResultMetadata): string | undefined {
636
- // TODO: support the nested item names
637
- return (paged.itemsSegments ?? [])[0];
638
- }
639
-
640
581
  export type ServiceOperation = SdkServiceMethod<SdkHttpOperation> & {
641
582
  oriName?: string;
642
583
  };