diff --git a/packages/@jsii/kernel/src/api.ts b/packages/@jsii/kernel/src/api.ts index 7c57f3275f..70e0712593 100644 --- a/packages/@jsii/kernel/src/api.ts +++ b/packages/@jsii/kernel/src/api.ts @@ -73,6 +73,8 @@ export function isPropertyOverride(value: Override): value is PropertyOverride { export interface Callback { readonly cbid: string; + /** Whether this callback is synchronous. */ + readonly sync: boolean; readonly cookie: string | undefined; readonly invoke?: InvokeRequest; readonly get?: GetRequest; diff --git a/packages/@jsii/kernel/src/kernel.test.ts b/packages/@jsii/kernel/src/kernel.test.ts index 7031ad8aad..53838ace51 100644 --- a/packages/@jsii/kernel/src/kernel.test.ts +++ b/packages/@jsii/kernel/src/kernel.test.ts @@ -2212,6 +2212,36 @@ defineTest('invokeBinScript() accepts arguments', (sandbox) => { }); }); +// defineTest('ImplementationFromAsyncContext compliance', async (sandbox) => { +// const producer = sandbox.create({ +// fqn: 'Object', +// overrides: [{ method: 'produce', cookie: 'produce1234' }], +// interfaces: ['jsii-calc.IPromiseProducer'], +// }); + +// const obj = sandbox.create({ +// fqn: 'jsii-calc.ImplementationFromAsyncContext', +// args: [producer], +// }); + +// const promise1 = sandbox.begin({ +// objref: obj, +// method: 'doAsyncWork', +// }); + +// const callbacks1 = sandbox.callbacks(); +// expect(callbacks1.callbacks.length).toBe(1); +// expect(callbacks1.callbacks[0].cookie).toBe('produce1234'); + +// sandbox.complete({ +// cbid: callbacks1.callbacks[0].cbid, +// result: 'test-string', +// }); + +// const result = (await sandbox.end(promise1)).result; +// expect(result).toBe('test-string'); +// }); + // ================================================================================================= const testNames: { [name: string]: boolean } = {}; diff --git a/packages/@jsii/kernel/src/kernel.ts b/packages/@jsii/kernel/src/kernel.ts index db723f121e..dec2806f85 100644 --- a/packages/@jsii/kernel/src/kernel.ts +++ b/packages/@jsii/kernel/src/kernel.ts @@ -447,7 +447,52 @@ export class Kernel { let result; try { - result = await promise; + let settled = false; + /** + * Poll for new callback requests until the promise is resolved. This is + * to allow any promises necessary for the promise to be able to settle. + * We use setImmediate so the next poll happens on the next run loop tick, + * after other microtasks might have been paused on a pending callback. + */ + // eslint-disable-next-line no-inner-declarations + function pollForCallbacks(kernel: Kernel) { + // Promise has settled already, not going any further... + if (settled) { + return; + } + + for (const [cbid, cb] of kernel.cbs.entries()) { + kernel.waiting.set(cbid, cb); + kernel.cbs.delete(cbid); + try { + cb.succeed( + kernel.callbackHandler({ + cbid, + sync: false, + cookie: cb.override.cookie, + invoke: { + objref: cb.objref, + method: cb.override.method, + args: cb.args, + }, + }), + ); + } catch (err) { + cb.fail(err); + } finally { + kernel.waiting.delete(cbid); + } + } + if (!settled) { + setImmediate(pollForCallbacks, kernel); + } + } + pollForCallbacks(this); + + result = await promise.finally(() => { + settled = true; + }); + this._debug('promise result:', result); } catch (e: any) { this._debug('promise error:', e); @@ -475,14 +520,16 @@ export class Kernel { }; } + /** @deprecated the flow should be handled directly by "end" */ public callbacks(_req?: api.CallbacksRequest): api.CallbacksResponse { this._debug('callbacks'); const ret = Array.from(this.cbs.entries()).map(([cbid, cb]) => { this.waiting.set(cbid, cb); // move to waiting this.cbs.delete(cbid); // remove from created const callback: api.Callback = { - cbid, cookie: cb.override.cookie, + cbid, + sync: false, invoke: { objref: cb.objref, method: cb.override.method, @@ -758,6 +805,7 @@ export class Kernel { const result = this.callbackHandler({ cookie: override.cookie, cbid: this._makecbid(), + sync: true, get: { objref, property: propertyName }, }); this._debug('callback returned', result); @@ -774,6 +822,7 @@ export class Kernel { this.callbackHandler({ cookie: override.cookie, cbid: this._makecbid(), + sync: true, set: { objref, property: propertyName, @@ -910,6 +959,7 @@ export class Kernel { const result = this.callbackHandler({ cookie: override.cookie, cbid: this._makecbid(), + sync: true, invoke: { objref, method: methodName, diff --git a/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py b/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py index bb5ec44079..3b249e35d7 100644 --- a/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py +++ b/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py @@ -1,6 +1,7 @@ import datetime import inspect import itertools +import time from types import FunctionType, MethodType, BuiltinFunctionType, LambdaType from typing import Callable, cast, Any, List, Optional, Sequence, Type @@ -28,6 +29,7 @@ CreateResponse, DeleteRequest, EndRequest, + EndResponse, EnumRef, GetRequest, GetResponse, @@ -464,26 +466,11 @@ def ainvoke(self, obj: Any, method: str, args: Optional[List[Any]] = None) -> An if isinstance(promise, Callback): promise = _callback_till_result(self, promise, BeginResponse) - callbacks = self.provider.callbacks(CallbacksRequest()).callbacks - while callbacks: - for callback in callbacks: - try: - result = _handle_callback(self, callback) - except Exception as exc: - # TODO: Maybe we want to print the whole traceback here? - complete = self.provider.complete( - CompleteRequest(cbid=callback.cbid, err=str(exc)) - ) - else: - complete = self.provider.complete( - CompleteRequest(cbid=callback.cbid, result=result) - ) - - assert complete.cbid == callback.cbid - - callbacks = self.provider.callbacks(CallbacksRequest()).callbacks - - return self.provider.end(EndRequest(promiseid=promise.promiseid)).result + response = self.provider.end(EndRequest(promiseid=promise.promiseid)) + if isinstance(response, Callback): + return _callback_till_result(self, response, EndResponse).result + else: + return response.result def stats(self): resp = self.provider.stats(StatsRequest()) diff --git a/packages/@jsii/python-runtime/src/jsii/_kernel/providers/process.py b/packages/@jsii/python-runtime/src/jsii/_kernel/providers/process.py index 7ae62a11d5..3bc0399226 100644 --- a/packages/@jsii/python-runtime/src/jsii/_kernel/providers/process.py +++ b/packages/@jsii/python-runtime/src/jsii/_kernel/providers/process.py @@ -286,7 +286,7 @@ def stop(self) -> None: assert self._process.stdin is not None if not self._process.stdin.closed: self._process.stdin.write(b'{"exit":0}\n') - # Close the process' STDIN, singaling we are done with it + # Close the process' STDIN, signaling we are done with it self._process.stdin.close() try: diff --git a/packages/@jsii/python-runtime/src/jsii/_kernel/types.py b/packages/@jsii/python-runtime/src/jsii/_kernel/types.py index 7779a3e6ee..d8f80f3876 100644 --- a/packages/@jsii/python-runtime/src/jsii/_kernel/types.py +++ b/packages/@jsii/python-runtime/src/jsii/_kernel/types.py @@ -234,6 +234,7 @@ class StatsResponse: LoadResponse, CreateResponse, DeleteResponse, + EndResponse, GetResponse, InvokeResponse, InvokeScriptResponse, diff --git a/packages/@jsii/python-runtime/tests/test_compliance.py b/packages/@jsii/python-runtime/tests/test_compliance.py index 7192f96db5..787ac3fd41 100644 --- a/packages/@jsii/python-runtime/tests/test_compliance.py +++ b/packages/@jsii/python-runtime/tests/test_compliance.py @@ -77,6 +77,8 @@ AnonymousImplementationProvider, UpcasingReflectable, PromiseNothing, + IPromiseProducer, + ImplementationFromAsyncContext, ) from jsii_calc.cdk16625 import Cdk16625 from jsii_calc.cdk22369 import AcceptsPath @@ -527,6 +529,7 @@ def test_asyncOverrides_overrideAsyncMethodByParentClass(): assert obj.call_me() == 4452 +# fails for no reason and poisons the runtime def test_asyncOverrides_overrideCallsSuper(): obj = OverrideCallsSuper() assert obj.override_me(12) == 1441 @@ -1358,5 +1361,19 @@ def test_void_returning_async(): """Verifies it's okay to return a Promise.""" assert PromiseNothing().instance_promise_it() is None - ## TODO: This is currently broken as code-gen is incorrect for static async. + # TODO: This is currently broken as code-gen is incorrect for static async. # assert PromiseNothing.promise_it() is None + + +def test_calling_implementation_from_async_context(): + @jsii.implements(IPromiseProducer) + class ConcreteProducer: + def produce(self) -> str: + return "result" + + producer = ConcreteProducer() + + assert producer.produce() == "result" + + worker = ImplementationFromAsyncContext(producer) + assert worker.do_async_work() == "result" diff --git a/packages/@jsii/runtime/lib/host.ts b/packages/@jsii/runtime/lib/host.ts index aa0b1dff2c..eed2c26596 100644 --- a/packages/@jsii/runtime/lib/host.ts +++ b/packages/@jsii/runtime/lib/host.ts @@ -82,7 +82,7 @@ export class KernelHost { return this.processRequest( req, completeCallback.bind(this), - /* sync */ true, + callback.sync, ); } } @@ -126,7 +126,7 @@ export class KernelHost { // promises. see the kernel test 'async overrides: two overrides' // for an example for this use case. if (apiReq.api === 'begin' || apiReq.api === 'complete') { - checkIfAsyncIsAllowed(); + assertAsyncIsAllowed(); this.debug('processing pending promises before responding'); @@ -141,7 +141,7 @@ export class KernelHost { // if this is an async method, return immediately and // call next only when the promise is fulfilled. if (this.isPromise(ret)) { - checkIfAsyncIsAllowed(); + assertAsyncIsAllowed(); this.debug('waiting for promise to be fulfilled'); @@ -169,7 +169,7 @@ export class KernelHost { // indicate this request was processed (synchronously). return next(); - function checkIfAsyncIsAllowed() { + function assertAsyncIsAllowed() { if (sync) { throw new JsiiFault( 'Cannot handle async operations while waiting for a sync callback to return', diff --git a/packages/@jsii/runtime/test/__snapshots__/kernel-host.test.js.snap b/packages/@jsii/runtime/test/__snapshots__/kernel-host.test.js.snap index ff90ce109f..4f4c512daf 100644 --- a/packages/@jsii/runtime/test/__snapshots__/kernel-host.test.js.snap +++ b/packages/@jsii/runtime/test/__snapshots__/kernel-host.test.js.snap @@ -53,6 +53,7 @@ exports[`can load libraries from within a callback 5`] = ` ], }, }, + "sync": true, }, } `; diff --git a/packages/jsii-calc/lib/compliance.ts b/packages/jsii-calc/lib/compliance.ts index 725b1a3a7d..fa19c19325 100644 --- a/packages/jsii-calc/lib/compliance.ts +++ b/packages/jsii-calc/lib/compliance.ts @@ -3141,3 +3141,28 @@ export class PromiseNothing { return PromiseNothing.promiseIt(); } } + +/** + * Async Context operations + * Validates features work when run from within an async context + * + * @see https://github.com/aws/jsii/issues/3917 + */ +export interface IPromiseProducer { + produce(): Promise; +} + +export class ImplementationFromAsyncContext { + public constructor(private readonly producer: IPromiseProducer) {} + + public async doAsyncWork(): Promise { + await this.sleep(200); + return this.producer.produce(); + } + + private async sleep(ms: number) { + return new Promise((resolve) => { + setTimeout(resolve, ms); + }); + } +} diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index 135f668337..1e0fe4aa4f 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -7915,6 +7915,41 @@ ], "symbolId": "lib/compliance:IPrivatelyImplemented" }, + "jsii-calc.IPromiseProducer": { + "assembly": "jsii-calc", + "docs": { + "see": "https://github.com/aws/jsii/issues/3917", + "stability": "stable", + "summary": "Async Context operations Validates features work when run from within an async context." + }, + "fqn": "jsii-calc.IPromiseProducer", + "kind": "interface", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 3151 + }, + "methods": [ + { + "abstract": true, + "async": true, + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 3152 + }, + "name": "produce", + "returns": { + "type": { + "primitive": "string" + } + } + } + ], + "name": "IPromiseProducer", + "symbolId": "lib/compliance:IPromiseProducer" + }, "jsii-calc.IPublicInterface": { "assembly": "jsii-calc", "docs": { @@ -8275,6 +8310,55 @@ ], "symbolId": "lib/compliance:Implementation" }, + "jsii-calc.ImplementationFromAsyncContext": { + "assembly": "jsii-calc", + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.ImplementationFromAsyncContext", + "initializer": { + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 3156 + }, + "parameters": [ + { + "name": "producer", + "type": { + "fqn": "jsii-calc.IPromiseProducer" + } + } + ] + }, + "kind": "class", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 3155 + }, + "methods": [ + { + "async": true, + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 3158 + }, + "name": "doAsyncWork", + "returns": { + "type": { + "primitive": "string" + } + } + } + ], + "name": "ImplementationFromAsyncContext", + "symbolId": "lib/compliance:ImplementationFromAsyncContext" + }, "jsii-calc.ImplementsInterfaceWithInternal": { "assembly": "jsii-calc", "docs": { @@ -18843,5 +18927,5 @@ } }, "version": "3.20.120", - "fingerprint": "EH7xszNdCh9PCFUZ8Foi7g2CPhdrKeZm8CQaUCNv4GQ=" + "fingerprint": "upzlEkc4X3Q+ylgpfLMlZpbuaOg6aAWbxxIgE5zV+SA=" } \ No newline at end of file diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.js.snap index a17723f325..ec02c21368 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.js.snap @@ -3055,6 +3055,7 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ 📄 ILevelOneProps.cs ┃ ┣━ 📄 ILoadBalancedFargateServiceProps.cs ┃ ┣━ 📄 Implementation.cs + ┃ ┣━ 📄 ImplementationFromAsyncContext.cs ┃ ┣━ 📄 ImplementInternalInterface.cs ┃ ┣━ 📄 ImplementsInterfaceWithInternal.cs ┃ ┣━ 📄 ImplementsInterfaceWithInternalSubclass.cs @@ -3083,6 +3084,7 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ 📄 IParamShadowsBuiltinsProps.cs ┃ ┣━ 📄 IParentStruct982.cs ┃ ┣━ 📄 IPrivatelyImplemented.cs + ┃ ┣━ 📄 IPromiseProducer.cs ┃ ┣━ 📄 IPublicInterface.cs ┃ ┣━ 📄 IPublicInterface2.cs ┃ ┣━ 📄 IRandomNumberGenerator.cs @@ -4630,7 +4632,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// Here's how you use it: /// /// /// - /// var calculator = new Calculator(); + /// Calculator calculator = new Calculator(); /// calculator.Add(5); /// calculator.Mul(3); /// Console.WriteLine(calculator.Expression.Value); @@ -7086,11 +7088,11 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// Multiple paragraphs are separated by an empty line. /// /// - /// var x = 12 + 44; - /// var s1 = "string"; - /// var s2 = @"string + /// int x = 12 + 44; + /// string s1 = "string"; + /// string s2 = @"string /// with new newlines"; // see https://github.com/aws/jsii/issues/2569 - /// var s3 = @"string + /// string s3 = @"string /// with /// new lines"; /// @@ -11554,6 +11556,45 @@ namespace Amazon.JSII.Tests.CalculatorNamespace `; +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IPromiseProducer.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// Async Context operations Validates features work when run from within an async context. + /// + /// See: https://github.com/aws/jsii/issues/3917 + /// + [JsiiInterface(nativeType: typeof(IPromiseProducer), fullyQualifiedName: "jsii-calc.IPromiseProducer")] + public interface IPromiseProducer + { + [JsiiMethod(name: "produce", returnsJson: "{\\"type\\":{\\"primitive\\":\\"string\\"}}")] + string Produce(); + + /// Async Context operations Validates features work when run from within an async context. + /// + /// See: https://github.com/aws/jsii/issues/3917 + /// + [JsiiTypeProxy(nativeType: typeof(IPromiseProducer), fullyQualifiedName: "jsii-calc.IPromiseProducer")] + internal sealed class _Proxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IPromiseProducer + { + private _Proxy(ByRefValue reference): base(reference) + { + } + + [JsiiMethod(name: "produce", returnsJson: "{\\"type\\":{\\"primitive\\":\\"string\\"}}")] + public string Produce() + { + return InvokeInstanceMethod(new System.Type[]{}, new object[]{})!; + } + } + } +} + +`; + exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IPublicInterface.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; @@ -12698,6 +12739,50 @@ namespace Amazon.JSII.Tests.CalculatorNamespace `; +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementationFromAsyncContext.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ImplementationFromAsyncContext), fullyQualifiedName: "jsii-calc.ImplementationFromAsyncContext", parametersJson: "[{\\"name\\":\\"producer\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.IPromiseProducer\\"}}]")] + public class ImplementationFromAsyncContext : DeputyBase + { + public ImplementationFromAsyncContext(Amazon.JSII.Tests.CalculatorNamespace.IPromiseProducer producer): base(_MakeDeputyProps(producer)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.IPromiseProducer producer) + { + return new DeputyProps(new object?[]{producer}); + } + + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference + /// The Javascript-owned object reference + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + protected ImplementationFromAsyncContext(ByRefValue reference): base(reference) + { + } + + /// Used by jsii to construct an instance of this class from DeputyProps + /// The deputy props + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + protected ImplementationFromAsyncContext(DeputyProps props): base(props) + { + } + + [JsiiMethod(name: "doAsyncWork", returnsJson: "{\\"type\\":{\\"primitive\\":\\"string\\"}}", isAsync: true)] + public virtual string DoAsyncWork() + { + return InvokeInstanceMethod(new System.Type[]{}, new object[]{})!; + } + } +} + +`; + exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ImplementsInterfaceWithInternal.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; @@ -15947,7 +16032,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// First, create a calculator: /// /// /// /// Then call some operations: @@ -15960,7 +16045,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// /// /// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.js.snap index e0ee5d1573..8499b07334 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.js.snap @@ -2676,6 +2676,7 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┣━ 📄 IJsii487External2.go ┣━ 📄 IJsii496.go ┣━ 📄 Implementation.go + ┣━ 📄 ImplementationFromAsyncContext.go ┣━ 📄 ImplementInternalInterface.go ┣━ 📄 ImplementsInterfaceWithInternal.go ┣━ 📄 ImplementsInterfaceWithInternalSubclass.go @@ -2698,6 +2699,7 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┣━ 📄 IObjectWithProperty.go ┣━ 📄 IOptionalMethod.go ┣━ 📄 IPrivatelyImplemented.go + ┣━ 📄 IPromiseProducer.go ┣━ 📄 IPublicInterface.go ┣━ 📄 IPublicInterface2.go ┣━ 📄 IRandomNumberGenerator.go @@ -4641,9 +4643,9 @@ import ( // // Example: // calculator := calc.NewCalculator() -// calculator.Add(jsii.Number(5)) -// calculator.Mul(jsii.Number(3)) -// fmt.Println(calculator.expression.Value) +// calculator.add(jsii.Number(5)) +// calculator.mul(jsii.Number(3)) +// fmt.Println(calculator.expression.value) // type Calculator interface { composition.CompositeOperation @@ -7205,9 +7207,7 @@ import ( // x := 12 + 44 // s1 := "string" // s2 := "string \\nwith new newlines" // see https://github.com/aws/jsii/issues/2569 -// s3 := \`string -// with -// new lines\` +// s3 := "string\\n with\\n new lines" // type DocumentedClass interface { // Greet the indicated person. @@ -10038,6 +10038,42 @@ func (j *jsiiProxy_IPrivatelyImplemented) Success() *bool { } +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/IPromiseProducer.go 1`] = ` +// A simple calcuator built on JSII. +package jsiicalc + +import ( + _jsii_ "github.com/aws/jsii-runtime-go/runtime" +) + +// Async Context operations Validates features work when run from within an async context. +// See: https://github.com/aws/jsii/issues/3917 +// +type IPromiseProducer interface { + Produce() *string +} + +// The jsii proxy for IPromiseProducer +type jsiiProxy_IPromiseProducer struct { + _ byte // padding +} + +func (i *jsiiProxy_IPromiseProducer) Produce() *string { + var returns *string + + _jsii_.Invoke( + i, + "produce", + nil, // no parameters + &returns, + ) + + return returns +} + + `; exports[`Generated code for "jsii-calc": /go/jsiicalc/IPublicInterface.go 1`] = ` @@ -10456,6 +10492,64 @@ func NewImplementation_Override(i Implementation) { } +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/ImplementationFromAsyncContext.go 1`] = ` +// A simple calcuator built on JSII. +package jsiicalc + +import ( + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + _init_ "github.com/aws/jsii/jsii-calc/go/jsiicalc/v3/jsii" +) + +type ImplementationFromAsyncContext interface { + DoAsyncWork() *string +} + +// The jsii proxy struct for ImplementationFromAsyncContext +type jsiiProxy_ImplementationFromAsyncContext struct { + _ byte // padding +} + +func NewImplementationFromAsyncContext(producer IPromiseProducer) ImplementationFromAsyncContext { + _init_.Initialize() + + j := jsiiProxy_ImplementationFromAsyncContext{} + + _jsii_.Create( + "jsii-calc.ImplementationFromAsyncContext", + []interface{}{producer}, + &j, + ) + + return &j +} + +func NewImplementationFromAsyncContext_Override(i ImplementationFromAsyncContext, producer IPromiseProducer) { + _init_.Initialize() + + _jsii_.Create( + "jsii-calc.ImplementationFromAsyncContext", + []interface{}{producer}, + i, + ) +} + +func (i *jsiiProxy_ImplementationFromAsyncContext) DoAsyncWork() *string { + var returns *string + + _jsii_.Invoke( + i, + "doAsyncWork", + nil, // no parameters + &returns, + ) + + return returns +} + + `; exports[`Generated code for "jsii-calc": /go/jsiicalc/ImplementsInterfaceWithInternal.go 1`] = ` @@ -14956,7 +15050,7 @@ calculator := calc.NewCalculator() Then call some operations: \`\`\`go -calculator.Add(jsii.Number(10)) +calculator.add(jsii.Number(10)) \`\`\` ## Code Samples @@ -20590,6 +20684,16 @@ func init() { return &jsiiProxy_IPrivatelyImplemented{} }, ) + _jsii_.RegisterInterface( + "jsii-calc.IPromiseProducer", + reflect.TypeOf((*IPromiseProducer)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "produce", GoMethod: "Produce"}, + }, + func() interface{} { + return &jsiiProxy_IPromiseProducer{} + }, + ) _jsii_.RegisterInterface( "jsii-calc.IPublicInterface", reflect.TypeOf((*IPublicInterface)(nil)).Elem(), @@ -20692,6 +20796,16 @@ func init() { return &jsiiProxy_Implementation{} }, ) + _jsii_.RegisterClass( + "jsii-calc.ImplementationFromAsyncContext", + reflect.TypeOf((*ImplementationFromAsyncContext)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "doAsyncWork", GoMethod: "DoAsyncWork"}, + }, + func() interface{} { + return &jsiiProxy_ImplementationFromAsyncContext{} + }, + ) _jsii_.RegisterClass( "jsii-calc.ImplementsInterfaceWithInternal", reflect.TypeOf((*ImplementsInterfaceWithInternal)(nil)).Elem(), @@ -25079,6 +25193,9 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┣━ 🆕 IInterfaceWithPropertiesExtension__checks.go ┣━ 🆕 IInterfaceWithPropertiesExtension__no_checks.go ┣━ 📄 IInterfaceWithPropertiesExtension.go.diff + ┣━ 🆕 ImplementationFromAsyncContext__checks.go + ┣━ 🆕 ImplementationFromAsyncContext__no_checks.go + ┣━ 📄 ImplementationFromAsyncContext.go.diff ┣━ 🆕 ImplementInternalInterface__checks.go ┣━ 🆕 ImplementInternalInterface__no_checks.go ┣━ 📄 ImplementInternalInterface.go.diff @@ -28939,7 +29056,7 @@ exports[`Generated code for "jsii-calc": /go/jsiicalc/D exports[`Generated code for "jsii-calc": /go/jsiicalc/DocumentedClass.go.diff 1`] = ` --- go/jsiicalc/DocumentedClass.go --no-runtime-type-checking +++ go/jsiicalc/DocumentedClass.go --runtime-type-checking -@@ -62,10 +62,13 @@ +@@ -60,10 +60,13 @@ d, ) } @@ -30410,6 +30527,65 @@ exports[`Generated code for "jsii-calc": /go/jsiicalc/I + `; +exports[`Generated code for "jsii-calc": /go/jsiicalc/ImplementationFromAsyncContext.go.diff 1`] = ` +--- go/jsiicalc/ImplementationFromAsyncContext.go --no-runtime-type-checking ++++ go/jsiicalc/ImplementationFromAsyncContext.go --runtime-type-checking +@@ -16,10 +16,13 @@ + } + + func NewImplementationFromAsyncContext(producer IPromiseProducer) ImplementationFromAsyncContext { + _init_.Initialize() + ++ if err := validateNewImplementationFromAsyncContextParameters(producer); err != nil { ++ panic(err) ++ } + j := jsiiProxy_ImplementationFromAsyncContext{} + + _jsii_.Create( + "jsii-calc.ImplementationFromAsyncContext", + []interface{}{producer}, +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/ImplementationFromAsyncContext__checks.go.diff 1`] = ` +--- go/jsiicalc/ImplementationFromAsyncContext__checks.go --no-runtime-type-checking ++++ go/jsiicalc/ImplementationFromAsyncContext__checks.go --runtime-type-checking +@@ -0,0 +1,17 @@ ++//go:build !no_runtime_type_checking ++ ++// A simple calcuator built on JSII. ++package jsiicalc ++ ++import ( ++ "fmt" ++) ++ ++func validateNewImplementationFromAsyncContextParameters(producer IPromiseProducer) error { ++ if producer == nil { ++ return fmt.Errorf("parameter producer is required, but nil was provided") ++ } ++ ++ return nil ++} ++ +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/ImplementationFromAsyncContext__no_checks.go.diff 1`] = ` +--- go/jsiicalc/ImplementationFromAsyncContext__no_checks.go --no-runtime-type-checking ++++ go/jsiicalc/ImplementationFromAsyncContext__no_checks.go --runtime-type-checking +@@ -0,0 +1,11 @@ ++//go:build no_runtime_type_checking ++ ++// A simple calcuator built on JSII. ++package jsiicalc ++ ++// Building without runtime type checking enabled, so all the below just return nil ++ ++func validateNewImplementationFromAsyncContextParameters(producer IPromiseProducer) error { ++ return nil ++} ++ +`; + exports[`Generated code for "jsii-calc": /go/jsiicalc/ImplementsPrivateInterface.go.diff 1`] = ` --- go/jsiicalc/ImplementsPrivateInterface.go --no-runtime-type-checking +++ go/jsiicalc/ImplementsPrivateInterface.go --runtime-type-checking diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap index 73464f85aa..ddb726604f 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap @@ -3814,6 +3814,7 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ 📄 IJsii487External2.java ┃ ┣━ 📄 IJsii496.java ┃ ┣━ 📄 Implementation.java + ┃ ┣━ 📄 ImplementationFromAsyncContext.java ┃ ┣━ 📄 ImplementInternalInterface.java ┃ ┣━ 📄 ImplementsInterfaceWithInternal.java ┃ ┣━ 📄 ImplementsInterfaceWithInternalSubclass.java @@ -3832,6 +3833,7 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ 📄 IObjectWithProperty.java ┃ ┣━ 📄 IOptionalMethod.java ┃ ┣━ 📄 IPrivatelyImplemented.java + ┃ ┣━ 📄 IPromiseProducer.java ┃ ┣━ 📄 IPublicInterface.java ┃ ┣━ 📄 IPublicInterface2.java ┃ ┣━ 📄 IRandomNumberGenerator.java @@ -14573,6 +14575,61 @@ public interface IPrivatelyImplemented extends software.amazon.jsii.JsiiSerializ `; +exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/IPromiseProducer.java 1`] = ` +package software.amazon.jsii.tests.calculator; + +/** + * Async Context operations Validates features work when run from within an async context. + *

+ * @see https://github.com/aws/jsii/issues/3917 + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.IPromiseProducer") +@software.amazon.jsii.Jsii.Proxy(IPromiseProducer.Jsii$Proxy.class) +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) +public interface IPromiseProducer extends software.amazon.jsii.JsiiSerializable { + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @org.jetbrains.annotations.NotNull java.lang.String produce(); + + /** + * A proxy class which represents a concrete javascript instance of this type. + */ + @software.amazon.jsii.Internal + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IPromiseProducer.Jsii$Default { + protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) { + super(objRef); + } + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @Override + public final @org.jetbrains.annotations.NotNull java.lang.String produce() { + return software.amazon.jsii.Kernel.asyncCall(this, "produce", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); + } + } + + /** + * Internal default implementation for {@link IPromiseProducer}. + */ + @software.amazon.jsii.Internal + interface Jsii$Default extends IPromiseProducer { + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @Override + default @org.jetbrains.annotations.NotNull java.lang.String produce() { + return software.amazon.jsii.Kernel.asyncCall(this, "produce", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); + } + } +} + +`; + exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/IPublicInterface.java 1`] = ` package software.amazon.jsii.tests.calculator; @@ -15151,6 +15208,43 @@ public class Implementation extends software.amazon.jsii.JsiiObject { `; +exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/ImplementationFromAsyncContext.java 1`] = ` +package software.amazon.jsii.tests.calculator; + +/** + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.ImplementationFromAsyncContext") +public class ImplementationFromAsyncContext extends software.amazon.jsii.JsiiObject { + + protected ImplementationFromAsyncContext(final software.amazon.jsii.JsiiObjectRef objRef) { + super(objRef); + } + + protected ImplementationFromAsyncContext(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { + super(initializationMode); + } + + /** + * @param producer This parameter is required. + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public ImplementationFromAsyncContext(final @org.jetbrains.annotations.NotNull software.amazon.jsii.tests.calculator.IPromiseProducer producer) { + super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); + software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(producer, "producer is required") }); + } + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public @org.jetbrains.annotations.NotNull java.lang.String doAsyncWork() { + return software.amazon.jsii.Kernel.asyncCall(this, "doAsyncWork", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); + } +} + +`; + exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/ImplementsInterfaceWithInternal.java 1`] = ` package software.amazon.jsii.tests.calculator; @@ -29030,6 +29124,7 @@ jsii-calc.INonInternalInterface=software.amazon.jsii.tests.calculator.INonIntern jsii-calc.IObjectWithProperty=software.amazon.jsii.tests.calculator.IObjectWithProperty jsii-calc.IOptionalMethod=software.amazon.jsii.tests.calculator.IOptionalMethod jsii-calc.IPrivatelyImplemented=software.amazon.jsii.tests.calculator.IPrivatelyImplemented +jsii-calc.IPromiseProducer=software.amazon.jsii.tests.calculator.IPromiseProducer jsii-calc.IPublicInterface=software.amazon.jsii.tests.calculator.IPublicInterface jsii-calc.IPublicInterface2=software.amazon.jsii.tests.calculator.IPublicInterface2 jsii-calc.IRandomNumberGenerator=software.amazon.jsii.tests.calculator.IRandomNumberGenerator @@ -29040,6 +29135,7 @@ jsii-calc.IStructReturningDelegate=software.amazon.jsii.tests.calculator.IStruct jsii-calc.IWallClock=software.amazon.jsii.tests.calculator.IWallClock jsii-calc.ImplementInternalInterface=software.amazon.jsii.tests.calculator.ImplementInternalInterface jsii-calc.Implementation=software.amazon.jsii.tests.calculator.Implementation +jsii-calc.ImplementationFromAsyncContext=software.amazon.jsii.tests.calculator.ImplementationFromAsyncContext jsii-calc.ImplementsInterfaceWithInternal=software.amazon.jsii.tests.calculator.ImplementsInterfaceWithInternal jsii-calc.ImplementsInterfaceWithInternalSubclass=software.amazon.jsii.tests.calculator.ImplementsInterfaceWithInternalSubclass jsii-calc.ImplementsPrivateInterface=software.amazon.jsii.tests.calculator.ImplementsPrivateInterface diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.js.snap index 1e09f2e78f..9e54d88a2e 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.js.snap @@ -7113,6 +7113,34 @@ class _IPrivatelyImplementedProxy: typing.cast(typing.Any, IPrivatelyImplemented).__jsii_proxy_class__ = lambda : _IPrivatelyImplementedProxy +@jsii.interface(jsii_type="jsii-calc.IPromiseProducer") +class IPromiseProducer(typing_extensions.Protocol): + '''Async Context operations Validates features work when run from within an async context. + + :see: https://github.com/aws/jsii/issues/3917 + ''' + + @jsii.member(jsii_name="produce") + def produce(self) -> builtins.str: + ... + + +class _IPromiseProducerProxy: + '''Async Context operations Validates features work when run from within an async context. + + :see: https://github.com/aws/jsii/issues/3917 + ''' + + __jsii_type__: typing.ClassVar[str] = "jsii-calc.IPromiseProducer" + + @jsii.member(jsii_name="produce") + def produce(self) -> builtins.str: + return typing.cast(builtins.str, jsii.invoke(self, "produce", [])) + +# Adding a "__jsii_proxy_class__(): typing.Type" function to the interface +typing.cast(typing.Any, IPromiseProducer).__jsii_proxy_class__ = lambda : _IPromiseProducerProxy + + @jsii.interface(jsii_type="jsii-calc.IPublicInterface") class IPublicInterface(typing_extensions.Protocol): @jsii.member(jsii_name="bye") @@ -7340,6 +7368,21 @@ class Implementation(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Implementatio return typing.cast(jsii.Number, jsii.get(self, "value")) +class ImplementationFromAsyncContext( + metaclass=jsii.JSIIMeta, + jsii_type="jsii-calc.ImplementationFromAsyncContext", +): + def __init__(self, producer: IPromiseProducer) -> None: + ''' + :param producer: - + ''' + jsii.create(self.__class__, self, [producer]) + + @jsii.member(jsii_name="doAsyncWork") + def do_async_work(self) -> builtins.str: + return typing.cast(builtins.str, jsii.ainvoke(self, "doAsyncWork", [])) + + @jsii.implements(IInterfaceWithInternal) class ImplementsInterfaceWithInternal( metaclass=jsii.JSIIMeta, @@ -11389,6 +11432,7 @@ __all__ = [ "IObjectWithProperty", "IOptionalMethod", "IPrivatelyImplemented", + "IPromiseProducer", "IPublicInterface", "IPublicInterface2", "IRandomNumberGenerator", @@ -11399,6 +11443,7 @@ __all__ = [ "IWallClock", "ImplementInternalInterface", "Implementation", + "ImplementationFromAsyncContext", "ImplementsInterfaceWithInternal", "ImplementsInterfaceWithInternalSubclass", "ImplementsPrivateInterface", @@ -16074,7 +16119,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="wasSet") def was_set(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.invoke(self, "wasSet", [])) -@@ -4216,10 +4600,13 @@ +@@ -4244,10 +4628,13 @@ def mutable_property(self) -> typing.Optional[jsii.Number]: return typing.cast(typing.Optional[jsii.Number], jsii.get(self, "mutableProperty")) @@ -16088,7 +16133,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="method") def method(self) -> None: return typing.cast(None, jsii.invoke(self, "method", [])) -@@ -4286,10 +4673,13 @@ +@@ -4314,10 +4701,13 @@ def prop(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "prop")) @@ -16103,6 +16148,20 @@ exports[`Generated code for "jsii-calc": /python/src/js class Implementation(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Implementation"): def __init__(self) -> None: @@ -4335,10 +4725,13 @@ + ): + def __init__(self, producer: IPromiseProducer) -> None: + ''' + :param producer: - + ''' ++ if __debug__: ++ type_hints = typing.get_type_hints(_typecheckingstub__693dc8eb550af2895cc6d97f99d37a0bd7b1fcabfdd0d84a25810f047a325536) ++ check_type(argname="argument producer", value=producer, expected_type=type_hints["producer"]) + jsii.create(self.__class__, self, [producer]) + + @jsii.member(jsii_name="doAsyncWork") + def do_async_work(self) -> builtins.str: + return typing.cast(builtins.str, jsii.ainvoke(self, "doAsyncWork", [])) +@@ -4378,10 +4771,13 @@ def private(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "private")) @@ -16116,7 +16175,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.data_type( jsii_type="jsii-calc.ImplictBaseOfBase", -@@ -4356,10 +4749,15 @@ +@@ -4399,10 +4795,15 @@ ''' :param foo: - :param bar: - @@ -16132,7 +16191,7 @@ exports[`Generated code for "jsii-calc": /python/src/js "bar": bar, "goo": goo, } -@@ -4434,10 +4832,13 @@ +@@ -4477,10 +4878,13 @@ count: jsii.Number, ) -> typing.List[_scope_jsii_calc_lib_c61f082f.IDoublable]: ''' @@ -16146,7 +16205,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class Isomorphism(metaclass=jsii.JSIIAbstractClass, jsii_type="jsii-calc.Isomorphism"): '''Checks the "same instance" isomorphism is preserved within the constructor. -@@ -4542,19 +4943,25 @@ +@@ -4585,19 +4989,25 @@ def prop_a(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "propA")) @@ -16172,7 +16231,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class JavaReservedWords( metaclass=jsii.JSIIMeta, -@@ -4776,10 +5183,13 @@ +@@ -4819,10 +5229,13 @@ def while_(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "while")) @@ -16186,7 +16245,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.implements(IJsii487External2, IJsii487External) class Jsii487Derived(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Jsii487Derived"): -@@ -4881,10 +5291,13 @@ +@@ -4924,10 +5337,13 @@ @builtins.classmethod def stringify(cls, value: typing.Any = None) -> typing.Optional[builtins.str]: ''' @@ -16200,7 +16259,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class LevelOne(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.LevelOne"): '''Validates that nested classes get correct code generation for the occasional forward reference.''' -@@ -4914,10 +5327,13 @@ +@@ -4957,10 +5373,13 @@ class PropBooleanValue: def __init__(self, *, value: builtins.bool) -> None: ''' @@ -16214,7 +16273,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } @builtins.property -@@ -4951,10 +5367,13 @@ +@@ -4994,10 +5413,13 @@ ''' :param prop: ''' @@ -16228,7 +16287,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } @builtins.property -@@ -4989,10 +5408,13 @@ +@@ -5032,10 +5454,13 @@ ''' :param prop: ''' @@ -16242,7 +16301,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } @builtins.property -@@ -5040,10 +5462,17 @@ +@@ -5083,10 +5508,17 @@ :param cpu: The number of cpu units used by the task. Valid values, which determines your range of valid values for the memory parameter: 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments This default is set in the underlying FargateTaskDefinition construct. Default: 256 :param memory_mib: The amount (in MiB) of memory used by the task. This field is required and you must use one of the following values, which determines your range of valid values for the cpu parameter: 0.5GB, 1GB, 2GB - Available cpu values: 256 (.25 vCPU) 1GB, 2GB, 3GB, 4GB - Available cpu values: 512 (.5 vCPU) 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB - Available cpu values: 1024 (1 vCPU) Between 4GB and 16GB in 1GB increments - Available cpu values: 2048 (2 vCPU) Between 8GB and 30GB in 1GB increments - Available cpu values: 4096 (4 vCPU) This default is set in the underlying FargateTaskDefinition construct. Default: 512 :param public_load_balancer: Determines whether the Application Load Balancer will be internet-facing. Default: true @@ -16260,7 +16319,7 @@ exports[`Generated code for "jsii-calc": /python/src/js self._values["container_port"] = container_port if cpu is not None: self._values["cpu"] = cpu -@@ -5170,10 +5599,14 @@ +@@ -5213,10 +5645,14 @@ '''Creates a BinaryOperation. :param lhs: Left-hand side operand. @@ -16275,7 +16334,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="farewell") def farewell(self) -> builtins.str: '''Say farewell.''' -@@ -5221,10 +5654,13 @@ +@@ -5264,10 +5700,13 @@ class NestedStruct: def __init__(self, *, number_prop: jsii.Number) -> None: ''' @@ -16289,7 +16348,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } @builtins.property -@@ -5295,17 +5731,24 @@ +@@ -5338,17 +5777,24 @@ def __init__(self, _param1: builtins.str, optional: typing.Any = None) -> None: ''' :param _param1: - @@ -16314,7 +16373,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="giveMeUndefinedInsideAnObject") def give_me_undefined_inside_an_object( self, -@@ -5333,10 +5776,13 @@ +@@ -5376,10 +5822,13 @@ def change_me_to_undefined(self) -> typing.Optional[builtins.str]: return typing.cast(typing.Optional[builtins.str], jsii.get(self, "changeMeToUndefined")) @@ -16328,7 +16387,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.data_type( jsii_type="jsii-calc.NullShouldBeTreatedAsUndefinedData", -@@ -5355,10 +5801,14 @@ +@@ -5398,10 +5847,14 @@ ) -> None: ''' :param array_with_three_elements_and_undefined_as_second_argument: @@ -16343,7 +16402,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } if this_should_be_undefined is not None: self._values["this_should_be_undefined"] = this_should_be_undefined -@@ -5393,17 +5843,23 @@ +@@ -5436,17 +5889,23 @@ def __init__(self, generator: IRandomNumberGenerator) -> None: ''' @@ -16367,7 +16426,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="nextTimes100") def next_times100(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.invoke(self, "nextTimes100", [])) -@@ -5413,10 +5869,13 @@ +@@ -5456,10 +5915,13 @@ def generator(self) -> IRandomNumberGenerator: return typing.cast(IRandomNumberGenerator, jsii.get(self, "generator")) @@ -16381,7 +16440,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class ObjectRefsInCollections( metaclass=jsii.JSIIMeta, -@@ -5434,10 +5893,13 @@ +@@ -5477,10 +5939,13 @@ ) -> jsii.Number: '''Returns the sum of all values. @@ -16395,7 +16454,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="sumFromMap") def sum_from_map( self, -@@ -5445,10 +5907,13 @@ +@@ -5488,10 +5953,13 @@ ) -> jsii.Number: '''Returns the sum of all values in a map. @@ -16409,7 +16468,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class ObjectWithPropertyProvider( metaclass=jsii.JSIIMeta, -@@ -5489,10 +5954,13 @@ +@@ -5532,10 +6000,13 @@ ): def __init__(self, delegate: IInterfaceWithOptionalMethodArguments) -> None: ''' @@ -16423,7 +16482,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="invokeWithOptional") def invoke_with_optional(self) -> None: return typing.cast(None, jsii.invoke(self, "invokeWithOptional", [])) -@@ -5515,10 +5983,15 @@ +@@ -5558,10 +6029,15 @@ ''' :param arg1: - :param arg2: - @@ -16439,7 +16498,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @builtins.property @jsii.member(jsii_name="arg1") def arg1(self) -> jsii.Number: -@@ -5543,10 +6016,13 @@ +@@ -5586,10 +6062,13 @@ class OptionalStruct: def __init__(self, *, field: typing.Optional[builtins.str] = None) -> None: ''' @@ -16453,7 +16512,7 @@ exports[`Generated code for "jsii-calc": /python/src/js self._values["field"] = field @builtins.property -@@ -5622,10 +6098,13 @@ +@@ -5665,10 +6144,13 @@ def _override_read_write(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "overrideReadWrite")) @@ -16467,7 +16526,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class OverrideReturnsObject( metaclass=jsii.JSIIMeta, -@@ -5637,10 +6116,13 @@ +@@ -5680,10 +6162,13 @@ @jsii.member(jsii_name="test") def test(self, obj: IReturnsNumber) -> jsii.Number: ''' @@ -16481,7 +16540,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class ParamShadowsBuiltins( metaclass=jsii.JSIIMeta, -@@ -5662,10 +6144,14 @@ +@@ -5705,10 +6190,14 @@ :param str: should be set to something that is NOT a valid expression in Python (e.g: "\${NOPE}""). :param boolean_property: :param string_property: @@ -16496,7 +16555,7 @@ exports[`Generated code for "jsii-calc": /python/src/js string_property=string_property, struct_property=struct_property, ) -@@ -5695,10 +6181,15 @@ +@@ -5738,10 +6227,15 @@ :param string_property: :param struct_property: ''' @@ -16512,7 +16571,7 @@ exports[`Generated code for "jsii-calc": /python/src/js "string_property": string_property, "struct_property": struct_property, } -@@ -5751,10 +6242,13 @@ +@@ -5794,10 +6288,13 @@ scope: _scope_jsii_calc_lib_c61f082f.Number, ) -> _scope_jsii_calc_lib_c61f082f.Number: ''' @@ -16526,7 +16585,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.data_type( jsii_type="jsii-calc.ParentStruct982", -@@ -5765,10 +6259,13 @@ +@@ -5808,10 +6305,13 @@ def __init__(self, *, foo: builtins.str) -> None: '''https://github.com/aws/jsii/issues/982. @@ -16540,7 +16599,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } @builtins.property -@@ -5823,10 +6320,15 @@ +@@ -5866,10 +6366,15 @@ ''' :param obj: - :param dt: - @@ -16556,7 +16615,7 @@ exports[`Generated code for "jsii-calc": /python/src/js # Adding a "__jsii_proxy_class__(): typing.Type" function to the abstract class typing.cast(typing.Any, PartiallyInitializedThisConsumer).__jsii_proxy_class__ = lambda : _PartiallyInitializedThisConsumerProxy -@@ -5841,10 +6343,13 @@ +@@ -5884,10 +6389,13 @@ friendly: _scope_jsii_calc_lib_c61f082f.IFriendly, ) -> builtins.str: ''' @@ -16570,7 +16629,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class Power( _CompositeOperation_1c4d123b, -@@ -5861,10 +6366,14 @@ +@@ -5904,10 +6412,14 @@ '''Creates a Power operation. :param base: The base of the power. @@ -16585,7 +16644,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @builtins.property @jsii.member(jsii_name="base") def base(self) -> _scope_jsii_calc_lib_c61f082f.NumericValue: -@@ -6087,10 +6596,13 @@ +@@ -6130,10 +6642,13 @@ value: _scope_jsii_calc_lib_c61f082f.EnumFromScopedModule, ) -> None: ''' @@ -16599,7 +16658,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @builtins.property @jsii.member(jsii_name="foo") def foo( -@@ -6101,10 +6613,13 @@ +@@ -6144,10 +6659,13 @@ @foo.setter def foo( self, @@ -16613,7 +16672,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class ReturnsPrivateImplementationOfInterface( metaclass=jsii.JSIIMeta, -@@ -6146,10 +6661,14 @@ +@@ -6189,10 +6707,14 @@ :param string_prop: May not be empty. :param nested_struct: ''' @@ -16628,7 +16687,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } if nested_struct is not None: self._values["nested_struct"] = nested_struct -@@ -6216,17 +6735,25 @@ +@@ -6259,17 +6781,25 @@ ''' :param arg1: - :param arg2: - @@ -16654,7 +16713,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="methodWithOptionalArguments") def method_with_optional_arguments( self, -@@ -6238,10 +6765,15 @@ +@@ -6281,10 +6811,15 @@ :param arg1: - :param arg2: - @@ -16670,7 +16729,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.data_type( jsii_type="jsii-calc.SecondLevelStruct", -@@ -6260,10 +6792,14 @@ +@@ -6303,10 +6838,14 @@ ) -> None: ''' :param deeper_required_prop: It's long and required. @@ -16685,7 +16744,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } if deeper_optional_prop is not None: self._values["deeper_optional_prop"] = deeper_optional_prop -@@ -6325,10 +6861,13 @@ +@@ -6368,10 +6907,13 @@ @jsii.member(jsii_name="isSingletonInt") def is_singleton_int(self, value: jsii.Number) -> builtins.bool: ''' @@ -16699,7 +16758,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.enum(jsii_type="jsii-calc.SingletonIntEnum") class SingletonIntEnum(enum.Enum): -@@ -6347,10 +6886,13 @@ +@@ -6390,10 +6932,13 @@ @jsii.member(jsii_name="isSingletonString") def is_singleton_string(self, value: builtins.str) -> builtins.bool: ''' @@ -16713,7 +16772,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.enum(jsii_type="jsii-calc.SingletonStringEnum") class SingletonStringEnum(enum.Enum): -@@ -6374,10 +6916,14 @@ +@@ -6417,10 +6962,14 @@ ) -> None: ''' :param property: @@ -16728,7 +16787,7 @@ exports[`Generated code for "jsii-calc": /python/src/js "yet_anoter_one": yet_anoter_one, } -@@ -6428,10 +6974,14 @@ +@@ -6471,10 +7020,14 @@ ) -> None: ''' :param readonly_string: - @@ -16743,7 +16802,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="method") def method(self) -> None: return typing.cast(None, jsii.invoke(self, "method", [])) -@@ -6446,10 +6996,13 @@ +@@ -6489,10 +7042,13 @@ def mutable_property(self) -> typing.Optional[jsii.Number]: return typing.cast(typing.Optional[jsii.Number], jsii.get(self, "mutableProperty")) @@ -16757,7 +16816,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.enum(jsii_type="jsii-calc.StableEnum") class StableEnum(enum.Enum): -@@ -6465,10 +7018,13 @@ +@@ -6508,10 +7064,13 @@ class StableStruct: def __init__(self, *, readonly_property: builtins.str) -> None: ''' @@ -16771,7 +16830,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } @builtins.property -@@ -6505,10 +7061,13 @@ +@@ -6548,10 +7107,13 @@ def static_variable(cls) -> builtins.bool: # pyright: ignore [reportGeneralTypeIssues] return typing.cast(builtins.bool, jsii.sget(cls, "staticVariable")) @@ -16785,7 +16844,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class StaticHelloParent( metaclass=jsii.JSIIMeta, -@@ -6538,19 +7097,25 @@ +@@ -6581,19 +7143,25 @@ class Statics(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.Statics"): def __init__(self, value: builtins.str) -> None: ''' @@ -16811,7 +16870,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="justMethod") def just_method(self) -> builtins.str: return typing.cast(builtins.str, jsii.invoke(self, "justMethod", [])) -@@ -6587,19 +7152,25 @@ +@@ -6630,19 +7198,25 @@ ''' return typing.cast("Statics", jsii.sget(cls, "instance")) @@ -16837,7 +16896,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @builtins.property @jsii.member(jsii_name="value") def value(self) -> builtins.str: -@@ -6622,10 +7193,13 @@ +@@ -6665,10 +7239,13 @@ def you_see_me(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "youSeeMe")) @@ -16851,7 +16910,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.data_type( jsii_type="jsii-calc.StructA", -@@ -6648,10 +7222,15 @@ +@@ -6691,10 +7268,15 @@ :param required_string: :param optional_number: @@ -16867,7 +16926,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } if optional_number is not None: self._values["optional_number"] = optional_number -@@ -6709,10 +7288,15 @@ +@@ -6752,10 +7334,15 @@ :param optional_boolean: :param optional_struct_a: ''' @@ -16883,7 +16942,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } if optional_boolean is not None: self._values["optional_boolean"] = optional_boolean -@@ -6764,10 +7348,14 @@ +@@ -6807,10 +7394,14 @@ See: https://github.com/aws/aws-cdk/issues/4302 :param scope: @@ -16898,7 +16957,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } if props is not None: self._values["props"] = props -@@ -6810,10 +7398,14 @@ +@@ -6853,10 +7444,14 @@ ) -> jsii.Number: ''' :param _positional: - @@ -16913,7 +16972,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="roundTrip") @builtins.classmethod def round_trip( -@@ -6828,10 +7420,13 @@ +@@ -6871,10 +7466,13 @@ :param _positional: - :param required: This is a required field. :param second_level: A union to really stress test our serialization. @@ -16927,7 +16986,7 @@ exports[`Generated code for "jsii-calc": /python/src/js ) return typing.cast("TopLevelStruct", jsii.sinvoke(cls, "roundTrip", [_positional, input])) -@@ -6848,10 +7443,13 @@ +@@ -6891,10 +7489,13 @@ struct: typing.Union[typing.Union[StructA, typing.Dict[builtins.str, typing.Any]], typing.Union[StructB, typing.Dict[builtins.str, typing.Any]]], ) -> builtins.bool: ''' @@ -16941,7 +17000,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="isStructB") @builtins.classmethod def is_struct_b( -@@ -6859,18 +7457,24 @@ +@@ -6902,18 +7503,24 @@ struct: typing.Union[typing.Union[StructA, typing.Dict[builtins.str, typing.Any]], typing.Union[StructB, typing.Dict[builtins.str, typing.Any]]], ) -> builtins.bool: ''' @@ -16966,7 +17025,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.data_type( jsii_type="jsii-calc.StructWithCollectionOfUnionts", -@@ -6884,10 +7488,13 @@ +@@ -6927,10 +7534,13 @@ union_property: typing.Sequence[typing.Mapping[builtins.str, typing.Union[typing.Union[StructA, typing.Dict[builtins.str, typing.Any]], typing.Union[StructB, typing.Dict[builtins.str, typing.Any]]]]], ) -> None: ''' @@ -16980,7 +17039,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } @builtins.property -@@ -6924,10 +7531,14 @@ +@@ -6967,10 +7577,14 @@ ) -> None: ''' :param foo: An enum value. @@ -16995,7 +17054,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } if bar is not None: self._values["bar"] = bar -@@ -6983,10 +7594,16 @@ +@@ -7026,10 +7640,16 @@ :param default: :param assert_: :param result: @@ -17012,7 +17071,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } if assert_ is not None: self._values["assert_"] = assert_ -@@ -7056,10 +7673,13 @@ +@@ -7099,10 +7719,13 @@ @parts.setter def parts( self, @@ -17026,7 +17085,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.data_type( jsii_type="jsii-calc.SupportsNiceJavaBuilderProps", -@@ -7075,10 +7695,14 @@ +@@ -7118,10 +7741,14 @@ ) -> None: ''' :param bar: Some number, like 42. @@ -17041,7 +17100,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } if id is not None: self._values["id"] = id -@@ -7127,10 +7751,13 @@ +@@ -7170,10 +7797,13 @@ ''' :param id_: some identifier of your choice. :param bar: Some number, like 42. @@ -17055,7 +17114,7 @@ exports[`Generated code for "jsii-calc": /python/src/js jsii.create(self.__class__, self, [id_, props]) @builtins.property -@@ -7168,17 +7795,23 @@ +@@ -7211,17 +7841,23 @@ @jsii.member(jsii_name="modifyOtherProperty") def modify_other_property(self, value: builtins.str) -> None: ''' @@ -17079,7 +17138,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="readA") def read_a(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.invoke(self, "readA", [])) -@@ -7198,17 +7831,23 @@ +@@ -7241,17 +7877,23 @@ @jsii.member(jsii_name="virtualMethod") def virtual_method(self, n: jsii.Number) -> jsii.Number: ''' @@ -17103,7 +17162,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @builtins.property @jsii.member(jsii_name="readonlyProperty") def readonly_property(self) -> builtins.str: -@@ -7219,46 +7858,61 @@ +@@ -7262,46 +7904,61 @@ def a(self) -> jsii.Number: return typing.cast(jsii.Number, jsii.get(self, "a")) @@ -17165,7 +17224,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class TestStructWithEnum( metaclass=jsii.JSIIMeta, -@@ -7341,10 +7995,15 @@ +@@ -7384,10 +8041,15 @@ ''' :param required: This is a required field. :param second_level: A union to really stress test our serialization. @@ -17181,7 +17240,7 @@ exports[`Generated code for "jsii-calc": /python/src/js "second_level": second_level, } if optional is not None: -@@ -7435,10 +8094,13 @@ +@@ -7478,10 +8140,13 @@ def __init__(self, operand: _scope_jsii_calc_lib_c61f082f.NumericValue) -> None: ''' @@ -17195,7 +17254,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @builtins.property @jsii.member(jsii_name="operand") def operand(self) -> _scope_jsii_calc_lib_c61f082f.NumericValue: -@@ -7469,10 +8131,14 @@ +@@ -7512,10 +8177,14 @@ ) -> None: ''' :param bar: @@ -17210,7 +17269,7 @@ exports[`Generated code for "jsii-calc": /python/src/js } if foo is not None: self._values["foo"] = foo -@@ -7509,10 +8175,13 @@ +@@ -7552,10 +8221,13 @@ def __init__(self, delegate: typing.Mapping[builtins.str, typing.Any]) -> None: ''' @@ -17224,7 +17283,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.python.classproperty @jsii.member(jsii_name="reflector") def REFLECTOR(cls) -> _scope_jsii_calc_lib_custom_submodule_name_c61f082f.Reflector: -@@ -7555,10 +8224,13 @@ +@@ -7598,10 +8270,13 @@ ): def __init__(self, obj: IInterfaceWithProperties) -> None: ''' @@ -17238,7 +17297,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="justRead") def just_read(self) -> builtins.str: return typing.cast(builtins.str, jsii.invoke(self, "justRead", [])) -@@ -7569,17 +8241,23 @@ +@@ -7612,17 +8287,23 @@ ext: IInterfaceWithPropertiesExtension, ) -> builtins.str: ''' @@ -17262,7 +17321,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @builtins.property @jsii.member(jsii_name="obj") def obj(self) -> IInterfaceWithProperties: -@@ -7589,25 +8267,34 @@ +@@ -7632,25 +8313,34 @@ class VariadicInvoker(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.VariadicInvoker"): def __init__(self, method: "VariadicMethod") -> None: ''' @@ -17297,7 +17356,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="asArray") def as_array( self, -@@ -7616,10 +8303,14 @@ +@@ -7659,10 +8349,14 @@ ) -> typing.List[jsii.Number]: ''' :param first: the first element of the array to be returned (after the \`\`prefix\`\` provided at construction time). @@ -17312,7 +17371,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class VariadicTypeUnion( metaclass=jsii.JSIIMeta, -@@ -7627,19 +8318,25 @@ +@@ -7670,19 +8364,25 @@ ): def __init__(self, *union: typing.Union[StructA, StructB]) -> None: ''' @@ -17338,7 +17397,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class VirtualMethodPlayground( metaclass=jsii.JSIIMeta, -@@ -7651,38 +8348,53 @@ +@@ -7694,38 +8394,53 @@ @jsii.member(jsii_name="overrideMeAsync") def override_me_async(self, index: jsii.Number) -> jsii.Number: ''' @@ -17392,7 +17451,7 @@ exports[`Generated code for "jsii-calc": /python/src/js class VoidCallback( metaclass=jsii.JSIIAbstractClass, -@@ -7730,10 +8442,13 @@ +@@ -7773,10 +8488,13 @@ def __init__(self, private_field: typing.Optional[builtins.str] = None) -> None: ''' @@ -17406,7 +17465,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @builtins.property @jsii.member(jsii_name="success") def success(self) -> builtins.bool: -@@ -7774,10 +8489,13 @@ +@@ -7817,10 +8535,13 @@ @jsii.member(jsii_name="abstractMethod") def abstract_method(self, name: builtins.str) -> builtins.str: ''' @@ -17420,7 +17479,7 @@ exports[`Generated code for "jsii-calc": /python/src/js # Adding a "__jsii_proxy_class__(): typing.Type" function to the abstract class typing.cast(typing.Any, AbstractClass).__jsii_proxy_class__ = lambda : _AbstractClassProxy -@@ -7793,10 +8511,14 @@ +@@ -7836,10 +8557,14 @@ '''Creates a BinaryOperation. :param lhs: Left-hand side operand. @@ -17435,7 +17494,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="toString") def to_string(self) -> builtins.str: '''String representation of the value.''' -@@ -7840,10 +8562,13 @@ +@@ -7883,10 +8608,13 @@ def rung(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.get(self, "rung")) @@ -17449,7 +17508,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.data_type( jsii_type="jsii-calc.ChildStruct982", -@@ -7854,10 +8579,14 @@ +@@ -7897,10 +8625,14 @@ def __init__(self, *, foo: builtins.str, bar: jsii.Number) -> None: ''' :param foo: @@ -17464,7 +17523,7 @@ exports[`Generated code for "jsii-calc": /python/src/js "bar": bar, } -@@ -7898,37 +8627,49 @@ +@@ -7941,37 +8673,49 @@ def a(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "a")) @@ -17514,7 +17573,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.implements(INonInternalInterface) class ClassThatImplementsThePrivateInterface( -@@ -7943,37 +8684,49 @@ +@@ -7986,37 +8730,49 @@ def a(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "a")) @@ -17564,7 +17623,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.implements(IInterfaceWithProperties) class ClassWithPrivateConstructorAndAutomaticProperties( -@@ -7991,10 +8744,14 @@ +@@ -8034,10 +8790,14 @@ ) -> "ClassWithPrivateConstructorAndAutomaticProperties": ''' :param read_only_string: - @@ -17579,7 +17638,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @builtins.property @jsii.member(jsii_name="readOnlyString") def read_only_string(self) -> builtins.str: -@@ -8005,10 +8762,13 @@ +@@ -8048,10 +8808,13 @@ def read_write_string(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "readWriteString")) @@ -17593,7 +17652,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.implements(IIndirectlyImplemented) class FullCombo(BaseClass, metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.FullCombo"): -@@ -8123,10 +8883,13 @@ +@@ -8166,10 +8929,13 @@ ): def __init__(self, property: builtins.str) -> None: ''' @@ -17607,7 +17666,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="bar") def bar(self) -> None: return typing.cast(None, jsii.invoke(self, "bar", [])) -@@ -8147,10 +8910,13 @@ +@@ -8190,10 +8956,13 @@ def __init__(self, operand: _scope_jsii_calc_lib_c61f082f.NumericValue) -> None: ''' @@ -17621,7 +17680,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @jsii.member(jsii_name="farewell") def farewell(self) -> builtins.str: '''Say farewell.''' -@@ -8210,10 +8976,16 @@ +@@ -8253,10 +9022,16 @@ :param id: some identifier. :param default_bar: the default value of \`\`bar\`\`. :param props: some props once can provide. @@ -17638,7 +17697,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @builtins.property @jsii.member(jsii_name="id") def id(self) -> jsii.Number: -@@ -8509,5 +9281,1522 @@ +@@ -8554,5 +9329,1528 @@ from . import nodirect from . import onlystatic from . import python_self @@ -18409,6 +18468,12 @@ exports[`Generated code for "jsii-calc": /python/src/js + """Type checking stubs""" + pass + ++def _typecheckingstub__693dc8eb550af2895cc6d97f99d37a0bd7b1fcabfdd0d84a25810f047a325536( ++ producer: IPromiseProducer, ++) -> None: ++ """Type checking stubs""" ++ pass ++ +def _typecheckingstub__2df4d055b033cdfdf7ad915b451ddc787ad68fb64b7e02386a9d8e591c1657af( + value: builtins.str, +) -> None: diff --git a/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap b/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap index 510a363362..31235374f4 100644 --- a/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap +++ b/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap @@ -1460,6 +1460,14 @@ exports[`jsii-tree --all 1`] = ` │ │ └─┬ value property (stable) │ │ ├── immutable │ │ └── type: number + │ ├─┬ class ImplementationFromAsyncContext (stable) + │ │ └─┬ members + │ │ ├─┬ (producer) initializer (stable) + │ │ │ └─┬ parameters + │ │ │ └─┬ producer + │ │ │ └── type: jsii-calc.IPromiseProducer + │ │ └─┬ doAsyncWork() method (stable) + │ │ └── returns: Promise │ ├─┬ class ImplementsInterfaceWithInternal (stable) │ │ ├── interfaces: IInterfaceWithInternal │ │ └─┬ members @@ -3107,6 +3115,11 @@ exports[`jsii-tree --all 1`] = ` │ │ ├── abstract │ │ ├── immutable │ │ └── type: boolean + │ ├─┬ interface IPromiseProducer (stable) + │ │ └─┬ members + │ │ └─┬ produce() method (stable) + │ │ ├── abstract + │ │ └── returns: Promise │ ├─┬ interface IPublicInterface (stable) │ │ └─┬ members │ │ └─┬ bye() method (stable) @@ -3915,6 +3928,7 @@ exports[`jsii-tree --inheritance 1`] = ` │ ├── class GreetingAugmenter │ ├── class ImplementInternalInterface │ ├── class Implementation + │ ├── class ImplementationFromAsyncContext │ ├─┬ class ImplementsInterfaceWithInternal │ │ └── interfaces: IInterfaceWithInternal │ ├─┬ class ImplementsInterfaceWithInternalSubclass @@ -4086,6 +4100,7 @@ exports[`jsii-tree --inheritance 1`] = ` │ ├── interface IObjectWithProperty │ ├── interface IOptionalMethod │ ├── interface IPrivatelyImplemented + │ ├── interface IPromiseProducer │ ├── interface IPublicInterface │ ├── interface IPublicInterface2 │ ├── interface IRandomNumberGenerator @@ -4874,6 +4889,10 @@ exports[`jsii-tree --members 1`] = ` │ │ └─┬ members │ │ ├── () initializer │ │ └── value property + │ ├─┬ class ImplementationFromAsyncContext + │ │ └─┬ members + │ │ ├── (producer) initializer + │ │ └── doAsyncWork() method │ ├─┬ class ImplementsInterfaceWithInternal │ │ └─┬ members │ │ ├── () initializer @@ -5581,6 +5600,9 @@ exports[`jsii-tree --members 1`] = ` │ ├─┬ interface IPrivatelyImplemented │ │ └─┬ members │ │ └── success property + │ ├─┬ interface IPromiseProducer + │ │ └─┬ members + │ │ └── produce() method │ ├─┬ interface IPublicInterface │ │ └─┬ members │ │ └── bye() method @@ -6117,6 +6139,7 @@ exports[`jsii-tree --types 1`] = ` │ ├── class GreetingAugmenter │ ├── class ImplementInternalInterface │ ├── class Implementation + │ ├── class ImplementationFromAsyncContext │ ├── class ImplementsInterfaceWithInternal │ ├── class ImplementsInterfaceWithInternalSubclass │ ├── class ImplementsPrivateInterface @@ -6244,6 +6267,7 @@ exports[`jsii-tree --types 1`] = ` │ ├── interface IObjectWithProperty │ ├── interface IOptionalMethod │ ├── interface IPrivatelyImplemented + │ ├── interface IPromiseProducer │ ├── interface IPublicInterface │ ├── interface IPublicInterface2 │ ├── interface IRandomNumberGenerator diff --git a/packages/jsii-reflect/test/__snapshots__/tree.test.js.snap b/packages/jsii-reflect/test/__snapshots__/tree.test.js.snap index 1a32ce9fad..6a3d35da19 100644 --- a/packages/jsii-reflect/test/__snapshots__/tree.test.js.snap +++ b/packages/jsii-reflect/test/__snapshots__/tree.test.js.snap @@ -1637,6 +1637,14 @@ exports[`showAll 1`] = ` │ │ └─┬ value property │ │ ├── immutable │ │ └── type: number + │ ├─┬ class ImplementationFromAsyncContext + │ │ └─┬ members + │ │ ├─┬ (producer) initializer + │ │ │ └─┬ parameters + │ │ │ └─┬ producer + │ │ │ └── type: jsii-calc.IPromiseProducer + │ │ └─┬ doAsyncWork() method + │ │ └── returns: Promise │ ├─┬ class ImplementsInterfaceWithInternal │ │ ├── interfaces: IInterfaceWithInternal │ │ └─┬ members @@ -3284,6 +3292,11 @@ exports[`showAll 1`] = ` │ │ ├── abstract │ │ ├── immutable │ │ └── type: boolean + │ ├─┬ interface IPromiseProducer + │ │ └─┬ members + │ │ └─┬ produce() method + │ │ ├── abstract + │ │ └── returns: Promise │ ├─┬ interface IPublicInterface │ │ └─┬ members │ │ └─┬ bye() method @@ -4102,6 +4115,7 @@ exports[`types 1`] = ` │ ├── class GreetingAugmenter │ ├── class ImplementInternalInterface │ ├── class Implementation + │ ├── class ImplementationFromAsyncContext │ ├── class ImplementsInterfaceWithInternal │ ├── class ImplementsInterfaceWithInternalSubclass │ ├── class ImplementsPrivateInterface @@ -4229,6 +4243,7 @@ exports[`types 1`] = ` │ ├── interface IObjectWithProperty │ ├── interface IOptionalMethod │ ├── interface IPrivatelyImplemented + │ ├── interface IPromiseProducer │ ├── interface IPublicInterface │ ├── interface IPublicInterface2 │ ├── interface IRandomNumberGenerator diff --git a/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap b/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap index aa57f8639a..525f1d93e8 100644 --- a/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap +++ b/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap @@ -82,6 +82,7 @@ exports[`TypeSystem.classes lists all the classes in the typesystem 1`] = ` "jsii-calc.GreetingAugmenter", "jsii-calc.ImplementInternalInterface", "jsii-calc.Implementation", + "jsii-calc.ImplementationFromAsyncContext", "jsii-calc.ImplementsInterfaceWithInternal", "jsii-calc.ImplementsInterfaceWithInternalSubclass", "jsii-calc.ImplementsPrivateInterface",