@wictorwilen/cocogen 1.0.50 → 1.1.0-preview.10
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 +82 -0
- package/README.md +6 -3
- package/data/graph-capabilities.json +853 -0
- package/data/graph-external-connectors-principal.json +45 -0
- package/data/graph-profile-schema.json +322 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +38 -8
- package/dist/cli.js.map +1 -1
- package/dist/graph/capabilities.d.ts +29 -0
- package/dist/graph/capabilities.d.ts.map +1 -0
- package/dist/graph/capabilities.js +16 -0
- package/dist/graph/capabilities.js.map +1 -0
- package/dist/graph/requirements.d.ts +22 -0
- package/dist/graph/requirements.d.ts.map +1 -0
- package/dist/graph/requirements.js +102 -0
- package/dist/graph/requirements.js.map +1 -0
- package/dist/init/dotnet/generator.d.ts +2 -0
- package/dist/init/dotnet/generator.d.ts.map +1 -1
- package/dist/init/dotnet/generator.js +105 -44
- package/dist/init/dotnet/generator.js.map +1 -1
- package/dist/init/dotnet/people-entity.d.ts.map +1 -1
- package/dist/init/dotnet/people-entity.js +70 -24
- package/dist/init/dotnet/people-entity.js.map +1 -1
- package/dist/init/helpers/schema.d.ts +5 -1
- package/dist/init/helpers/schema.d.ts.map +1 -1
- package/dist/init/helpers/schema.js +13 -5
- package/dist/init/helpers/schema.js.map +1 -1
- package/dist/init/init.d.ts.map +1 -1
- package/dist/init/init.js +18 -23
- package/dist/init/init.js.map +1 -1
- package/dist/init/people/graph-types.d.ts +4 -0
- package/dist/init/people/graph-types.d.ts.map +1 -1
- package/dist/init/people/graph-types.js +14 -3
- package/dist/init/people/graph-types.js.map +1 -1
- package/dist/init/templates/dotnet/Core/ConnectorCore.cs.ejs +326 -52
- package/dist/init/templates/dotnet/Core/PeoplePayload.cs.ejs +157 -121
- package/dist/init/templates/dotnet/Core/Principal.cs.ejs +16 -18
- package/dist/init/templates/dotnet/Generated/Constants.cs.ejs +8 -0
- package/dist/init/templates/dotnet/Generated/FromRow.cs.ejs +1 -1
- package/dist/init/templates/dotnet/Generated/Model.cs.ejs +1 -1
- package/dist/init/templates/dotnet/Generated/PropertyTransformBase.cs.ejs +7 -2
- package/dist/init/templates/dotnet/Program.commandline.cs.ejs +18 -9
- package/dist/init/templates/dotnet/PropertyTransform.cs.ejs +42 -1
- package/dist/init/templates/dotnet/README.md.ejs +4 -2
- package/dist/init/templates/dotnet/project.csproj.ejs +3 -0
- package/dist/init/templates/starter/AGENTS.md.ejs +5 -5
- package/dist/init/templates/ts/README.md.ejs +4 -2
- package/dist/init/templates/ts/package.json.ejs +5 -0
- package/dist/init/templates/ts/src/cli.ts.ejs +17 -9
- package/dist/init/templates/ts/src/core/connectorCore.ts.ejs +208 -71
- package/dist/init/templates/ts/src/core/people.ts.ejs +120 -27
- package/dist/init/templates/ts/src/core/principal.ts.ejs +4 -4
- package/dist/init/templates/ts/src/generated/constants.ts.ejs +9 -0
- package/dist/init/templates/ts/src/generated/itemPayload.ts.ejs +22 -5
- package/dist/init/templates/ts/src/generated/propertyTransformBase.ts.ejs +26 -14
- package/dist/init/ts/generator.d.ts.map +1 -1
- package/dist/init/ts/generator.js +100 -14
- package/dist/init/ts/generator.js.map +1 -1
- package/dist/init/ts/people-entity.d.ts.map +1 -1
- package/dist/init/ts/people-entity.js +20 -10
- package/dist/init/ts/people-entity.js.map +1 -1
- package/dist/ir.d.ts +4 -1
- package/dist/ir.d.ts.map +1 -1
- package/dist/people/label-registry.d.ts +2 -0
- package/dist/people/label-registry.d.ts.map +1 -1
- package/dist/people/label-registry.js +8 -0
- package/dist/people/label-registry.js.map +1 -1
- package/dist/tsp/init-tsp.js +2 -2
- package/dist/tsp/init-tsp.js.map +1 -1
- package/dist/tsp/loader.d.ts.map +1 -1
- package/dist/tsp/loader.js +23 -11
- package/dist/tsp/loader.js.map +1 -1
- package/dist/validate/validator.d.ts.map +1 -1
- package/dist/validate/validator.js +46 -0
- package/dist/validate/validator.js.map +1 -1
- package/package.json +3 -1
- package/typespec/main.tsp +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,78 @@ 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.10] - 2026-04-08
|
|
11
|
+
|
|
12
|
+
## [1.1.0-preview.9] - 2026-04-08
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Restored `.NET` people payload serialization parity using final-stage label cleanup in `PeoplePayload.SerializeStringLabel(...)` and `PeoplePayload.SerializeCollectionLabel(...)`: collection `@odata.type` values now include the leading `#` (for example `#Collection(String)`), Kiota date objects are normalized back to `yyyy-MM-dd` strings, enum values are serialized as strings, and useful fields carried via `AdditionalData` are preserved instead of being dropped during normalization.
|
|
16
|
+
- Updated generated `.NET` `FromRow.cs` assignments to use typed `TransformProperty<T>(...)` calls, removing nullable cast warnings (`CS8600`/`CS8601`) caused by the previous `object?` cast path.
|
|
17
|
+
|
|
18
|
+
## [1.1.0-preview.8] - 2026-04-08
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- **For .NET people connectors with custom transforms:** The generated `PropertyTransformBase.cs` no longer embeds normalization logic in each serialization expression. Instead, hand-off to `PeoplePayload.SerializePeopleEntity(object)` which handles serialization + normalization (strips Kiota metadata, removes nulls, converts to camelCase) in one call. If you have custom `PropertyTransform.cs` overrides, they will automatically benefit from normalization; no code changes required. The method signature remains `protected virtual string? Transform<PropName>(object row)`.
|
|
22
|
+
|
|
23
|
+
## [1.1.0-preview.7] - 2026-04-08
|
|
24
|
+
|
|
25
|
+
## [1.1.0-preview.6] - 2026-04-07
|
|
26
|
+
|
|
27
|
+
## [1.1.0-preview.5] - 2026-04-07
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- Generated people connector `provision` commands no longer auto-register the connection as a profile source; use the dedicated `register-profile-source` command instead.
|
|
31
|
+
|
|
32
|
+
## [1.1.0-preview.4] - 2026-04-07
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
- Generated `.NET` people payload helpers no longer re-validate serialized JSON field names and read-only item facet fields at runtime; they now rely on schema validation and typed construction, while still enforcing collection limits.
|
|
36
|
+
|
|
37
|
+
## [1.1.0-preview.3] - 2026-04-07
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
- `cocogen update` now refreshes generated `.NET` `Program.cs` files even without `--include-scaffold`, so schema-driven entrypoint changes do not stay stale after updates.
|
|
41
|
+
- Validation now warns when people-label `@coco.source(..., to)` mappings reference unknown Graph target paths (for example `program.fieldOfStudy` instead of `program.fieldsOfStudy`) so fallback object generation is easier to diagnose.
|
|
42
|
+
|
|
43
|
+
## [1.1.0-preview.2] - 2026-04-07
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
- `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.
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
- People connector metadata refresh and validation now recognize the five current beta-only labels documented for people connectors: `personEducationalActivities`, `personInterests`, `personLanguages`, `personPatents`, and `personPublications`.
|
|
50
|
+
- `externalConnection.contentCategory` now resolves to Graph `v1.0` capability in the generator metadata, matching `principal` and `principalCollection`.
|
|
51
|
+
- 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.
|
|
52
|
+
|
|
53
|
+
## [1.1.0-preview.1] - 2026-03-31
|
|
54
|
+
|
|
55
|
+
### Changed
|
|
56
|
+
- 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.
|
|
57
|
+
- Principal and principal-collection schema property types now resolve to `v1.0` Graph capability instead of being treated as beta-only.
|
|
58
|
+
|
|
59
|
+
### Fixed
|
|
60
|
+
- Generated .NET `PropertyTransformBase` files now indent multi-line people transform expressions consistently, including nested serializer calls and collection object initializers.
|
|
61
|
+
|
|
62
|
+
### Changed
|
|
63
|
+
- 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.
|
|
64
|
+
|
|
65
|
+
### Fixed
|
|
66
|
+
- 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.
|
|
67
|
+
- 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.
|
|
68
|
+
- 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.
|
|
69
|
+
- 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`.
|
|
70
|
+
- 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.
|
|
71
|
+
- Generated TypeScript connector runtimes now send Graph requests through the official Microsoft Graph client instead of a custom fetch-based transport layer.
|
|
72
|
+
- 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.
|
|
73
|
+
- 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.
|
|
74
|
+
- 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.
|
|
75
|
+
- 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.
|
|
76
|
+
- 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.
|
|
77
|
+
- Generated .NET people transforms no longer wrap SDK model object initializers in redundant outer casts before serializing them.
|
|
78
|
+
- 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.
|
|
79
|
+
- Generated TypeScript property-transform files now import only the datasource and validation helpers that their rendered transform expressions actually use.
|
|
80
|
+
- Generated TS and .NET people collection transforms no longer emit local `getCollectionValue` helpers when the rendered object graph only needs scalar per-index lookups.
|
|
81
|
+
|
|
10
82
|
## [1.0.50] - 2026-03-26
|
|
11
83
|
|
|
12
84
|
### Fixed
|
|
@@ -306,6 +378,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
306
378
|
- Collection values no longer split on commas; use semicolons instead.
|
|
307
379
|
|
|
308
380
|
[Unreleased]: https://github.com/wictorwilen/cocogen/compare/v1.0.16...HEAD
|
|
381
|
+
[1.1.0-preview.10]: https://github.com/wictorwilen/cocogen/compare/main...v1.1.0-preview.10
|
|
382
|
+
[1.1.0-preview.9]: https://github.com/wictorwilen/cocogen/compare/main...v1.1.0-preview.9
|
|
383
|
+
[1.1.0-preview.8]: https://github.com/wictorwilen/cocogen/compare/main...v1.1.0-preview.8
|
|
384
|
+
[1.1.0-preview.7]: https://github.com/wictorwilen/cocogen/compare/main...v1.1.0-preview.7
|
|
385
|
+
[1.1.0-preview.6]: https://github.com/wictorwilen/cocogen/compare/main...v1.1.0-preview.6
|
|
386
|
+
[1.1.0-preview.5]: https://github.com/wictorwilen/cocogen/compare/main...v1.1.0-preview.5
|
|
387
|
+
[1.1.0-preview.4]: https://github.com/wictorwilen/cocogen/compare/main...v1.1.0-preview.4
|
|
388
|
+
[1.1.0-preview.3]: https://github.com/wictorwilen/cocogen/compare/main...v1.1.0-preview.3
|
|
389
|
+
[1.1.0-preview.2]: https://github.com/wictorwilen/cocogen/compare/main...v1.1.0-preview.2
|
|
390
|
+
[1.1.0-preview.1]: https://github.com/wictorwilen/cocogen/compare/main...v1.1.0-preview.1
|
|
309
391
|
[1.0.50]: https://github.com/wictorwilen/cocogen/compare/main...v1.0.50
|
|
310
392
|
[1.0.49]: https://github.com/wictorwilen/cocogen/compare/main...v1.0.49
|
|
311
393
|
[1.0.48]: https://github.com/wictorwilen/cocogen/compare/main...v1.0.48
|
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
## What you can do with the generated project 🔧
|
|
32
32
|
- ✅ Create or update an external connection
|
|
33
33
|
- ✅ Patch schema changes
|
|
34
|
+
- ✅ Register a people profile source with a dedicated command
|
|
34
35
|
- ✅ Ingest items from CSV (or your own datasource)
|
|
35
36
|
- ✅ Retry throttled requests with backoff + logging
|
|
36
37
|
- ✅ Customize transforms without losing changes on update
|
|
@@ -120,7 +121,7 @@ cocogen --help
|
|
|
120
121
|
| `emit` | Emit cocogen IR as JSON | `--tsp <path>`, `--out <path>`, `--use-preview-features` |
|
|
121
122
|
|
|
122
123
|
Notes:
|
|
123
|
-
- `--use-preview-features` is required
|
|
124
|
+
- `--use-preview-features` is required only when a schema uses Graph beta capabilities such as beta-only people labels.
|
|
124
125
|
|
|
125
126
|
### Create a starter TypeSpec file
|
|
126
127
|
|
|
@@ -136,7 +137,7 @@ npx @wictorwilen/cocogen@latest init --prompt
|
|
|
136
137
|
npx @wictorwilen/cocogen@latest validate --tsp ./schema.tsp
|
|
137
138
|
```
|
|
138
139
|
|
|
139
|
-
Use `--use-preview-features`
|
|
140
|
+
Use `--use-preview-features` when cocogen reports a Graph beta requirement.
|
|
140
141
|
|
|
141
142
|
### Generate a runnable project
|
|
142
143
|
|
|
@@ -146,7 +147,7 @@ npx @wictorwilen/cocogen@latest generate --tsp ./schema.tsp --out ./my-connector
|
|
|
146
147
|
|
|
147
148
|
Notes:
|
|
148
149
|
- `cocogen` will fail fast if the schema is invalid.
|
|
149
|
-
-
|
|
150
|
+
- Graph beta features require `--use-preview-features`.
|
|
150
151
|
- Use `--data-format custom` to emit a stub datasource for custom backends.
|
|
151
152
|
|
|
152
153
|
### Update generated code after changing TypeSpec
|
|
@@ -159,6 +160,8 @@ When you change the schema, regenerate only the TypeSpec-derived files:
|
|
|
159
160
|
npx @wictorwilen/cocogen@latest update --out ./my-connector
|
|
160
161
|
```
|
|
161
162
|
|
|
163
|
+
For generated .NET projects, `update` also refreshes `Program.cs` because it carries schema-derived wiring such as the item model and people-connector provisioning flow.
|
|
164
|
+
|
|
162
165
|
Override the TypeSpec entrypoint (also updates `cocogen.json`):
|
|
163
166
|
|
|
164
167
|
```bash
|