Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@winglang/sdk

Package Overview
Dependencies
Maintainers
0
Versions
1728
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@winglang/sdk

The Wing SDK is the standard library of the Wing programming language, **but it can also be used as a standalone library from any CDK supported language**. For best experience it should be used with the Wing Language.

  • 0.85.34
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Wing SDK

The Wing SDK is the standard library of the Wing programming language, but it can also be used as a standalone library from any CDK supported language. For best experience it should be used with the Wing Language.

It contains the core set of cloud resources that are needed to build cloud applications. These resources are cloud agnostic and can be used to build applications that run on any cloud provider. The actual provider is determined at synth time by setting a target.

One of the supported targets is sim and can be used to run a cloud application locally, without an internet connection, iterate extremely fast and run tests that include cloud resources without needing to mock them.

The SDK is released as a private npm module named @winglang/sdk.

⛺ Installation

npm i @winglang/sdk

📝 Usage

With Wing

The Wing SDK is part of Wing's standard library. Create a new file called hello.w and import the SDK with bring cloud;:

bring cloud;

let queue = new cloud.Queue();

queue.setConsumer(inflight (message) => {
  log("Hello, {message}!");
});

Then use wing compile to compile your program to different clouds. Run wing compile --help to see what options are available!

As a TypeScript/JavaScript Library

The Wing SDK can be used just like ordinary CDK for TF Constructs.

import { Construct } from "constructs";
import { cloud } from "@winglang/sdk";

class HelloWorld extends Construct {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    let bucket = new cloud.Bucket(this, "bucket", {
      public: true,
    });
  }
}

This construct contains a Bucket from the cloud library which represents a polymorphic cloud resources whose actual implementation (local, aws, other clouds) is determined at synth time.

To use it in an application, you need to supply a synthesizer which will synthesize resources for the desired target. In the example below, a sim synthesizer is used which tells the SDK to produce a simulator (.wsim) file. The .wsim file can be passed to the Wing console to simulate the bucket using your file system. If the commented out TF AWS synthesizer is used instead, then a Terraform application will be synthesized. The Terraform application will include an AWS S3 Bucket to represent the Bucket.

import * as sim from "../../src/sim";
import * as tfaws from "../../src/tf-aws";

const app = new sim.App();
// const app = new tfaws.App(); // alternative
new HelloWorld(app, "HelloWorld");
app.synth();

📖 Documentation

✋ Contributing

We welcome community contributions and pull requests. See the Wing Contributor's Handbook for information on how to set up a development environment and add new resources to the SDK.

🐣 Getting help

If you need help either using or contributing to this project, please join us on our Wing Discord.

⚖️ License

This library is licensed under the MIT license.

FAQs

Package last updated on 27 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc