@run402/runtime-kernel 0.1.2 → 0.1.4

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/errors.js CHANGED
@@ -1,3 +1,15 @@
1
+ export class RuntimeKernelTypedError extends Error {
2
+ code;
3
+ status;
4
+ details;
5
+ constructor(code, status, message, details = {}) {
6
+ super(message);
7
+ this.code = code;
8
+ this.status = status;
9
+ this.name = "RuntimeKernelTypedError";
10
+ this.details = details;
11
+ }
12
+ }
1
13
  export class UnsupportedCapabilityError extends Error {
2
14
  code = "unsupported_capability";
3
15
  status = 422;
@@ -15,4 +27,78 @@ export function unsupportedCapabilityEnvelope(error) {
15
27
  capability: error.details.capability,
16
28
  };
17
29
  }
30
+ export class MissingRequiredSecretError extends RuntimeKernelTypedError {
31
+ constructor(secretName, functionName) {
32
+ super("missing_required_secret", 422, `Missing required secret: ${secretName}`, {
33
+ secret_name: secretName,
34
+ ...(functionName ? { function_name: functionName } : {}),
35
+ });
36
+ this.name = "MissingRequiredSecretError";
37
+ }
38
+ }
39
+ export class FunctionBundleValidationError extends RuntimeKernelTypedError {
40
+ constructor(code, message, details = {}) {
41
+ super(code, 422, message, details);
42
+ this.name = "FunctionBundleValidationError";
43
+ }
44
+ }
45
+ export class DependencyInstallRejectedError extends RuntimeKernelTypedError {
46
+ constructor(message, details = {}) {
47
+ super("dependency_install_rejected", 422, message, details);
48
+ this.name = "DependencyInstallRejectedError";
49
+ }
50
+ }
51
+ export class DependencyInstallFailedError extends RuntimeKernelTypedError {
52
+ constructor(message, details = {}) {
53
+ super("dependency_install_failed", 422, message, details);
54
+ this.name = "DependencyInstallFailedError";
55
+ }
56
+ }
57
+ export class DynamicRuntimeUnavailableError extends RuntimeKernelTypedError {
58
+ constructor(message = "Run402 Core dynamic functions runtime is not configured.", details = {}) {
59
+ super("dynamic_runtime_unavailable", 503, message, details);
60
+ this.name = "DynamicRuntimeUnavailableError";
61
+ }
62
+ }
63
+ export class DynamicRuntimeTimeoutError extends RuntimeKernelTypedError {
64
+ constructor(message = "Run402 Core dynamic runtime invocation timed out.", details = {}) {
65
+ super("dynamic_runtime_timeout", 504, message, details);
66
+ this.name = "DynamicRuntimeTimeoutError";
67
+ }
68
+ }
69
+ export class DynamicRuntimeBusyError extends RuntimeKernelTypedError {
70
+ constructor(message = "Run402 Core dynamic runtime is busy.", details = {}) {
71
+ super("dynamic_runtime_busy", 503, message, details);
72
+ this.name = "DynamicRuntimeBusyError";
73
+ }
74
+ }
75
+ export class RequestBodyTooLargeError extends RuntimeKernelTypedError {
76
+ constructor(limitBytes) {
77
+ super("request_body_too_large", 413, `Request body exceeds ${limitBytes} bytes.`, {
78
+ limit_bytes: limitBytes,
79
+ });
80
+ this.name = "RequestBodyTooLargeError";
81
+ }
82
+ }
83
+ export class ResponseBodyTooLargeError extends RuntimeKernelTypedError {
84
+ constructor(limitBytes) {
85
+ super("response_body_too_large", 502, `Function response body exceeds ${limitBytes} bytes.`, {
86
+ limit_bytes: limitBytes,
87
+ });
88
+ this.name = "ResponseBodyTooLargeError";
89
+ }
90
+ }
91
+ export class LocalExecutorError extends RuntimeKernelTypedError {
92
+ constructor(message, details = {}) {
93
+ super("local_executor_failed", 500, message, details);
94
+ this.name = "LocalExecutorError";
95
+ }
96
+ }
97
+ export function runtimeKernelErrorEnvelope(error) {
98
+ return {
99
+ error: error.code,
100
+ message: error.message,
101
+ ...(Object.keys(error.details).length > 0 ? { details: error.details } : {}),
102
+ };
103
+ }
18
104
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC1C,IAAI,GAAG,wBAAwB,CAAC;IAChC,MAAM,GAAG,GAAG,CAAC;IACb,OAAO,CAA+B;IAE/C,YAAY,UAAkB,EAAE,OAAO,GAAG,mCAAmC,UAAU,EAAE;QACvF,KAAK,CAAC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,KAAK,CAAC,IAAI;QACjB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,154 @@
1
+ import type { RoutedHttpRequestV1, RoutedHttpResponseV1 } from "@run402/functions";
2
+ import type { ContentRefHex, FunctionSpec, HttpMethod, PortableFunctionEntry, RoleGateSpec, RouteEntry } from "@run402/release";
3
+ export declare const CORE_FUNCTION_RUNTIME_MATURITY: "developer_preview";
4
+ export declare const CORE_FUNCTION_SECURITY_PROFILE: "trusted_local_code";
5
+ export declare const CORE_FUNCTION_DEFAULT_EXECUTOR: "docker_compose_worker";
6
+ export declare const CORE_FUNCTION_DEPENDENCY_MODE: "prebundled_no_external_deps";
7
+ export declare const CORE_FUNCTION_RESOURCE_DEFAULTS: {
8
+ readonly requestBodyLimitBytes: number;
9
+ readonly responseBodyLimitBytes: number;
10
+ readonly invocationTimeoutMs: 10000;
11
+ readonly startupTimeoutMs: 5000;
12
+ readonly dependencyInstallTimeoutMs: 120000;
13
+ readonly maxConcurrentInvocationsPerProject: 4;
14
+ readonly maxPendingInvocationQueue: 16;
15
+ readonly stdoutStderrLimitBytes: number;
16
+ readonly maxLogLineBytes: number;
17
+ readonly localLogRetentionBytes: number;
18
+ readonly localLogRetentionMs: number;
19
+ readonly workerMemoryLimitBytes: number;
20
+ readonly tempDirLimitBytes: number;
21
+ readonly nodeModulesLimitBytes: number;
22
+ };
23
+ export declare const CORE_FUNCTION_FILESYSTEM_LAYOUT: {
24
+ readonly bundleStagingDir: "functions/staging";
25
+ readonly activeBundleDir: "functions/active";
26
+ readonly dependencyCacheDir: "functions/deps";
27
+ readonly tempDir: "functions/tmp";
28
+ readonly logDir: "functions/logs";
29
+ };
30
+ export declare const CORE_FUNCTION_KNOWN_EXCLUSIONS: readonly ["astro_ssr", "hostile_code_isolation", "public_multi_tenant_hosting", "cloud_grade_sandbox", "external_npm_dependencies", "lockfile_npm_install", "lifecycle_scripts", "native_postinstall_builds", "file_link_workspace_dependencies", "git_or_tarball_dependencies", "private_registries", "websockets", "streaming_to_client", "scheduled_functions", "background_jobs", "managed_jobs", "managed_kms", "cloudwatch_logs", "cloud_quota_enforcement", "cloud_billing", "cloud_abuse_controls"];
31
+ export interface CoreFunctionIsolationProfile {
32
+ maturity: typeof CORE_FUNCTION_RUNTIME_MATURITY;
33
+ security_profile: typeof CORE_FUNCTION_SECURITY_PROFILE;
34
+ hostile_code_isolation: false;
35
+ default_executor: typeof CORE_FUNCTION_DEFAULT_EXECUTOR;
36
+ app_code_runs_in_gateway_process: false;
37
+ environment_policy: "explicit_allowlist";
38
+ host_environment_inherited: false;
39
+ gateway_secrets_visible_by_default: false;
40
+ filesystem_policy: "project_worker_scoped";
41
+ network_policy: "developer_preview_not_hardened";
42
+ }
43
+ export declare const CORE_FUNCTION_ISOLATION_PROFILE: CoreFunctionIsolationProfile;
44
+ export interface CoreFunctionDependencyPolicy {
45
+ mode: typeof CORE_FUNCTION_DEPENDENCY_MODE;
46
+ npm_install_supported: false;
47
+ platform_packages: ["@run402/functions"];
48
+ rejected_dependency_spec_kinds: readonly string[];
49
+ future_lockfile_install_command: readonly string[];
50
+ }
51
+ export declare const CORE_FUNCTION_DEPENDENCY_POLICY: CoreFunctionDependencyPolicy;
52
+ export interface CoreFunctionRuntimeCapability {
53
+ capability: "core-functions";
54
+ status: "supported";
55
+ maturity: typeof CORE_FUNCTION_RUNTIME_MATURITY;
56
+ security_profile: typeof CORE_FUNCTION_SECURITY_PROFILE;
57
+ hostile_code_isolation: false;
58
+ default_executor: typeof CORE_FUNCTION_DEFAULT_EXECUTOR;
59
+ dependency_policy: CoreFunctionDependencyPolicy;
60
+ resource_defaults: typeof CORE_FUNCTION_RESOURCE_DEFAULTS;
61
+ filesystem_layout: typeof CORE_FUNCTION_FILESYSTEM_LAYOUT;
62
+ supported_output: {
63
+ runtime: "node22";
64
+ artifact: "prebundled_source_ref";
65
+ envelope: "run402.routed_http.v1";
66
+ };
67
+ known_exclusions: Array<(typeof CORE_FUNCTION_KNOWN_EXCLUSIONS)[number]>;
68
+ }
69
+ export interface CoreFunctionBundleMetadata {
70
+ name: string;
71
+ runtime: "node22";
72
+ entrypoint: string;
73
+ source: ContentRefHex;
74
+ bundle_sha256: string;
75
+ bundle_size_bytes: number;
76
+ dependency_mode: typeof CORE_FUNCTION_DEPENDENCY_MODE;
77
+ dependency_lock_digest: null;
78
+ deps: [];
79
+ required_secrets: string[];
80
+ timeout_ms: number;
81
+ memory_bytes: number;
82
+ require_auth: boolean;
83
+ require_role: RoleGateSpec | null;
84
+ class: "standard";
85
+ capabilities: string[];
86
+ }
87
+ export interface CoreDynamicFunctionRoute {
88
+ pattern: string;
89
+ kind: RouteEntry["kind"];
90
+ prefix: string | null;
91
+ methods: HttpMethod[] | null;
92
+ function_name: string;
93
+ }
94
+ export interface CoreFunctionApplyEffects {
95
+ bundles: CoreFunctionBundleMetadata[];
96
+ dynamic_routes: CoreDynamicFunctionRoute[];
97
+ required_secrets: string[];
98
+ dependency_mode: typeof CORE_FUNCTION_DEPENDENCY_MODE;
99
+ noop: boolean;
100
+ }
101
+ export interface CoreFunctionInvocationInput {
102
+ projectId: string;
103
+ releaseId: string | null;
104
+ functionName: string;
105
+ invocationKind: "routed_http" | "direct";
106
+ requestId: string;
107
+ actor?: CoreFunctionActorContext | null;
108
+ request?: RoutedHttpRequestV1;
109
+ }
110
+ export interface CoreFunctionActorContext {
111
+ id: string;
112
+ role: string | null;
113
+ }
114
+ export interface CoreFunctionInvocationResult {
115
+ requestId: string;
116
+ response: RoutedHttpResponseV1;
117
+ }
118
+ export type CoreFunctionInvocationStatus = "succeeded" | "failed";
119
+ export interface CoreFunctionInvocationRecord {
120
+ request_id: string;
121
+ project_id: string;
122
+ release_id: string | null;
123
+ function_name: string;
124
+ invocation_kind: CoreFunctionInvocationInput["invocationKind"];
125
+ status: CoreFunctionInvocationStatus;
126
+ started_at: string;
127
+ finished_at: string;
128
+ duration_ms: number;
129
+ error_code: string | null;
130
+ }
131
+ export interface CoreFunctionLogEntry {
132
+ timestamp: string;
133
+ request_id: string;
134
+ project_id: string;
135
+ release_id: string | null;
136
+ function_name: string;
137
+ stream: "platform" | "stdout" | "stderr";
138
+ level: "debug" | "info" | "warn" | "error";
139
+ message: string;
140
+ redacted: boolean;
141
+ }
142
+ export interface CoreFunctionSecretMetadata {
143
+ project_id: string;
144
+ name: string;
145
+ scope: "project" | "release" | "function";
146
+ function_name: string | null;
147
+ created_at: string;
148
+ updated_at: string;
149
+ }
150
+ export declare function coreFunctionRuntimeCapability(): CoreFunctionRuntimeCapability;
151
+ export declare function emptyFunctionApplyEffects(): CoreFunctionApplyEffects;
152
+ export declare function normalizeFunctionEntrypoint(spec: FunctionSpec): string;
153
+ export declare function functionMemoryBytes(entry: Pick<PortableFunctionEntry, "memory_mb">): number;
154
+ //# sourceMappingURL=functions-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions-runtime.d.ts","sourceRoot":"","sources":["../src/functions-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACV,qBAAqB,EACrB,YAAY,EACZ,UAAU,EACX,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,8BAA8B,EAAG,mBAA4B,CAAC;AAC3E,eAAO,MAAM,8BAA8B,EAAG,oBAA6B,CAAC;AAC5E,eAAO,MAAM,8BAA8B,EAAG,uBAAgC,CAAC;AAC/E,eAAO,MAAM,6BAA6B,EAAG,6BAAsC,CAAC;AAEpF,eAAO,MAAM,+BAA+B;;;;;;;;;;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E,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC1C,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,6BAA6B,IAAI,6BAA6B,CAkB7E;AAED,wBAAgB,yBAAyB,IAAI,wBAAwB,CAQpE;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAEtE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,WAAW,CAAC,GAAG,MAAM,CAE3F"}
@@ -0,0 +1,124 @@
1
+ export const CORE_FUNCTION_RUNTIME_MATURITY = "developer_preview";
2
+ export const CORE_FUNCTION_SECURITY_PROFILE = "trusted_local_code";
3
+ export const CORE_FUNCTION_DEFAULT_EXECUTOR = "docker_compose_worker";
4
+ export const CORE_FUNCTION_DEPENDENCY_MODE = "prebundled_no_external_deps";
5
+ export const CORE_FUNCTION_RESOURCE_DEFAULTS = {
6
+ requestBodyLimitBytes: 6 * 1024 * 1024,
7
+ responseBodyLimitBytes: 6 * 1024 * 1024,
8
+ invocationTimeoutMs: 10_000,
9
+ startupTimeoutMs: 5_000,
10
+ dependencyInstallTimeoutMs: 120_000,
11
+ maxConcurrentInvocationsPerProject: 4,
12
+ maxPendingInvocationQueue: 16,
13
+ stdoutStderrLimitBytes: 64 * 1024,
14
+ maxLogLineBytes: 16 * 1024,
15
+ localLogRetentionBytes: 10 * 1024 * 1024,
16
+ localLogRetentionMs: 24 * 60 * 60 * 1000,
17
+ workerMemoryLimitBytes: 512 * 1024 * 1024,
18
+ tempDirLimitBytes: 512 * 1024 * 1024,
19
+ nodeModulesLimitBytes: 256 * 1024 * 1024,
20
+ };
21
+ export const CORE_FUNCTION_FILESYSTEM_LAYOUT = {
22
+ bundleStagingDir: "functions/staging",
23
+ activeBundleDir: "functions/active",
24
+ dependencyCacheDir: "functions/deps",
25
+ tempDir: "functions/tmp",
26
+ logDir: "functions/logs",
27
+ };
28
+ export const CORE_FUNCTION_KNOWN_EXCLUSIONS = [
29
+ "astro_ssr",
30
+ "hostile_code_isolation",
31
+ "public_multi_tenant_hosting",
32
+ "cloud_grade_sandbox",
33
+ "external_npm_dependencies",
34
+ "lockfile_npm_install",
35
+ "lifecycle_scripts",
36
+ "native_postinstall_builds",
37
+ "file_link_workspace_dependencies",
38
+ "git_or_tarball_dependencies",
39
+ "private_registries",
40
+ "websockets",
41
+ "streaming_to_client",
42
+ "scheduled_functions",
43
+ "background_jobs",
44
+ "managed_jobs",
45
+ "managed_kms",
46
+ "cloudwatch_logs",
47
+ "cloud_quota_enforcement",
48
+ "cloud_billing",
49
+ "cloud_abuse_controls",
50
+ ];
51
+ export const CORE_FUNCTION_ISOLATION_PROFILE = {
52
+ maturity: CORE_FUNCTION_RUNTIME_MATURITY,
53
+ security_profile: CORE_FUNCTION_SECURITY_PROFILE,
54
+ hostile_code_isolation: false,
55
+ default_executor: CORE_FUNCTION_DEFAULT_EXECUTOR,
56
+ app_code_runs_in_gateway_process: false,
57
+ environment_policy: "explicit_allowlist",
58
+ host_environment_inherited: false,
59
+ gateway_secrets_visible_by_default: false,
60
+ filesystem_policy: "project_worker_scoped",
61
+ network_policy: "developer_preview_not_hardened",
62
+ };
63
+ export const CORE_FUNCTION_DEPENDENCY_POLICY = {
64
+ mode: CORE_FUNCTION_DEPENDENCY_MODE,
65
+ npm_install_supported: false,
66
+ platform_packages: ["@run402/functions"],
67
+ rejected_dependency_spec_kinds: [
68
+ "semver_without_lockfile",
69
+ "file",
70
+ "link",
71
+ "workspace",
72
+ "git",
73
+ "http_tarball",
74
+ "https_tarball",
75
+ "local_path",
76
+ "private_registry",
77
+ "npm_alias",
78
+ "lifecycle_script_required",
79
+ "native_postinstall_required",
80
+ ],
81
+ future_lockfile_install_command: [
82
+ "npm",
83
+ "ci",
84
+ "--ignore-scripts",
85
+ "--omit=dev",
86
+ "--no-audit",
87
+ "--no-fund",
88
+ ],
89
+ };
90
+ export function coreFunctionRuntimeCapability() {
91
+ return {
92
+ capability: "core-functions",
93
+ status: "supported",
94
+ maturity: CORE_FUNCTION_RUNTIME_MATURITY,
95
+ security_profile: CORE_FUNCTION_SECURITY_PROFILE,
96
+ hostile_code_isolation: false,
97
+ default_executor: CORE_FUNCTION_DEFAULT_EXECUTOR,
98
+ dependency_policy: CORE_FUNCTION_DEPENDENCY_POLICY,
99
+ resource_defaults: CORE_FUNCTION_RESOURCE_DEFAULTS,
100
+ filesystem_layout: CORE_FUNCTION_FILESYSTEM_LAYOUT,
101
+ supported_output: {
102
+ runtime: "node22",
103
+ artifact: "prebundled_source_ref",
104
+ envelope: "run402.routed_http.v1",
105
+ },
106
+ known_exclusions: [...CORE_FUNCTION_KNOWN_EXCLUSIONS],
107
+ };
108
+ }
109
+ export function emptyFunctionApplyEffects() {
110
+ return {
111
+ bundles: [],
112
+ dynamic_routes: [],
113
+ required_secrets: [],
114
+ dependency_mode: CORE_FUNCTION_DEPENDENCY_MODE,
115
+ noop: true,
116
+ };
117
+ }
118
+ export function normalizeFunctionEntrypoint(spec) {
119
+ return spec.entrypoint ?? "default";
120
+ }
121
+ export function functionMemoryBytes(entry) {
122
+ return entry.memory_mb * 1024 * 1024;
123
+ }
124
+ //# sourceMappingURL=functions-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions-runtime.js","sourceRoot":"","sources":["../src/functions-runtime.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,8BAA8B,GAAG,mBAA4B,CAAC;AAC3E,MAAM,CAAC,MAAM,8BAA8B,GAAG,oBAA6B,CAAC;AAC5E,MAAM,CAAC,MAAM,8BAA8B,GAAG,uBAAgC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;IACvC,OAAO;QACL,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE;QAClB,gBAAgB,EAAE,EAAE;QACpB,eAAe,EAAE,6BAA6B;QAC9C,IAAI,EAAE,IAAI;KACX,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,IAAkB;IAC5D,OAAO,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAA+C;IACjF,OAAO,KAAK,CAAC,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;AACvC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export * from "./apply.js";
2
2
  export * from "./capabilities.js";
3
3
  export * from "./errors.js";
4
+ export * from "./functions-runtime.js";
4
5
  export * from "./health.js";
5
6
  export * from "./ports.js";
6
7
  export * from "./projects.js";
8
+ export * from "./storage.js";
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  export * from "./apply.js";
2
2
  export * from "./capabilities.js";
3
3
  export * from "./errors.js";
4
+ export * from "./functions-runtime.js";
4
5
  export * from "./health.js";
5
6
  export * from "./ports.js";
6
7
  export * from "./projects.js";
8
+ export * from "./storage.js";
7
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}