@anvil-cloud/sdk 0.0.5 → 0.0.7
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 +53 -0
- package/bin/block.js +22 -0
- package/bin/block.js.map +1 -0
- package/bin/index.d.ts +5 -0
- package/bin/index.js +19 -1
- package/bin/index.js.map +1 -1
- package/bin/package.json +1 -1
- package/block.ts +69 -0
- package/index.ts +26 -0
- package/package.json +1 -1
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
|
package/bin/block.js.map
ADDED
|
@@ -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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
1
2
|
export { ProviderArgs } from "./provider";
|
|
2
3
|
export type Provider = import("./provider").Provider;
|
|
3
4
|
export declare const Provider: typeof import("./provider").Provider;
|
|
@@ -6,3 +7,7 @@ import * as gcp from "./gcp";
|
|
|
6
7
|
import * as types from "./types";
|
|
7
8
|
export { aws, gcp, types, };
|
|
8
9
|
export { App, AppConfig, Context, AwsProviderConfig, GcpProviderConfig, DefaultsConfig } from "./app";
|
|
10
|
+
export { Block, BlockArgs } from "./block";
|
|
11
|
+
export { ComponentResource, ComponentResourceOptions, CustomResource, ResourceOptions, ProviderResource, Config, output, all, secret, interpolate, concat, getProject, getStack, } from "@pulumi/pulumi";
|
|
12
|
+
export type { Output, Input, Inputs } from "@pulumi/pulumi";
|
|
13
|
+
export { pulumi };
|
package/bin/index.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
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.pulumi = exports.getStack = exports.getProject = exports.concat = exports.interpolate = exports.secret = exports.all = exports.output = exports.Config = exports.ProviderResource = exports.CustomResource = exports.ComponentResource = exports.Block = exports.App = exports.types = exports.gcp = exports.aws = exports.Provider = void 0;
|
|
6
6
|
const pulumi = require("@pulumi/pulumi");
|
|
7
|
+
exports.pulumi = pulumi;
|
|
7
8
|
const utilities = require("./utilities");
|
|
8
9
|
exports.Provider = null;
|
|
9
10
|
utilities.lazyLoad(exports, ["Provider"], () => require("./provider"));
|
|
@@ -26,4 +27,21 @@ pulumi.runtime.registerResourcePackage("anvil", {
|
|
|
26
27
|
// Hand-written App class
|
|
27
28
|
var app_1 = require("./app");
|
|
28
29
|
Object.defineProperty(exports, "App", { enumerable: true, get: function () { return app_1.App; } });
|
|
30
|
+
// Hand-written Block class
|
|
31
|
+
var block_1 = require("./block");
|
|
32
|
+
Object.defineProperty(exports, "Block", { enumerable: true, get: function () { return block_1.Block; } });
|
|
33
|
+
// Re-exported Pulumi primitives
|
|
34
|
+
// Users can import anvil.Output, anvil.ComponentResource, etc. without @pulumi/pulumi
|
|
35
|
+
var pulumi_1 = require("@pulumi/pulumi");
|
|
36
|
+
Object.defineProperty(exports, "ComponentResource", { enumerable: true, get: function () { return pulumi_1.ComponentResource; } });
|
|
37
|
+
Object.defineProperty(exports, "CustomResource", { enumerable: true, get: function () { return pulumi_1.CustomResource; } });
|
|
38
|
+
Object.defineProperty(exports, "ProviderResource", { enumerable: true, get: function () { return pulumi_1.ProviderResource; } });
|
|
39
|
+
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return pulumi_1.Config; } });
|
|
40
|
+
Object.defineProperty(exports, "output", { enumerable: true, get: function () { return pulumi_1.output; } });
|
|
41
|
+
Object.defineProperty(exports, "all", { enumerable: true, get: function () { return pulumi_1.all; } });
|
|
42
|
+
Object.defineProperty(exports, "secret", { enumerable: true, get: function () { return pulumi_1.secret; } });
|
|
43
|
+
Object.defineProperty(exports, "interpolate", { enumerable: true, get: function () { return pulumi_1.interpolate; } });
|
|
44
|
+
Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return pulumi_1.concat; } });
|
|
45
|
+
Object.defineProperty(exports, "getProject", { enumerable: true, get: function () { return pulumi_1.getProject; } });
|
|
46
|
+
Object.defineProperty(exports, "getStack", { enumerable: true, get: function () { return pulumi_1.getStack; } });
|
|
29
47
|
//# 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;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iFAAiF;;;AAEjF,yCAAyC;AAyDhC,wBAAM;AAxDf,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,EAAE,GAAW,EAA2B,EAAE;QACpF,IAAI,IAAI,KAAK,wBAAwB,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;SACpD;QACD,OAAO,IAAI,gBAAQ,CAAC,IAAI,EAAO,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;CACJ,CAAC,CAAC;AAEH,yBAAyB;AACzB,6BAAsG;AAA7F,0FAAA,GAAG,OAAA;AAEZ,2BAA2B;AAC3B,iCAA2C;AAAlC,8FAAA,KAAK,OAAA;AAEd,gCAAgC;AAChC,sFAAsF;AACtF,yCAcwB;AAbtB,2GAAA,iBAAiB,OAAA;AAEjB,wGAAA,cAAc,OAAA;AAEd,0GAAA,gBAAgB,OAAA;AAChB,gGAAA,MAAM,OAAA;AACN,gGAAA,MAAM,OAAA;AACN,6FAAA,GAAG,OAAA;AACH,gGAAA,MAAM,OAAA;AACN,qGAAA,WAAW,OAAA;AACX,gGAAA,MAAM,OAAA;AACN,oGAAA,UAAU,OAAA;AACV,kGAAA,QAAQ,OAAA"}
|
package/bin/package.json
CHANGED
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,29 @@ 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";
|
|
39
|
+
|
|
40
|
+
// Re-exported Pulumi primitives
|
|
41
|
+
// Users can import anvil.Output, anvil.ComponentResource, etc. without @pulumi/pulumi
|
|
42
|
+
export {
|
|
43
|
+
ComponentResource,
|
|
44
|
+
ComponentResourceOptions,
|
|
45
|
+
CustomResource,
|
|
46
|
+
ResourceOptions,
|
|
47
|
+
ProviderResource,
|
|
48
|
+
Config,
|
|
49
|
+
output,
|
|
50
|
+
all,
|
|
51
|
+
secret,
|
|
52
|
+
interpolate,
|
|
53
|
+
concat,
|
|
54
|
+
getProject,
|
|
55
|
+
getStack,
|
|
56
|
+
} from "@pulumi/pulumi";
|
|
57
|
+
export type { Output, Input, Inputs } from "@pulumi/pulumi";
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
// Escape hatch — full Pulumi namespace for anything not re-exported
|
|
61
|
+
export { pulumi };
|