From c0de4b266262c6b293725b00896b080b96e3a8ad Mon Sep 17 00:00:00 2001 From: Chris Rybicki Date: Mon, 1 Jul 2024 14:17:55 -0400 Subject: [PATCH] chore: update winglibs with syntax breaking changes (part 1) --- checks/check.test.w | 4 +- checks/package-lock.json | 4 +- checks/package.json | 2 +- checks/results.test.w | 4 +- cognito/package-lock.json | 4 +- cognito/package.json | 2 +- cognito/platform/sim.w | 6 +- cognito/platform/tfaws.w | 6 +- ...iners-with-readiness.test.w.tf-aws.snap.md | 2 +- containers/containers.test.w.tf-aws.snap.md | 2 +- containers/helm.extern.d.ts | 139 ------------------ containers/package-lock.json | 4 +- containers/package.json | 2 +- containers/tfaws-ecr.w | 2 +- containers/tfaws-eks.w | 4 +- dynamodb/dynamodb.sim.w | 2 +- dynamodb/dynamodb.tf-aws.w | 2 +- dynamodb/package-lock.json | 4 +- dynamodb/package.json | 2 +- ngrok/ngrok.w | 2 +- ngrok/package-lock.json | 4 +- ngrok/package.json | 2 +- postgres/lib.w | 2 +- postgres/package-lock.json | 12 +- postgres/package.json | 2 +- python/package-lock.json | 4 +- python/package.json | 2 +- python/sim/containers.w | 6 +- python/util.extern.d.ts | 64 ++++---- tsoa/lib.extern.d.ts | 64 ++++---- tsoa/package-lock.json | 4 +- tsoa/package.json | 2 +- 32 files changed, 110 insertions(+), 257 deletions(-) diff --git a/checks/check.test.w b/checks/check.test.w index 2f665312..41854ee6 100644 --- a/checks/check.test.w +++ b/checks/check.test.w @@ -45,7 +45,7 @@ test "latest() returns the last check status" { let result = check.run(); let latest = check.latest(); log(Json.stringify(latest)); - expect.equal(latest?, true); + expect.equal(latest != nil, true); expect.equal(result, latest); } @@ -61,4 +61,4 @@ test "run() with failure" { let check_id = nodeof(check).id; test "check name is set" { expect.equal("check {check_id}", "check {checkName}"); -} \ No newline at end of file +} diff --git a/checks/package-lock.json b/checks/package-lock.json index 37b8e5f0..3c691c2b 100644 --- a/checks/package-lock.json +++ b/checks/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/checks", - "version": "0.0.11", + "version": "0.0.13", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/checks", - "version": "0.0.11", + "version": "0.0.13", "license": "MIT" } } diff --git a/checks/package.json b/checks/package.json index 63b7d560..3f72e85c 100644 --- a/checks/package.json +++ b/checks/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/checks", - "version": "0.0.12", + "version": "0.0.13", "description": "Cloud checks", "publishConfig": { "access": "public", diff --git a/checks/results.test.w b/checks/results.test.w index 966b8713..b2e001c5 100644 --- a/checks/results.test.w +++ b/checks/results.test.w @@ -20,7 +20,7 @@ test "store/load test" { let response = c2.results.latest(checkid); log(Json.stringify(response)); - assert(response?); + assert(response != nil); assert(response?.ok == true); assert(response?.timestamp == ts); -} \ No newline at end of file +} diff --git a/cognito/package-lock.json b/cognito/package-lock.json index dc0b0a6c..4451b904 100644 --- a/cognito/package-lock.json +++ b/cognito/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/cognito", - "version": "0.0.10", + "version": "0.0.12", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/cognito", - "version": "0.0.10", + "version": "0.0.12", "license": "MIT", "peerDependencies": { "@aws-sdk/client-cognito-identity": "^3.564.0", diff --git a/cognito/package.json b/cognito/package.json index 7a176dbd..6221ec1b 100644 --- a/cognito/package.json +++ b/cognito/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/cognito", - "version": "0.0.11", + "version": "0.0.12", "description": "A wing library to work with AWS Cognito", "author": { "name": "Elad Cohen", diff --git a/cognito/platform/sim.w b/cognito/platform/sim.w index 568a1c27..2da39c7d 100644 --- a/cognito/platform/sim.w +++ b/cognito/platform/sim.w @@ -128,7 +128,7 @@ pub class Cognito_sim impl types.ICognito { }; } - if !authHeader? { + if authHeader == nil { return { status: () => { if authType == types.AuthenticationType.COGNITO_USER_POOLS { @@ -180,7 +180,7 @@ pub class Cognito_sim impl types.ICognito { pub inflight adminConfirmUser(email: str): void { let row = this.table.tryGet(email); - if !row? { + if row == nil { throw "User not found"; } @@ -193,7 +193,7 @@ pub class Cognito_sim impl types.ICognito { pub inflight initiateAuth(email: str, password: str): str { let row = this.table.tryGet(email); - if !row? { + if row == nil { throw "User not found"; } diff --git a/cognito/platform/tfaws.w b/cognito/platform/tfaws.w index fa470ef0..c8d523ef 100644 --- a/cognito/platform/tfaws.w +++ b/cognito/platform/tfaws.w @@ -101,7 +101,7 @@ pub class Cognito_tfaws impl types.ICognito { let apiSpec: MutJson = unsafeCast(this.api)?.apiSpec; let var cognitoDefinition = MutJson{}; - if !props? || !props?.authenticationType? || props?.authenticationType == types.AuthenticationType.COGNITO_USER_POOLS { + if props == nil || props?.authenticationType == nil || props?.authenticationType == types.AuthenticationType.COGNITO_USER_POOLS { cognitoDefinition = { type: "apiKey", name: props?.headerKey ?? "Authorization", @@ -169,11 +169,11 @@ pub class Cognito_tfaws impl types.ICognito { addSecurity(path: str, method: str) { let apiSpec: MutJson = unsafeCast(this.api)?.apiSpec; let paths = apiSpec.get("paths"); - if !paths.tryGet(path)? { + if paths.tryGet(path) == nil { throw "Path {path} not found. `cloud.Api.{method}({path}) must be called before.`"; } let methods = paths.get(path); - if !methods.tryGet(method)? { + if methods.tryGet(method) == nil { throw "Method {method} not found. `cloud.Api.{method}({path}) must be called before.`"; } let spec = methods.get(method); diff --git a/containers/containers-with-readiness.test.w.tf-aws.snap.md b/containers/containers-with-readiness.test.w.tf-aws.snap.md index 5efd269d..88cbf431 100644 --- a/containers/containers-with-readiness.test.w.tf-aws.snap.md +++ b/containers/containers-with-readiness.test.w.tf-aws.snap.md @@ -8,7 +8,7 @@ "metadata": { "backend": "local", "stackName": "root", - "version": "0.20.3" + "version": "0.20.7" }, "outputs": { "root": { diff --git a/containers/containers.test.w.tf-aws.snap.md b/containers/containers.test.w.tf-aws.snap.md index 5ec621f6..50813f64 100644 --- a/containers/containers.test.w.tf-aws.snap.md +++ b/containers/containers.test.w.tf-aws.snap.md @@ -8,7 +8,7 @@ "metadata": { "backend": "local", "stackName": "root", - "version": "0.20.3" + "version": "0.20.7" }, "outputs": { "root": { diff --git a/containers/helm.extern.d.ts b/containers/helm.extern.d.ts index b5ee8be5..1a615b27 100644 --- a/containers/helm.extern.d.ts +++ b/containers/helm.extern.d.ts @@ -11,152 +11,13 @@ those constructs are deployed before the resources depending ON them are deployed. */ export interface IDependable { } -/** Options for `construct.addMetadata()`. */ -export interface MetadataOptions { - /** Include stack trace with metadata entry. */ - readonly stackTrace?: (boolean) | undefined; - /** A JavaScript function to begin tracing from. - This option is ignored unless `stackTrace` is `true`. */ - readonly traceFromFunction?: (any) | undefined; -} -/** Implement this interface in order for the construct to be able to validate itself. */ -export interface IValidation { - /** Validate the current construct. - This method can be implemented by derived constructs in order to perform - validation logic. It is called on all constructs before synthesis. - @returns An array of validation error messages, or an empty array if there the construct is valid. */ - readonly validate: () => (readonly (string)[]); -} -/** In what order to return constructs. */ -export enum ConstructOrder { - PREORDER = 0, - POSTORDER = 1, -} -/** An entry in the construct metadata table. */ -export interface MetadataEntry { - /** The data. */ - readonly data?: any; - /** Stack trace at the point of adding the metadata. - Only available if `addMetadata()` is called with `stackTrace: true`. */ - readonly trace?: ((readonly (string)[])) | undefined; - /** The metadata entry type. */ - readonly type: string; -} -/** Represents the construct node in the scope tree. */ -export class Node { - /** Add an ordering dependency on another construct. - An `IDependable` */ - readonly addDependency: (deps: (readonly (IDependable)[])) => void; - /** Adds a metadata entry to this construct. - Entries are arbitrary values and will also include a stack trace to allow tracing back to - the code location for when the entry was added. It can be used, for example, to include source - mapping in CloudFormation templates to improve diagnostics. */ - readonly addMetadata: (type: string, data?: any, options?: (MetadataOptions) | undefined) => void; - /** Adds a validation to this construct. - When `node.validate()` is called, the `validate()` method will be called on - all validations and all errors will be returned. */ - readonly addValidation: (validation: IValidation) => void; - /** Returns an opaque tree-unique address for this construct. - Addresses are 42 characters hexadecimal strings. They begin with "c8" - followed by 40 lowercase hexadecimal characters (0-9a-f). - - Addresses are calculated using a SHA-1 of the components of the construct - path. - - To enable refactorings of construct trees, constructs with the ID `Default` - will be excluded from the calculation. In those cases constructs in the - same tree may have the same addreess. - c83a2846e506bcc5f10682b564084bca2d275709ee */ - readonly addr: string; - /** All direct children of this construct. */ - readonly children: (readonly (IConstruct)[]); - /** Returns the child construct that has the id `Default` or `Resource"`. - This is usually the construct that provides the bulk of the underlying functionality. - Useful for modifications of the underlying construct that are not available at the higher levels. - Override the defaultChild property. - - This should only be used in the cases where the correct - default child is not named 'Resource' or 'Default' as it - should be. - - If you set this to undefined, the default behavior of finding - the child named 'Resource' or 'Default' will be used. - @returns a construct or undefined if there is no default child */ - defaultChild?: (IConstruct) | undefined; - /** Return all dependencies registered on this node (non-recursive). */ - readonly dependencies: (readonly (IConstruct)[]); - /** Return this construct and all of its children in the given order. */ - readonly findAll: (order?: (ConstructOrder) | undefined) => (readonly (IConstruct)[]); - /** Return a direct child by id. - Throws an error if the child is not found. - @returns Child with the given id. */ - readonly findChild: (id: string) => IConstruct; - /** Retrieves the all context of a node from tree context. - Context is usually initialized at the root, but can be overridden at any point in the tree. - @returns The context object or an empty object if there is discovered context */ - readonly getAllContext: (defaults?: (Readonly) | undefined) => any; - /** Retrieves a value from tree context if present. Otherwise, would throw an error. - Context is usually initialized at the root, but can be overridden at any point in the tree. - @returns The context value or throws error if there is no context value for this key */ - readonly getContext: (key: string) => any; - /** The id of this construct within the current scope. - This is a scope-unique id. To obtain an app-unique id for this construct, use `addr`. */ - readonly id: string; - /** Locks this construct from allowing more children to be added. - After this - call, no more children can be added to this construct or to any children. */ - readonly lock: () => void; - /** Returns true if this construct or the scopes in which it is defined are locked. */ - readonly locked: boolean; - /** An immutable array of metadata objects associated with this construct. - This can be used, for example, to implement support for deprecation notices, source mapping, etc. */ - readonly metadata: (readonly (MetadataEntry)[]); - /** The full, absolute path of this construct in the tree. - Components are separated by '/'. */ - readonly path: string; - /** Returns the root of the construct tree. - @returns The root of the construct tree. */ - readonly root: IConstruct; - /** Returns the scope in which this construct is defined. - The value is `undefined` at the root of the construct scope tree. */ - readonly scope?: (IConstruct) | undefined; - /** All parent scopes of this construct. - @returns a list of parent scopes. The last element in the list will always - be the current construct and the first element will be the root of the - tree. */ - readonly scopes: (readonly (IConstruct)[]); - /** This can be used to set contextual values. - Context must be set before any children are added, since children may consult context info during construction. - If the key already exists, it will be overridden. */ - readonly setContext: (key: string, value?: any) => void; - /** Return a direct child by id, or undefined. - @returns the child if found, or undefined */ - readonly tryFindChild: (id: string) => IConstruct | void; - /** Retrieves a value from tree context. - Context is usually initialized at the root, but can be overridden at any point in the tree. - @returns The context value or `undefined` if there is no context value for this key. */ - readonly tryGetContext: (key: string) => any; - /** Remove the child with the given name, if present. - @returns Whether a child with the given name was deleted. */ - readonly tryRemoveChild: (childName: string) => boolean; - /** Validates this construct. - Invokes the `validate()` method on all validations added through - `addValidation()`. - @returns an array of validation error messages associated with this - construct. */ - readonly validate: () => (readonly (string)[]); -} /** Represents a construct. */ export interface IConstruct extends IDependable { - /** The tree node. */ - readonly node: Node; } /** Represents the building block of the construct graph. All constructs besides the root construct must be created within the scope of another construct. */ export class Construct implements IConstruct { - /** The tree node. */ - readonly node: Node; /** Returns a string representation of this construct. */ readonly toString: () => string; } diff --git a/containers/package-lock.json b/containers/package-lock.json index 45e6be55..24c26854 100644 --- a/containers/package-lock.json +++ b/containers/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/containers", - "version": "0.1.1", + "version": "0.1.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/containers", - "version": "0.1.1", + "version": "0.1.3", "license": "MIT", "peerDependencies": { "@cdktf/provider-aws": "^19.12.0", diff --git a/containers/package.json b/containers/package.json index 0f9bee42..5ab9f605 100644 --- a/containers/package.json +++ b/containers/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/containers", - "version": "0.1.2", + "version": "0.1.3", "description": "Container support for Wing", "repository": { "type": "git", diff --git a/containers/tfaws-ecr.w b/containers/tfaws-ecr.w index 13dead1d..7ae9297d 100644 --- a/containers/tfaws-ecr.w +++ b/containers/tfaws-ecr.w @@ -58,7 +58,7 @@ pub class Repository { // null provider singleton let root = nodeof(this).root; let nullProviderId = "NullProvider"; - if !nodeof(root).tryFindChild(nullProviderId)? { + if nodeof(root).tryFindChild(nullProviderId) == nil { new null_provider.provider.NullProvider() as nullProviderId in root; } diff --git a/containers/tfaws-eks.w b/containers/tfaws-eks.w index 7530bff3..26022566 100644 --- a/containers/tfaws-eks.w +++ b/containers/tfaws-eks.w @@ -29,7 +29,7 @@ pub class ClusterBase impl ICluster { let singletonKey = "WingKubernetesProvider"; let attributes = this.attributes(); let existing = nodeof(root).tryFindChild(singletonKey); - if existing? { + if existing != nil { return unsafeCast(existing); } @@ -50,7 +50,7 @@ pub class ClusterBase impl ICluster { let singletonKey = "WingHelmProvider"; let attributes = this.attributes(); let existing = nodeof(root).tryFindChild(singletonKey); - if existing? { + if existing != nil { return unsafeCast(existing); } diff --git a/dynamodb/dynamodb.sim.w b/dynamodb/dynamodb.sim.w index dd35d5ed..89b2b4da 100644 --- a/dynamodb/dynamodb.sim.w +++ b/dynamodb/dynamodb.sim.w @@ -169,7 +169,7 @@ pub class Table_sim impl dynamodb_types.ITable { } let provisionedThroughput: Json? = (() => { - if gsi.readCapacity? || gsi.writeCapacity? { + if gsi.readCapacity != nil || gsi.writeCapacity != nil { return { ReadCapacityUnits: gsi.readCapacity, WriteCapacityUnits: gsi.writeCapacity, diff --git a/dynamodb/dynamodb.tf-aws.w b/dynamodb/dynamodb.tf-aws.w index 8700300a..3b7794a4 100644 --- a/dynamodb/dynamodb.tf-aws.w +++ b/dynamodb/dynamodb.tf-aws.w @@ -32,7 +32,7 @@ class Util { ): Json; pub inflight static safeUnmarshall(item: Json?, options: Json?): Json? { - if item? { + if item != nil { return Util.unmarshall(item, options); } return nil; diff --git a/dynamodb/package-lock.json b/dynamodb/package-lock.json index 7ce6540f..132d3fec 100644 --- a/dynamodb/package-lock.json +++ b/dynamodb/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/dynamodb", - "version": "0.1.14", + "version": "0.1.15", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/dynamodb", - "version": "0.1.14", + "version": "0.1.15", "license": "MIT", "peerDependencies": { "@aws-sdk/client-dynamodb": "^3.461.0", diff --git a/dynamodb/package.json b/dynamodb/package.json index 7d597735..48727817 100644 --- a/dynamodb/package.json +++ b/dynamodb/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/dynamodb", - "version": "0.1.14", + "version": "0.1.15", "description": "DynamoDB library for Wing", "author": { "name": "Cristian Pallarés", diff --git a/ngrok/ngrok.w b/ngrok/ngrok.w index 18a64e4d..ae5391ea 100644 --- a/ngrok/ngrok.w +++ b/ngrok/ngrok.w @@ -29,7 +29,7 @@ pub class Tunnel { this.onConnectHandlers = MutArray[]; if !nodeof(this).app.isTestEnvironment { - if !util.tryEnv("NGROK_AUTHTOKEN")? { + if util.tryEnv("NGROK_AUTHTOKEN") == nil { throw "NGROK_AUTHTOKEN is not defined"; } diff --git a/ngrok/package-lock.json b/ngrok/package-lock.json index c5295d52..efcd7e34 100644 --- a/ngrok/package-lock.json +++ b/ngrok/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/ngrok", - "version": "0.0.6", + "version": "0.0.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/ngrok", - "version": "0.0.6", + "version": "0.0.7", "license": "MIT", "peerDependencies": { "@ngrok/ngrok": "^0.9.1" diff --git a/ngrok/package.json b/ngrok/package.json index 37a77118..72202e26 100644 --- a/ngrok/package.json +++ b/ngrok/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/ngrok", - "version": "0.0.6", + "version": "0.0.7", "description": "ngrok library for Wing", "author": { "name": "Elad Ben-Israel", diff --git a/postgres/lib.w b/postgres/lib.w index 0189a9f6..75d4865e 100644 --- a/postgres/lib.w +++ b/postgres/lib.w @@ -384,7 +384,7 @@ class DatabaseNeon impl IDatabase { let stack = cdktf.TerraformStack.of(this); let singletonKey = "WingNeonProvider"; let existing = nodeof(stack).tryFindChild(singletonKey); - if existing? { + if existing != nil { return unsafeCast(existing); } diff --git a/postgres/package-lock.json b/postgres/package-lock.json index 599dc29f..d48df290 100644 --- a/postgres/package-lock.json +++ b/postgres/package-lock.json @@ -1,17 +1,17 @@ { "name": "@winglibs/postgres", - "version": "0.1.7", + "version": "0.1.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/postgres", - "version": "0.1.7", + "version": "0.1.9", "license": "MIT", "peerDependencies": { "@cdktf/provider-aws": "^19.12.0", "@rybickic/cdktf-provider-neon": "^2.0.0", - "@winglibs/containers": "^0.1.0", + "@winglibs/containers": "^0.1.2", "cdktf": "^0.20.6", "pg": "^8.11.3" } @@ -303,9 +303,9 @@ "peer": true }, "node_modules/@winglibs/containers": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@winglibs/containers/-/containers-0.1.0.tgz", - "integrity": "sha512-4x3msPJR4z/vIjqDgl4EStXMcRAZ1+9ObEfo+LIa4ThlVkYzud14GqNqGxwt6zOyWriuRykjx5P8ZCMnQ/+/IQ==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@winglibs/containers/-/containers-0.1.2.tgz", + "integrity": "sha512-uDqA17SShskhqiZ7+8UjUGqwV97c4uGZm45D2LoWfDdIV/HluAjXVmDNDP1CyI0ckeoDRUJntSY4smgwGSJtEw==", "peer": true, "engines": { "wing": "*" diff --git a/postgres/package.json b/postgres/package.json index c9179800..13495222 100644 --- a/postgres/package.json +++ b/postgres/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/postgres", - "version": "0.1.8", + "version": "0.1.9", "description": "Postgres support for Wing", "repository": { "type": "git", diff --git a/python/package-lock.json b/python/package-lock.json index a26b791a..6aa682d9 100644 --- a/python/package-lock.json +++ b/python/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/python", - "version": "0.0.12", + "version": "0.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/python", - "version": "0.0.12", + "version": "0.1.1", "license": "MIT", "peerDependencies": { "@aws-sdk/client-lambda": "^3.549.0", diff --git a/python/package.json b/python/package.json index e5d43979..ee1dabd2 100644 --- a/python/package.json +++ b/python/package.json @@ -1,7 +1,7 @@ { "name": "@winglibs/python", "description": "python library for Wing", - "version": "0.1.0", + "version": "0.1.1", "repository": { "type": "git", "url": "https://github.com/winglang/winglibs.git", diff --git a/python/sim/containers.w b/python/sim/containers.w index 443cd982..33bea9a9 100644 --- a/python/sim/containers.w +++ b/python/sim/containers.w @@ -104,7 +104,7 @@ pub class Container { this.public = props.public ?? false; if this.public { - if !props.port? { + if props.port == nil { throw "'port' is required if 'public' is enabled"; } @@ -113,7 +113,7 @@ pub class Container { this.publicUrlKey = key; } - if props.port? { + if props.port != nil { let key = "internal_url"; this.internalUrl = this.state.token(key); this.internalUrlKey = key; @@ -268,7 +268,7 @@ pub class Container { if let port = opts.port { let hostPort = out?.tryGetAt(0)?.tryGet("NetworkSettings")?.tryGet("Ports")?.tryGet("{port}/tcp")?.tryGetAt(0)?.tryGet("HostPort")?.tryAsStr(); - if !hostPort? { + if hostPort == nil { throw "Container does not listen to port {port}"; } diff --git a/python/util.extern.d.ts b/python/util.extern.d.ts index 37d6369b..5cfffc7c 100644 --- a/python/util.extern.d.ts +++ b/python/util.extern.d.ts @@ -22,6 +22,36 @@ those constructs are deployed before the resources depending ON them are deployed. */ export interface IDependable { } +/** Represents a construct. */ +export interface IConstruct extends IDependable { +} +/** Represents the building block of the construct graph. +All constructs besides the root construct must be created within the scope of +another construct. */ +export class Construct implements IConstruct { + /** Returns a string representation of this construct. */ + readonly toString: () => string; +} +/** Data that can be lifted into inflight. */ +export interface ILiftable { +} +/** A resource that can run inflight code. */ +export interface IInflightHost extends IResource { + /** Adds an environment variable to the host. */ + readonly addEnvironment: (name: string, value: string) => void; +} +/** A liftable object that needs to be registered on the host as part of the lifting process. +This is generally used so the host can set up permissions +to access the lifted object inflight. */ +export interface IHostedLiftable extends ILiftable { + /** A hook called by the Wing compiler once for each inflight host that needs to use this object inflight. + The list of requested inflight methods + needed by the inflight host are given by `ops`. + + This method is commonly used for adding permissions, environment variables, or + other capabilities to the inflight host. */ + readonly onLift: (host: IInflightHost, ops: (readonly (string)[])) => void; +} /** Options for `construct.addMetadata()`. */ export interface MetadataOptions { /** Include stack trace with metadata entry. */ @@ -157,40 +187,6 @@ export class Node { construct. */ readonly validate: () => (readonly (string)[]); } -/** Represents a construct. */ -export interface IConstruct extends IDependable { - /** The tree node. */ - readonly node: Node; -} -/** Represents the building block of the construct graph. -All constructs besides the root construct must be created within the scope of -another construct. */ -export class Construct implements IConstruct { - /** The tree node. */ - readonly node: Node; - /** Returns a string representation of this construct. */ - readonly toString: () => string; -} -/** Data that can be lifted into inflight. */ -export interface ILiftable { -} -/** A resource that can run inflight code. */ -export interface IInflightHost extends IResource { - /** Adds an environment variable to the host. */ - readonly addEnvironment: (name: string, value: string) => void; -} -/** A liftable object that needs to be registered on the host as part of the lifting process. -This is generally used so the host can set up permissions -to access the lifted object inflight. */ -export interface IHostedLiftable extends ILiftable { - /** A hook called by the Wing compiler once for each inflight host that needs to use this object inflight. - The list of requested inflight methods - needed by the inflight host are given by `ops`. - - This method is commonly used for adding permissions, environment variables, or - other capabilities to the inflight host. */ - readonly onLift: (host: IInflightHost, ops: (readonly (string)[])) => void; -} /** Abstract interface for `Resource`. */ export interface IResource extends IConstruct, IHostedLiftable { /** The tree node. */ diff --git a/tsoa/lib.extern.d.ts b/tsoa/lib.extern.d.ts index b5d316ab..e10b9be9 100644 --- a/tsoa/lib.extern.d.ts +++ b/tsoa/lib.extern.d.ts @@ -13,6 +13,36 @@ those constructs are deployed before the resources depending ON them are deployed. */ export interface IDependable { } +/** Represents a construct. */ +export interface IConstruct extends IDependable { +} +/** Represents the building block of the construct graph. +All constructs besides the root construct must be created within the scope of +another construct. */ +export class Construct implements IConstruct { + /** Returns a string representation of this construct. */ + readonly toString: () => string; +} +/** Data that can be lifted into inflight. */ +export interface ILiftable { +} +/** A resource that can run inflight code. */ +export interface IInflightHost extends IResource { + /** Adds an environment variable to the host. */ + readonly addEnvironment: (name: string, value: string) => void; +} +/** A liftable object that needs to be registered on the host as part of the lifting process. +This is generally used so the host can set up permissions +to access the lifted object inflight. */ +export interface IHostedLiftable extends ILiftable { + /** A hook called by the Wing compiler once for each inflight host that needs to use this object inflight. + The list of requested inflight methods + needed by the inflight host are given by `ops`. + + This method is commonly used for adding permissions, environment variables, or + other capabilities to the inflight host. */ + readonly onLift: (host: IInflightHost, ops: (readonly (string)[])) => void; +} /** Options for `construct.addMetadata()`. */ export interface MetadataOptions { /** Include stack trace with metadata entry. */ @@ -148,40 +178,6 @@ export class Node { construct. */ readonly validate: () => (readonly (string)[]); } -/** Represents a construct. */ -export interface IConstruct extends IDependable { - /** The tree node. */ - readonly node: Node; -} -/** Represents the building block of the construct graph. -All constructs besides the root construct must be created within the scope of -another construct. */ -export class Construct implements IConstruct { - /** The tree node. */ - readonly node: Node; - /** Returns a string representation of this construct. */ - readonly toString: () => string; -} -/** Data that can be lifted into inflight. */ -export interface ILiftable { -} -/** A resource that can run inflight code. */ -export interface IInflightHost extends IResource { - /** Adds an environment variable to the host. */ - readonly addEnvironment: (name: string, value: string) => void; -} -/** A liftable object that needs to be registered on the host as part of the lifting process. -This is generally used so the host can set up permissions -to access the lifted object inflight. */ -export interface IHostedLiftable extends ILiftable { - /** A hook called by the Wing compiler once for each inflight host that needs to use this object inflight. - The list of requested inflight methods - needed by the inflight host are given by `ops`. - - This method is commonly used for adding permissions, environment variables, or - other capabilities to the inflight host. */ - readonly onLift: (host: IInflightHost, ops: (readonly (string)[])) => void; -} /** Abstract interface for `Resource`. */ export interface IResource extends IConstruct, IHostedLiftable { /** The tree node. */ diff --git a/tsoa/package-lock.json b/tsoa/package-lock.json index 1168fc92..ceeca9cf 100644 --- a/tsoa/package-lock.json +++ b/tsoa/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/tsoa", - "version": "0.1.8", + "version": "0.1.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/tsoa", - "version": "0.1.8", + "version": "0.1.10", "license": "MIT", "peerDependencies": { "@cdktf/provider-aws": "^19.13.0", diff --git a/tsoa/package.json b/tsoa/package.json index fb02efe4..2bb0f376 100644 --- a/tsoa/package.json +++ b/tsoa/package.json @@ -1,7 +1,7 @@ { "name": "@winglibs/tsoa", "description": "TSOA library for Wing", - "version": "0.1.9", + "version": "0.1.10", "author": { "email": "eyalk@wing.cloud", "name": "Eyal Keren"