@wictorwilen/cocogen 1.0.50 → 1.1.0-preview.2

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 (71) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +3 -3
  3. package/data/graph-capabilities.json +853 -0
  4. package/data/graph-external-connectors-principal.json +45 -0
  5. package/data/graph-profile-schema.json +322 -1
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +38 -8
  8. package/dist/cli.js.map +1 -1
  9. package/dist/graph/capabilities.d.ts +29 -0
  10. package/dist/graph/capabilities.d.ts.map +1 -0
  11. package/dist/graph/capabilities.js +16 -0
  12. package/dist/graph/capabilities.js.map +1 -0
  13. package/dist/graph/requirements.d.ts +22 -0
  14. package/dist/graph/requirements.d.ts.map +1 -0
  15. package/dist/graph/requirements.js +102 -0
  16. package/dist/graph/requirements.js.map +1 -0
  17. package/dist/init/dotnet/generator.d.ts.map +1 -1
  18. package/dist/init/dotnet/generator.js +94 -22
  19. package/dist/init/dotnet/generator.js.map +1 -1
  20. package/dist/init/dotnet/people-entity.d.ts.map +1 -1
  21. package/dist/init/dotnet/people-entity.js +69 -24
  22. package/dist/init/dotnet/people-entity.js.map +1 -1
  23. package/dist/init/helpers/schema.d.ts +5 -1
  24. package/dist/init/helpers/schema.d.ts.map +1 -1
  25. package/dist/init/helpers/schema.js +8 -0
  26. package/dist/init/helpers/schema.js.map +1 -1
  27. package/dist/init/init.d.ts.map +1 -1
  28. package/dist/init/init.js +17 -23
  29. package/dist/init/init.js.map +1 -1
  30. package/dist/init/people/graph-types.d.ts +4 -0
  31. package/dist/init/people/graph-types.d.ts.map +1 -1
  32. package/dist/init/people/graph-types.js +14 -3
  33. package/dist/init/people/graph-types.js.map +1 -1
  34. package/dist/init/templates/dotnet/Core/ConnectorCore.cs.ejs +242 -44
  35. package/dist/init/templates/dotnet/Core/PeoplePayload.cs.ejs +34 -82
  36. package/dist/init/templates/dotnet/Core/Principal.cs.ejs +16 -18
  37. package/dist/init/templates/dotnet/Generated/Constants.cs.ejs +8 -0
  38. package/dist/init/templates/dotnet/Generated/FromRow.cs.ejs +1 -1
  39. package/dist/init/templates/dotnet/Generated/Model.cs.ejs +1 -1
  40. package/dist/init/templates/dotnet/Program.commandline.cs.ejs +17 -4
  41. package/dist/init/templates/dotnet/README.md.ejs +3 -1
  42. package/dist/init/templates/dotnet/project.csproj.ejs +3 -0
  43. package/dist/init/templates/starter/AGENTS.md.ejs +5 -5
  44. package/dist/init/templates/ts/README.md.ejs +3 -1
  45. package/dist/init/templates/ts/package.json.ejs +5 -0
  46. package/dist/init/templates/ts/src/cli.ts.ejs +16 -4
  47. package/dist/init/templates/ts/src/core/connectorCore.ts.ejs +208 -71
  48. package/dist/init/templates/ts/src/core/people.ts.ejs +99 -27
  49. package/dist/init/templates/ts/src/core/principal.ts.ejs +4 -4
  50. package/dist/init/templates/ts/src/generated/constants.ts.ejs +9 -0
  51. package/dist/init/templates/ts/src/generated/itemPayload.ts.ejs +22 -5
  52. package/dist/init/templates/ts/src/generated/propertyTransformBase.ts.ejs +26 -14
  53. package/dist/init/ts/generator.d.ts.map +1 -1
  54. package/dist/init/ts/generator.js +100 -14
  55. package/dist/init/ts/generator.js.map +1 -1
  56. package/dist/init/ts/people-entity.d.ts.map +1 -1
  57. package/dist/init/ts/people-entity.js +20 -10
  58. package/dist/init/ts/people-entity.js.map +1 -1
  59. package/dist/ir.d.ts +4 -1
  60. package/dist/ir.d.ts.map +1 -1
  61. package/dist/people/label-registry.d.ts +2 -0
  62. package/dist/people/label-registry.d.ts.map +1 -1
  63. package/dist/people/label-registry.js +8 -0
  64. package/dist/people/label-registry.js.map +1 -1
  65. package/dist/tsp/init-tsp.js +2 -2
  66. package/dist/tsp/init-tsp.js.map +1 -1
  67. package/dist/tsp/loader.d.ts.map +1 -1
  68. package/dist/tsp/loader.js +23 -11
  69. package/dist/tsp/loader.js.map +1 -1
  70. package/package.json +3 -1
  71. package/typespec/main.tsp +5 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,45 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.1.0-preview.2] - 2026-04-07
11
+
12
+ ### Fixed
13
+ - `npm run update-graph-profile-schema` now refreshes the profile CSDL snapshot from the official `microsoftgraph/msgraph-metadata` raw schema files because the live Graph `$metadata` endpoints no longer return XML reliably for this workflow.
14
+
15
+ ### Changed
16
+ - People connector metadata refresh and validation now recognize the five current beta-only labels documented for people connectors: `personEducationalActivities`, `personInterests`, `personLanguages`, `personPatents`, and `personPublications`.
17
+ - `externalConnection.contentCategory` now resolves to Graph `v1.0` capability in the generator metadata, matching `principal` and `principalCollection`.
18
+ - People profile source registration now resolves to Graph `v1.0` capability as well, so stable people schemas no longer require preview features unless they use beta-only labels.
19
+
20
+ ## [1.1.0-preview.1] - 2026-03-31
21
+
22
+ ### Changed
23
+ - Principal helper templates for generated TS and .NET connectors are now derived from the live Graph `microsoft.graph.externalConnectors.principal` metadata during `prebuild`, with a checked-in snapshot used as a fallback when metadata refresh is unavailable.
24
+ - Principal and principal-collection schema property types now resolve to `v1.0` Graph capability instead of being treated as beta-only.
25
+
26
+ ### Fixed
27
+ - Generated .NET `PropertyTransformBase` files now indent multi-line people transform expressions consistently, including nested serializer calls and collection object initializers.
28
+
29
+ ### Changed
30
+ - Generated TS and .NET connector CLIs now support `--batch-size` for bounded parallel ingestion, with a default of `1` and a maximum of `20` concurrent item PUT requests per batch.
31
+
32
+ ### Fixed
33
+ - Generated TS and .NET Graph transport layers now retry transient 408/429/5xx responses with exponential backoff, jitter, and `Retry-After`/`x-ms-retry-after-ms` handling, including raw profile-source admin HTTP calls.
34
+ - Generated TypeScript people connectors now reference official stable and beta Microsoft Graph type packages for Graph profile payload models instead of fully redefining those models in generated code.
35
+ - Generated TypeScript people helpers no longer emit redundant field-by-field runtime validation for SDK-backed Graph profile models; they keep only minimal object and read-only checks and still fully validate locally derived helper shapes.
36
+ - Generated TypeScript people payload and transform files now import official stable and beta Microsoft Graph profile types directly instead of routing them through re-exports from `src/core/people.ts`.
37
+ - Generated TypeScript people label serializers now route SDK-backed Graph profile payloads through shared generic SDK serialization helpers instead of emitting per-type validation wrappers.
38
+ - Generated TypeScript connector runtimes now send Graph requests through the official Microsoft Graph client instead of a custom fetch-based transport layer.
39
+ - Generated .NET people property transforms now instantiate official Microsoft Graph SDK profile model types for SDK-backed people payload shapes instead of emitting local copies of those Graph models.
40
+ - Generated .NET people helpers no longer emit duplicate local Graph enum declarations when the generated payloads already bind to the official Microsoft Graph SDK enum types.
41
+ - Generated TS and .NET people helpers now bind Graph `itemBody` through the official Microsoft Graph SDK model types instead of treating it as a local string-like special case.
42
+ - Generated TS and .NET people helpers now omit local model and enum boilerplate when a connector is fully SDK-backed and only needs shared people payload validation/serialization utilities.
43
+ - Generated .NET people payloads now pass inline per-property serialization options into a generic shared people helper instead of relying on emitted label-definition dictionaries and payload-kind enums.
44
+ - Generated .NET people transforms no longer wrap SDK model object initializers in redundant outer casts before serializing them.
45
+ - Generated TypeScript people helpers no longer export the internal label-serialization options type, and generated TS item payloads now avoid importing `contentPropertyName` when the schema has no content field.
46
+ - Generated TypeScript property-transform files now import only the datasource and validation helpers that their rendered transform expressions actually use.
47
+ - Generated TS and .NET people collection transforms no longer emit local `getCollectionValue` helpers when the rendered object graph only needs scalar per-index lookups.
48
+
10
49
  ## [1.0.50] - 2026-03-26
11
50
 
12
51
  ### Fixed
@@ -306,6 +345,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
306
345
  - Collection values no longer split on commas; use semicolons instead.
307
346
 
308
347
  [Unreleased]: https://github.com/wictorwilen/cocogen/compare/v1.0.16...HEAD
348
+ [1.1.0-preview.2]: https://github.com/wictorwilen/cocogen/compare/main...v1.1.0-preview.2
349
+ [1.1.0-preview.1]: https://github.com/wictorwilen/cocogen/compare/main...v1.1.0-preview.1
309
350
  [1.0.50]: https://github.com/wictorwilen/cocogen/compare/main...v1.0.50
310
351
  [1.0.49]: https://github.com/wictorwilen/cocogen/compare/main...v1.0.49
311
352
  [1.0.48]: https://github.com/wictorwilen/cocogen/compare/main...v1.0.48
package/README.md CHANGED
@@ -120,7 +120,7 @@ cocogen --help
120
120
  | `emit` | Emit cocogen IR as JSON | `--tsp <path>`, `--out <path>`, `--use-preview-features` |
121
121
 
122
122
  Notes:
123
- - `--use-preview-features` is required for Graph beta schemas (for example people connectors).
123
+ - `--use-preview-features` is required only when a schema uses Graph beta capabilities such as beta-only people labels.
124
124
 
125
125
  ### Create a starter TypeSpec file
126
126
 
@@ -136,7 +136,7 @@ npx @wictorwilen/cocogen@latest init --prompt
136
136
  npx @wictorwilen/cocogen@latest validate --tsp ./schema.tsp
137
137
  ```
138
138
 
139
- Use `--use-preview-features` for Graph beta schemas (for example people connectors).
139
+ Use `--use-preview-features` when cocogen reports a Graph beta requirement.
140
140
 
141
141
  ### Generate a runnable project
142
142
 
@@ -146,7 +146,7 @@ npx @wictorwilen/cocogen@latest generate --tsp ./schema.tsp --out ./my-connector
146
146
 
147
147
  Notes:
148
148
  - `cocogen` will fail fast if the schema is invalid.
149
- - Beta features require `--use-preview-features`.
149
+ - Graph beta features require `--use-preview-features`.
150
150
  - Use `--data-format custom` to emit a stub datasource for custom backends.
151
151
 
152
152
  ### Update generated code after changing TypeSpec