@anvil-cloud/sdk 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/block.d.ts ADDED
@@ -0,0 +1,53 @@
1
+ import * as pulumi from '@pulumi/pulumi';
2
+ /**
3
+ * Block is an optional organisational grouping for Anvil resources.
4
+ *
5
+ * Resources created inside a Block constructor are automatically parented
6
+ * to the Block via Pulumi's built-in auto-parenting. Blocks can expose
7
+ * public properties (outputs) for cross-Block references.
8
+ *
9
+ * `stage` and `project` are automatically available via `this.stage` and
10
+ * `this.project` — read from the same Pulumi config that App sets.
11
+ *
12
+ * Tagging is automatic — the App's provider injection applies `defaultTags`
13
+ * to all resources, including those inside Blocks.
14
+ *
15
+ * Blocks are purely optional — flat top-level resources work identically.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import * as anvil from "@anvil-cloud/sdk";
20
+ *
21
+ * class RulesEngine extends anvil.Block {
22
+ * public readonly bucketName: pulumi.Output<string>;
23
+ *
24
+ * constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
25
+ * super(name, {}, opts);
26
+ *
27
+ * const bucket = new anvil.aws.Bucket("events", {
28
+ * dataClassification: "internal",
29
+ * transform: {
30
+ * bucket: { bucket: `rules-${this.stage}-events` },
31
+ * },
32
+ * });
33
+ * }
34
+ * }
35
+ * ```
36
+ */
37
+ export interface BlockArgs {
38
+ [key: string]: any;
39
+ }
40
+ export declare class Block extends pulumi.ComponentResource {
41
+ /** The current deployment stage (e.g. "dev", "staging", "prod", or OS username). */
42
+ readonly stage: string;
43
+ /** The project name from anvil.yaml. */
44
+ readonly project: string;
45
+ /**
46
+ * Creates a new Block.
47
+ *
48
+ * @param name The unique name of this Block within the stack.
49
+ * @param args Optional arguments (passed through for subclass use).
50
+ * @param opts Standard Pulumi ComponentResourceOptions (aliases, providers, etc.).
51
+ */
52
+ constructor(name: string, args?: BlockArgs, opts?: pulumi.ComponentResourceOptions);
53
+ }
package/bin/block.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Block = void 0;
4
+ const pulumi = require("@pulumi/pulumi");
5
+ class Block extends pulumi.ComponentResource {
6
+ /**
7
+ * Creates a new Block.
8
+ *
9
+ * @param name The unique name of this Block within the stack.
10
+ * @param args Optional arguments (passed through for subclass use).
11
+ * @param opts Standard Pulumi ComponentResourceOptions (aliases, providers, etc.).
12
+ */
13
+ constructor(name, args, opts) {
14
+ const typeName = new.target?.name ?? name;
15
+ super(`anvil:block:${typeName}`, name, args ?? {}, opts);
16
+ const anvilConfig = new pulumi.Config('anvil');
17
+ this.stage = anvilConfig.require('stage');
18
+ this.project = pulumi.getProject();
19
+ }
20
+ }
21
+ exports.Block = Block;
22
+ //# sourceMappingURL=block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block.js","sourceRoot":"","sources":["../block.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AA0CzC,MAAa,KAAM,SAAQ,MAAM,CAAC,iBAAiB;IAOjD;;;;;;OAMG;IACH,YACE,IAAY,EACZ,IAAgB,EAChB,IAAsC;QAEtC,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,IAAI,IAAI,IAAI,CAAC;QAC1C,KAAK,CAAC,eAAe,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;QAEzD,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;CACF;AA1BD,sBA0BC"}
package/bin/index.d.ts CHANGED
@@ -6,3 +6,4 @@ import * as gcp from "./gcp";
6
6
  import * as types from "./types";
7
7
  export { aws, gcp, types, };
8
8
  export { App, AppConfig, Context, AwsProviderConfig, GcpProviderConfig, DefaultsConfig } from "./app";
9
+ export { Block, BlockArgs } from "./block";
package/bin/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // *** WARNING: this file was generated by pulumi-language-nodejs. ***
3
3
  // *** Do not edit by hand unless you're certain you know what you are doing! ***
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.App = exports.types = exports.gcp = exports.aws = exports.Provider = void 0;
5
+ exports.Block = exports.App = exports.types = exports.gcp = exports.aws = exports.Provider = void 0;
6
6
  const pulumi = require("@pulumi/pulumi");
7
7
  const utilities = require("./utilities");
8
8
  exports.Provider = null;
@@ -26,4 +26,7 @@ pulumi.runtime.registerResourcePackage("anvil", {
26
26
  // Hand-written App class
27
27
  var app_1 = require("./app");
28
28
  Object.defineProperty(exports, "App", { enumerable: true, get: function () { return app_1.App; } });
29
+ // Hand-written Block class
30
+ var block_1 = require("./block");
31
+ Object.defineProperty(exports, "Block", { enumerable: true, get: function () { return block_1.Block; } });
29
32
  //# sourceMappingURL=index.js.map
package/bin/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iFAAiF;;;AAEjF,yCAAyC;AACzC,yCAAyC;AAK5B,QAAA,QAAQ,GAAyC,IAAW,CAAC;AAC1E,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;AAGvE,sBAAsB;AACtB,6BAA6B;AAKzB,kBAAG;AAJP,6BAA6B;AAKzB,kBAAG;AAJP,iCAAiC;AAK7B,sBAAK;AAET,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,OAAO,EAAE;IAC5C,OAAO,EAAE,SAAS,CAAC,UAAU,EAAE;IAC/B,iBAAiB,EAAE,CAAC,IAAY,EAAE,IAAY,EAA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
1
  {
2
2
  "name": "@anvil-cloud/sdk",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "scripts": {
5
5
  "build": "tsc && cp package.json bin/"
6
6
  },
package/block.ts ADDED
@@ -0,0 +1,69 @@
1
+ import * as pulumi from '@pulumi/pulumi';
2
+
3
+ /**
4
+ * Block is an optional organisational grouping for Anvil resources.
5
+ *
6
+ * Resources created inside a Block constructor are automatically parented
7
+ * to the Block via Pulumi's built-in auto-parenting. Blocks can expose
8
+ * public properties (outputs) for cross-Block references.
9
+ *
10
+ * `stage` and `project` are automatically available via `this.stage` and
11
+ * `this.project` — read from the same Pulumi config that App sets.
12
+ *
13
+ * Tagging is automatic — the App's provider injection applies `defaultTags`
14
+ * to all resources, including those inside Blocks.
15
+ *
16
+ * Blocks are purely optional — flat top-level resources work identically.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * import * as anvil from "@anvil-cloud/sdk";
21
+ *
22
+ * class RulesEngine extends anvil.Block {
23
+ * public readonly bucketName: pulumi.Output<string>;
24
+ *
25
+ * constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
26
+ * super(name, {}, opts);
27
+ *
28
+ * const bucket = new anvil.aws.Bucket("events", {
29
+ * dataClassification: "internal",
30
+ * transform: {
31
+ * bucket: { bucket: `rules-${this.stage}-events` },
32
+ * },
33
+ * });
34
+ * }
35
+ * }
36
+ * ```
37
+ */
38
+
39
+ export interface BlockArgs {
40
+ [key: string]: any;
41
+ }
42
+
43
+ export class Block extends pulumi.ComponentResource {
44
+ /** The current deployment stage (e.g. "dev", "staging", "prod", or OS username). */
45
+ public readonly stage: string;
46
+
47
+ /** The project name from anvil.yaml. */
48
+ public readonly project: string;
49
+
50
+ /**
51
+ * Creates a new Block.
52
+ *
53
+ * @param name The unique name of this Block within the stack.
54
+ * @param args Optional arguments (passed through for subclass use).
55
+ * @param opts Standard Pulumi ComponentResourceOptions (aliases, providers, etc.).
56
+ */
57
+ constructor(
58
+ name: string,
59
+ args?: BlockArgs,
60
+ opts?: pulumi.ComponentResourceOptions
61
+ ) {
62
+ const typeName = new.target?.name ?? name;
63
+ super(`anvil:block:${typeName}`, name, args ?? {}, opts);
64
+
65
+ const anvilConfig = new pulumi.Config('anvil');
66
+ this.stage = anvilConfig.require('stage');
67
+ this.project = pulumi.getProject();
68
+ }
69
+ }
package/index.ts CHANGED
@@ -33,3 +33,6 @@ pulumi.runtime.registerResourcePackage("anvil", {
33
33
 
34
34
  // Hand-written App class
35
35
  export { App, AppConfig, Context, AwsProviderConfig, GcpProviderConfig, DefaultsConfig } from "./app";
36
+
37
+ // Hand-written Block class
38
+ export { Block, BlockArgs } from "./block";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anvil-cloud/sdk",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "scripts": {
5
5
  "build": "tsc && cp package.json bin/"
6
6
  },