@pulumi/pulumi 3.150.1-alpha.x49a5173 → 3.150.1-alpha.xc30a2a1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pulumi/pulumi",
3
- "version": "3.150.1-alpha.x49a5173",
3
+ "version": "3.150.1-alpha.xc30a2a1",
4
4
  "description": "Pulumi's Node.js SDK",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -0,0 +1,37 @@
1
+ import { ComponentResource } from "../../resource";
2
+ export declare type PropertyType = "string" | "integer" | "number" | "boolean" | "array" | "object";
3
+ export declare type PropertyDefinition = {
4
+ type: PropertyType;
5
+ optional?: boolean;
6
+ plain?: boolean;
7
+ };
8
+ export declare type ComponentDefinition = {
9
+ name: string;
10
+ inputs: Record<string, PropertyDefinition>;
11
+ outputs: Record<string, PropertyDefinition>;
12
+ };
13
+ export declare type TypeDefinition = {
14
+ name: string;
15
+ };
16
+ export declare type AnalyzeResult = {
17
+ components: Record<string, ComponentDefinition>;
18
+ typeDefinitons: Record<string, TypeDefinition>;
19
+ };
20
+ export declare class Analyzer {
21
+ private path;
22
+ private checker;
23
+ private program;
24
+ private components;
25
+ private typeDefinitons;
26
+ constructor(dir: string);
27
+ analyze(): AnalyzeResult;
28
+ findComponent(name: string): Promise<typeof ComponentResource>;
29
+ private analyseFile;
30
+ private analyzeComponent;
31
+ private isPulumiComponent;
32
+ private isOutput;
33
+ private unwrapOutputIntersection;
34
+ private analyzeSymbolTable;
35
+ private analyzeSymbol;
36
+ private analyzeType;
37
+ }
@@ -0,0 +1,276 @@
1
+ "use strict";
2
+ // Copyright 2025-2025, Pulumi Corporation.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
28
+ result["default"] = mod;
29
+ return result;
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ const path = __importStar(require("path"));
33
+ // Use the TypeScript shim which allows us to fallback to a vendored version of
34
+ // TypeScript if the user has not installed it.
35
+ // TODO: we should consider requiring the user to install TypeScript and not
36
+ // rely on the shim. In any case, we should add tests for providers with
37
+ // different versions of TypeScript in their dependencies, to ensure the
38
+ // analyzer code is compatible with all of them.
39
+ const ts = require("../../typescript-shim");
40
+ class Analyzer {
41
+ constructor(dir) {
42
+ this.components = {};
43
+ this.typeDefinitons = {};
44
+ const configPath = `${dir}/tsconfig.json`;
45
+ const config = ts.readConfigFile(configPath, ts.sys.readFile);
46
+ const parsedConfig = ts.parseJsonConfigFileContent(config.config, ts.sys, path.dirname(configPath));
47
+ this.path = dir;
48
+ this.program = ts.createProgram({
49
+ rootNames: parsedConfig.fileNames,
50
+ options: parsedConfig.options,
51
+ });
52
+ this.checker = this.program.getTypeChecker();
53
+ }
54
+ analyze() {
55
+ const sourceFiles = this.program.getSourceFiles();
56
+ for (const sourceFile of sourceFiles) {
57
+ if (sourceFile.fileName.includes("node_modules") || sourceFile.fileName.endsWith(".d.ts")) {
58
+ continue;
59
+ }
60
+ this.analyseFile(sourceFile);
61
+ }
62
+ return {
63
+ components: this.components,
64
+ typeDefinitons: this.typeDefinitons,
65
+ };
66
+ }
67
+ findComponent(name) {
68
+ var _a;
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ const sourceFiles = this.program.getSourceFiles();
71
+ for (const sourceFile of sourceFiles) {
72
+ if (sourceFile.fileName.includes("node_modules") || sourceFile.fileName.endsWith(".d.ts")) {
73
+ continue;
74
+ }
75
+ for (const node of sourceFile.statements) {
76
+ if (ts.isClassDeclaration(node) && this.isPulumiComponent(node) && node.name) {
77
+ if (ts.isClassDeclaration(node) && this.isPulumiComponent(node) && ((_a = node.name) === null || _a === void 0 ? void 0 : _a.text) === name) {
78
+ try {
79
+ const module = yield Promise.resolve().then(() => __importStar(require(sourceFile.fileName)));
80
+ return module[name];
81
+ }
82
+ catch (e) {
83
+ throw new Error(`Failed to import component '${name}': ${e}`);
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ throw new Error(`Component '${name}' not found`);
90
+ });
91
+ }
92
+ analyseFile(sourceFile) {
93
+ // We intentionally visit only the top-level nodes, because we only
94
+ // support components defined at the top-level. We have no way to
95
+ // instantiate components defined inside functions or methods.
96
+ sourceFile.forEachChild((node) => {
97
+ if (ts.isClassDeclaration(node) && this.isPulumiComponent(node) && node.name) {
98
+ const component = this.analyzeComponent(node);
99
+ this.components[component.name] = component;
100
+ }
101
+ });
102
+ }
103
+ analyzeComponent(node) {
104
+ var _a;
105
+ const componentName = (_a = node.name) === null || _a === void 0 ? void 0 : _a.text;
106
+ // We expect exactly 1 constructor, and it must have and 'args'
107
+ // parameter that has an interface type.
108
+ const constructors = node.members.filter((member) => ts.isConstructorDeclaration(member));
109
+ if (constructors.length !== 1) {
110
+ throw new Error(`Component '${componentName}' must have exactly one constructor`);
111
+ }
112
+ const argsParam = constructors === null || constructors === void 0 ? void 0 : constructors[0].parameters.find((param) => {
113
+ return ts.isIdentifier(param.name) && param.name.escapedText === "args";
114
+ });
115
+ if (!argsParam) {
116
+ throw new Error(`Component '${componentName}' constructor must have an 'args' parameter`);
117
+ }
118
+ if (!argsParam.type) {
119
+ throw new Error(`Component '${componentName}' constructor 'args' parameter must have a type`);
120
+ }
121
+ const args = this.checker.getTypeAtLocation(argsParam.type);
122
+ const argsSymbol = args.getSymbol();
123
+ if (!argsSymbol || !isInterface(argsSymbol)) {
124
+ throw new Error(`Component '${componentName}' constructor 'args' parameter must be an interface`);
125
+ }
126
+ let inputs = {};
127
+ if (argsSymbol.members) {
128
+ inputs = this.analyzeSymbolTable(argsSymbol.members, argsParam);
129
+ }
130
+ let outputs = {};
131
+ const classType = this.checker.getTypeAtLocation(node);
132
+ const classSymbol = classType.getSymbol();
133
+ if (classSymbol === null || classSymbol === void 0 ? void 0 : classSymbol.members) {
134
+ outputs = this.analyzeSymbolTable(classSymbol.members, node);
135
+ }
136
+ return {
137
+ name: componentName,
138
+ inputs,
139
+ outputs,
140
+ };
141
+ }
142
+ isPulumiComponent(node) {
143
+ if (!node.heritageClauses) {
144
+ return false;
145
+ }
146
+ return node.heritageClauses.some((clause) => {
147
+ return clause.types.some((clauseNode) => {
148
+ var _a;
149
+ const type = this.checker.getTypeAtLocation(clauseNode);
150
+ const symbol = type.getSymbol();
151
+ const matchesName = (symbol === null || symbol === void 0 ? void 0 : symbol.escapedName) === "ComponentResource";
152
+ const sourceFile = (_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0].getSourceFile();
153
+ const matchesSourceFile = (sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.fileName.endsWith("resource.ts")) || (sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.fileName.endsWith("resource.d.ts"));
154
+ return matchesName && matchesSourceFile;
155
+ });
156
+ });
157
+ }
158
+ isOutput(type) {
159
+ var _a;
160
+ // In sdk/nodejs/output.ts we define Output as:
161
+ //
162
+ // export type Output<T> = OutputInstance<T> & Lifted<T>;
163
+ //
164
+ // Depending on T, we might have an OutputInstance<T> because Lifted<T>
165
+ // does not add anything to the resulting type, or we get the
166
+ // intersection. In the latter case, we want to find the
167
+ // OutputInstance<T> within the intersection.
168
+ if (type.isIntersection()) {
169
+ for (const t of type.types) {
170
+ if (this.isOutput(t)) {
171
+ return true;
172
+ }
173
+ }
174
+ }
175
+ const symbol = type.getSymbol();
176
+ const matchesName = (symbol === null || symbol === void 0 ? void 0 : symbol.escapedName) === "OutputInstance" || (symbol === null || symbol === void 0 ? void 0 : symbol.escapedName) === "Output";
177
+ const sourceFile = (_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0].getSourceFile();
178
+ const matchesSourceFile = (sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.fileName.endsWith("output.ts")) || (sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.fileName.endsWith("output.d.ts"));
179
+ return !!matchesName && !!matchesSourceFile;
180
+ }
181
+ unwrapOutputIntersection(type) {
182
+ if (type.isIntersection()) {
183
+ for (const t of type.types) {
184
+ if (this.isOutput(t)) {
185
+ return t;
186
+ }
187
+ }
188
+ }
189
+ return type;
190
+ }
191
+ analyzeSymbolTable(members, location) {
192
+ const properties = {};
193
+ members.forEach((member) => {
194
+ if (!isPropertyDeclaration(member)) {
195
+ return;
196
+ }
197
+ const name = member.escapedName;
198
+ properties[name] = this.analyzeSymbol(member, location);
199
+ });
200
+ return properties;
201
+ }
202
+ analyzeSymbol(symbol, location) {
203
+ // Check if the property is optional, e.g.: myProp?: string; This is
204
+ // defined on the symbol, not the type.
205
+ const optional = isOptional(symbol);
206
+ const propType = this.checker.getTypeOfSymbolAtLocation(symbol, location);
207
+ return this.analyzeType(propType, optional, true);
208
+ }
209
+ analyzeType(type, optional = false, plain = true) {
210
+ if (isPlain(type)) {
211
+ const prop = { type: tsTypeToPropertyType(type) };
212
+ if (optional) {
213
+ prop.optional = true;
214
+ }
215
+ if (plain) {
216
+ prop.plain = true;
217
+ }
218
+ return prop;
219
+ }
220
+ else if (this.isOutput(type)) {
221
+ type = this.unwrapOutputIntersection(type);
222
+ // Grab the inner type of the OutputInstance<T> type, and then
223
+ // recurse, passing through the optional flag. The type can now not
224
+ // be plain anymore, since it's wrapped in an output.
225
+ const typeArguments = type.typeArguments;
226
+ if (!typeArguments || typeArguments.length !== 1) {
227
+ throw new Error(`OutputInstance must have a type argument, got '${this.checker.typeToString(type)}`);
228
+ }
229
+ const innerType = typeArguments[0];
230
+ return this.analyzeType(innerType, optional, false /* canBePlain */);
231
+ }
232
+ else if (type.isUnion()) {
233
+ throw new Error(`Union types are not supported, got '${this.checker.typeToString(type)}`);
234
+ }
235
+ else if (type.isIntersection()) {
236
+ throw new Error(`Intersection types are not supported, got '${this.checker.typeToString(type)}`);
237
+ }
238
+ throw new Error(`Unsupported type '${this.checker.typeToString(type)}'`);
239
+ }
240
+ }
241
+ exports.Analyzer = Analyzer;
242
+ function isOptional(symbol) {
243
+ return (symbol.flags & ts.SymbolFlags.Optional) === ts.SymbolFlags.Optional;
244
+ }
245
+ function isInterface(symbol) {
246
+ return (symbol.flags & ts.SymbolFlags.Interface) === ts.SymbolFlags.Interface;
247
+ }
248
+ function isPropertyDeclaration(symbol) {
249
+ return (symbol.flags & ts.SymbolFlags.Property) === ts.SymbolFlags.Property;
250
+ }
251
+ function isNumber(type) {
252
+ return (type.flags & ts.TypeFlags.Number) === ts.TypeFlags.Number;
253
+ }
254
+ function isString(type) {
255
+ return (type.flags & ts.TypeFlags.String) === ts.TypeFlags.String;
256
+ }
257
+ function isBoolean(type) {
258
+ return (type.flags & ts.TypeFlags.Boolean) === ts.TypeFlags.Boolean;
259
+ }
260
+ function isPlain(type) {
261
+ return isNumber(type) || isString(type) || isBoolean(type);
262
+ }
263
+ function tsTypeToPropertyType(type) {
264
+ var _a;
265
+ if (isNumber(type)) {
266
+ return "number";
267
+ }
268
+ else if (isString(type)) {
269
+ return "string";
270
+ }
271
+ else if (isBoolean(type)) {
272
+ return "boolean";
273
+ }
274
+ throw new Error(`Unsupported type '${(_a = type.symbol) === null || _a === void 0 ? void 0 : _a.name}'`);
275
+ }
276
+ //# sourceMappingURL=analyzer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyzer.js","sourceRoot":"","sources":["../../../provider/experimental/analyzer.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;;;;;;;;;;;;;;AAKjC,2CAA6B;AAG7B,+EAA+E;AAC/E,+CAA+C;AAC/C,4EAA4E;AAC5E,wEAAwE;AACxE,wEAAwE;AACxE,gDAAgD;AAChD,MAAM,EAAE,GAAsB,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAyB/D,MAAa,QAAQ;IAOjB,YAAY,GAAW;QAHf,eAAU,GAAwC,EAAE,CAAC;QACrD,mBAAc,GAAmC,EAAE,CAAC;QAGxD,MAAM,UAAU,GAAG,GAAG,GAAG,gBAAgB,CAAC;QAC1C,MAAM,MAAM,GAAG,EAAE,CAAC,cAAc,CAAC,UAAU,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9D,MAAM,YAAY,GAAG,EAAE,CAAC,0BAA0B,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QACpG,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC;YAC5B,SAAS,E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SAAS,SAAS,CAAC,IAAqB;IACpC,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;AACxE,CAAC;AAED,SAAS,OAAO,CAAC,IAAqB;IAClC,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAqB;;IAC/C,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE;QAChB,OAAO,QAAQ,CAAC;KACnB;SAAM,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE;QACvB,OAAO,QAAQ,CAAC;KACnB;SAAM,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE;QACxB,OAAO,SAAS,CAAC;KACpB;IAED,MAAM,IAAI,KAAK,CAAC,qBAAqB,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,GAAG,CAAC,CAAC;AAC/D,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./provider";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ // Copyright 2025-2025, Pulumi Corporation.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ function __export(m) {
16
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
17
+ }
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ __export(require("./provider"));
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../provider/experimental/index.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;AAEjC,gCAA2B"}
@@ -0,0 +1,15 @@
1
+ import { ComponentResourceOptions } from "../../resource";
2
+ import { ConstructResult, Provider } from "../provider";
3
+ import { Inputs } from "../../output";
4
+ export declare class ComponentProvider implements Provider {
5
+ readonly dir: string;
6
+ private packageJSON;
7
+ private path;
8
+ private analyzer;
9
+ version: string;
10
+ static validateResourceType(packageName: string, resourceType: string): void;
11
+ constructor(dir: string);
12
+ getSchema(): Promise<string>;
13
+ construct(name: string, type: string, inputs: Inputs, options: ComponentResourceOptions): Promise<ConstructResult>;
14
+ }
15
+ export declare function componentProviderHost(dirname?: string): Promise<void>;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ // Copyright 2025-2025, Pulumi Corporation.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
28
+ result["default"] = mod;
29
+ return result;
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ const fs_1 = require("fs");
33
+ const path = __importStar(require("path"));
34
+ const server_1 = require("../server");
35
+ const schema_1 = require("./schema");
36
+ const analyzer_1 = require("./analyzer");
37
+ class ComponentProvider {
38
+ constructor(dir) {
39
+ this.dir = dir;
40
+ const absDir = path.resolve(dir);
41
+ const packStr = fs_1.readFileSync(`${absDir}/package.json`, { encoding: "utf-8" });
42
+ this.packageJSON = JSON.parse(packStr);
43
+ this.version = this.packageJSON.version;
44
+ this.path = absDir;
45
+ this.analyzer = new analyzer_1.Analyzer(this.path);
46
+ }
47
+ static validateResourceType(packageName, resourceType) {
48
+ const parts = resourceType.split(":");
49
+ if (parts.length !== 3) {
50
+ throw new Error(`Invalid resource type ${resourceType}`);
51
+ }
52
+ if (parts[0] !== packageName) {
53
+ throw new Error(`Invalid package name ${parts[0]}, expected '${packageName}'`);
54
+ }
55
+ // We might want to relax this limitation, but for now we only support the "index" module.
56
+ if (parts[1] !== "index" && parts[1] !== "") {
57
+ throw new Error(`Invalid module '${parts[1]}' in resource type '${resourceType}', expected 'index' or empty string`);
58
+ }
59
+ if (parts[2].length === 0) {
60
+ throw new Error(`Empty resource name in resource type '${resourceType}'`);
61
+ }
62
+ }
63
+ getSchema() {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ const { components, typeDefinitons } = this.analyzer.analyze();
66
+ const schema = schema_1.generateSchema(this.packageJSON, components, typeDefinitons);
67
+ return JSON.stringify(schema);
68
+ });
69
+ }
70
+ construct(name, type, inputs, options) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ ComponentProvider.validateResourceType(this.packageJSON.name, type);
73
+ const componentName = type.split(":")[2];
74
+ const ComponentClass = yield this.analyzer.findComponent(componentName);
75
+ // The ComponentResource base class has a 4 argument constructor, but
76
+ // the user defined component has a 3 argument constructor without the
77
+ // typestring.
78
+ // @ts-ignore
79
+ const instance = new ComponentClass(name, inputs, options);
80
+ return {
81
+ urn: instance.urn,
82
+ state: {},
83
+ };
84
+ });
85
+ }
86
+ }
87
+ exports.ComponentProvider = ComponentProvider;
88
+ function componentProviderHost(dirname) {
89
+ const args = process.argv.slice(2);
90
+ // If dirname is not provided, get it from the call stack
91
+ if (!dirname) {
92
+ // Get the stack trace
93
+ const stack = new Error().stack;
94
+ // Parse the stack to get the caller's file
95
+ // Stack format is like:
96
+ // Error
97
+ // at componentProviderHost (.../src/index.ts:3:16)
98
+ // at Object.<anonymous> (.../caller/index.ts:4:1)
99
+ const callerLine = stack === null || stack === void 0 ? void 0 : stack.split("\n")[2];
100
+ const match = callerLine === null || callerLine === void 0 ? void 0 : callerLine.match(/\((.+):[0-9]+:[0-9]+\)/);
101
+ if (match === null || match === void 0 ? void 0 : match[1]) {
102
+ dirname = path.dirname(match[1]);
103
+ }
104
+ else {
105
+ throw new Error("Could not determine caller directory");
106
+ }
107
+ }
108
+ const prov = new ComponentProvider(dirname);
109
+ return server_1.main(prov, args);
110
+ }
111
+ exports.componentProviderHost = componentProviderHost;
112
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../provider/experimental/provider.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;;;;;;;;;;;;;;AAEjC,2BAAkC;AA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uD;QACvD,sDAAsD;QACtD,MAAM,UAAU,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC1D,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,GAAG;YACZ,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACpC;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;SAC3D;KACJ;IAED,MAAM,IAAI,GAAG,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,aAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC;AAtBD,sDAsBC"}
@@ -0,0 +1,58 @@
1
+ import { ComponentDefinition, TypeDefinition } from "./analyzer";
2
+ export declare type PropertyType = "string" | "integer" | "number" | "boolean" | "array" | "object";
3
+ /**
4
+ * https://www.pulumi.com/docs/iac/using-pulumi/pulumi-packages/schema/#property
5
+ */
6
+ export interface Property {
7
+ type: PropertyType;
8
+ items?: Property;
9
+ additionalProperties?: Property;
10
+ ref?: string;
11
+ plain?: boolean;
12
+ description?: string;
13
+ }
14
+ /**
15
+ * https://www.pulumi.com/docs/iac/using-pulumi/pulumi-packages/schema/#objecttype
16
+ */
17
+ export interface ObjectType {
18
+ type: PropertyType;
19
+ description?: string;
20
+ properties?: {
21
+ [key: string]: Property;
22
+ };
23
+ required?: string[];
24
+ }
25
+ /**
26
+ * https://www.pulumi.com/docs/iac/using-pulumi/pulumi-packages/schema/#complextype
27
+ */
28
+ export interface ComplexType extends ObjectType {
29
+ enum?: string[];
30
+ }
31
+ /**
32
+ * https://www.pulumi.com/docs/iac/using-pulumi/pulumi-packages/schema/#resource
33
+ */
34
+ export interface Resource extends ObjectType {
35
+ isComponent?: boolean;
36
+ inputProperties?: {
37
+ [key: string]: Property;
38
+ };
39
+ requiredInputs?: string[];
40
+ }
41
+ /**
42
+ * https://www.pulumi.com/docs/iac/using-pulumi/pulumi-packages/schema/#package
43
+ */
44
+ export interface PackageSpec {
45
+ name: string;
46
+ version?: string;
47
+ description?: string;
48
+ resources: {
49
+ [key: string]: Resource;
50
+ };
51
+ types: {
52
+ [key: string]: ComplexType;
53
+ };
54
+ language?: {
55
+ [key: string]: any;
56
+ };
57
+ }
58
+ export declare function generateSchema(packageJSON: Record<string, any>, components: Record<string, ComponentDefinition>, typeDefinitons: Record<string, TypeDefinition>): PackageSpec;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ // Copyright 2025-2025, Pulumi Corporation.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ function generateSchema(packageJSON, components, typeDefinitons) {
17
+ const providerName = packageJSON.name;
18
+ const result = {
19
+ name: providerName,
20
+ version: packageJSON.version,
21
+ description: packageJSON.description,
22
+ resources: {},
23
+ types: {},
24
+ language: {
25
+ nodejs: {
26
+ dependencies: {},
27
+ devDependencies: {
28
+ typescript: "^5.0.0",
29
+ },
30
+ respectSchemaVersion: true,
31
+ },
32
+ python: {
33
+ respectSchemaVersion: true,
34
+ },
35
+ csharp: {
36
+ respectSchemaVersion: true,
37
+ },
38
+ java: {
39
+ respectSchemaVersion: true,
40
+ },
41
+ go: {
42
+ respectSchemaVersion: true,
43
+ },
44
+ },
45
+ };
46
+ for (const [name, component] of Object.entries(components)) {
47
+ result.resources[`${providerName}:index:${name}`] = {
48
+ type: "object",
49
+ isComponent: true,
50
+ inputProperties: component.inputs,
51
+ requiredInputs: Object.entries(component.inputs)
52
+ .filter(([_, def]) => !def.optional)
53
+ .map(([propName, _]) => propName)
54
+ .sort(),
55
+ properties: component.outputs,
56
+ required: Object.entries(component.outputs)
57
+ .filter(([_, def]) => !def.optional)
58
+ .map(([propName, _]) => propName)
59
+ .sort(),
60
+ };
61
+ }
62
+ for (const [name, type] of Object.entries(typeDefinitons)) {
63
+ result.types[`${providerName}:index:${name}`] = {
64
+ type: "object",
65
+ };
66
+ }
67
+ return result;
68
+ }
69
+ exports.generateSchema = generateSchema;
70
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../provider/experimental/schema.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAwDjC,SAAgB,cAAc,CAC1B,WAAgC,EAChC,UAA+C,EAC/C,cAA8C;IAE9C,MAAM,YAAY,GAAG,WAAW,CAAC,IAAI,CAAC;IACtC,MAAM,MAAM,GAAgB;QACxB,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,WAAW,EAAE,WAAW,CAAC,WAAW;QACpC,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE;YACN,MAAM,EAAE;gBACJ,YAAY,EAAE,EAAE;gBAChB,eAAe,EAAE;oBACb,UAAU,EAAE,QAAQ;iBACvB;gBACD,oBAAoB,EAAE,IAAI;aAC7B;YACD,MAAM,EAAE;gBACJ,oBAAoB,EAAE,IAAI;aAC7B;YACD,MAAM,EAAE;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OAAO,MAAM,CAAC;AAClB,CAAC;AA3DD,wCA2DC"}
package/version.js CHANGED
@@ -13,5 +13,5 @@
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.version = "3.150.1-alpha.x49a5173";
16
+ exports.version = "3.150.1-alpha.xc30a2a1";
17
17
  //# sourceMappingURL=version.js.map