@highstate/pulumi 0.6.2 → 0.7.1

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/dist/index.d.ts CHANGED
@@ -138,7 +138,7 @@ interface UnitContext<TArgs extends Record<string, ArgumentValue>, TInputs exten
138
138
  [K in keyof TInputs]: undefined extends TInputs[K] ? Output<NonNullable<TInputs[K]>> | undefined : Output<TInputs[K]>;
139
139
  };
140
140
  invokedTriggers: InstanceTriggerInvocation[];
141
- outputs(this: void, outputs: OutputMapToDeepInputMap<TOutputs>): Promise<unknown>;
141
+ outputs(this: void, outputs?: OutputMapToDeepInputMap<TOutputs>): Promise<unknown>;
142
142
  }
143
143
  type InputSpecToValue<T extends ComponentInputSpec> = T[2] extends true ? Static<T[0]["schema"]>[] : T[1] extends true ? Static<T[0]["schema"]> : Static<T[0]["schema"]> | undefined;
144
144
  type InputSpecMapToValueMap<T extends Record<string, ComponentInputSpec>> = T extends Record<string, never> ? Record<string, never> : {
@@ -150,7 +150,4 @@ type EntityInput<T extends Entity> = Output<EntityValue<T>>;
150
150
 
151
151
  declare function getOrCreateSecret<TSecrets extends Record<string, unknown>, TResult extends TSecrets[keyof TSecrets]>(secrets: Output<TSecrets>, key: keyof TSecrets, create: () => Input<TResult>): Output<TResult>;
152
152
 
153
- declare function resolvePackagePath(packageName: string, path: string, parent: string): string;
154
- declare function readResolvedPackageFileSync(packageName: string, path: string, parent: string): string;
155
-
156
- export { type DeepInput, type EntityInput, type EntityValue, type ExtraOutputs, type InputArray, type InputMap, type InputOrArray, type InstanceFile, type InstancePage, type InstancePageBlock, type InstanceTerminal, type InstanceTerminalFile, type InstanceTrigger, type InstanceTriggerInvocation, type InstanceTriggerSpec, type StatusField, type UnitContext, apply, flatMapInput, flattenInputs, forUnit, getOrCreateSecret, mapInputs, mapOptional, mergeInputObjects, normalize, providerFactory, readResolvedPackageFileSync, resolvePackagePath, singleton, toPromise };
153
+ export { type DeepInput, type EntityInput, type EntityValue, type ExtraOutputs, type InputArray, type InputMap, type InputOrArray, type InstanceFile, type InstancePage, type InstancePageBlock, type InstanceTerminal, type InstanceTerminalFile, type InstanceTrigger, type InstanceTriggerInvocation, type InstanceTriggerSpec, type StatusField, type UnitContext, apply, flatMapInput, flattenInputs, forUnit, getOrCreateSecret, mapInputs, mapOptional, mergeInputObjects, normalize, providerFactory, singleton, toPromise };
package/dist/index.mjs CHANGED
@@ -4,10 +4,6 @@ import { getInstanceId, parseInstanceId } from '@highstate/contract';
4
4
  import { Type } from '@sinclair/typebox';
5
5
  import { mapValues, pipe, pickBy } from 'remeda';
6
6
  import { Ajv } from 'ajv';
7
- import { fileURLToPath } from 'node:url';
8
- import { readFileSync } from 'node:fs';
9
- import { resolve as resolve$1 } from 'node:path';
10
- import { resolve } from 'import-meta-resolve';
11
7
 
12
8
  const createdSecrets = {};
13
9
  function getOrCreateSecret(secrets, key, create) {
@@ -159,7 +155,7 @@ function forUnit(unit) {
159
155
  secrets,
160
156
  inputs,
161
157
  invokedTriggers: config.getObject("$invokedTriggers") ?? [],
162
- outputs: async (outputs) => {
158
+ outputs: async (outputs = {}) => {
163
159
  const result = mapValues(outputs, (outputValue, outputName) => {
164
160
  if (outputName === "$status") {
165
161
  return output(outputValue).apply(mapStatus);
@@ -190,6 +186,12 @@ function forUnit(unit) {
190
186
  );
191
187
  }
192
188
  return output(outputValue).apply((value) => {
189
+ if (value === void 0) {
190
+ if (outputModel.required) {
191
+ throw new Error(`Output '${outputName}' is required.`);
192
+ }
193
+ return void 0;
194
+ }
193
195
  if (!ajv.validate(entity.schema, value)) {
194
196
  throw new Error(`Invalid output for '${outputModel.type}': ${ajv.errorsText()}`);
195
197
  }
@@ -351,27 +353,4 @@ function apply(fn) {
351
353
  return (input) => output(input).apply(fn);
352
354
  }
353
355
 
354
- function resolvePackagePath(packageName, path, parent) {
355
- let resolved = fileURLToPath(resolve(packageName, parent));
356
- let singlePackageName = packageName;
357
- if (packageName.startsWith("@")) {
358
- singlePackageName = packageName.split("/")[1];
359
- } else {
360
- singlePackageName = packageName.split("/")[0];
361
- }
362
- if (!singlePackageName) {
363
- throw new Error(`Invalid package name: ${packageName}`);
364
- }
365
- while (!resolved.endsWith(singlePackageName)) {
366
- if (resolved === "/") {
367
- throw new Error(`Could not find package root of "${packageName}" in resolved path`);
368
- }
369
- resolved = resolve$1(resolved, "..");
370
- }
371
- return resolve$1(resolved, path);
372
- }
373
- function readResolvedPackageFileSync(packageName, path, parent) {
374
- return readFileSync(resolvePackagePath(packageName, path, parent), "utf-8");
375
- }
376
-
377
- export { apply, flatMapInput, flattenInputs, forUnit, getOrCreateSecret, mapInputs, mapOptional, mergeInputObjects, normalize, providerFactory, readResolvedPackageFileSync, resolvePackagePath, singleton, toPromise };
356
+ export { apply, flatMapInput, flattenInputs, forUnit, getOrCreateSecret, mapInputs, mapOptional, mergeInputObjects, normalize, providerFactory, singleton, toPromise };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/pulumi",
3
- "version": "0.6.2",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  "build": "pkgroll --tsconfig=tsconfig.build.json"
21
21
  },
22
22
  "dependencies": {
23
- "@highstate/contract": "^0.6.2",
23
+ "@highstate/contract": "^0.7.1",
24
24
  "@pulumi/pulumi": "^3.152.0",
25
25
  "@sinclair/typebox": "^0.34.11",
26
26
  "ajv": "^8.17.1",
@@ -30,5 +30,5 @@
30
30
  "devDependencies": {
31
31
  "pkgroll": "^2.5.1"
32
32
  },
33
- "gitHead": "dfd1d6878fc7d12954b6591d5ee1783d3c501eca"
33
+ "gitHead": "76c38ce5dbf7a710cf0e6339f52e86358537a99a"
34
34
  }