@semiont/core 0.2.2-build.11 → 0.2.2
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 +1367 -27
- package/dist/index.js +1455 -78
- package/dist/index.js.map +1 -1
- package/package.json +18 -8
- package/dist/annotation-history-utils.d.ts +0 -42
- package/dist/annotation-history-utils.d.ts.map +0 -1
- package/dist/annotation-history-utils.js +0 -258
- package/dist/annotation-history-utils.js.map +0 -1
- package/dist/annotation-types.d.ts +0 -15
- package/dist/annotation-types.d.ts.map +0 -1
- package/dist/annotation-types.js +0 -6
- package/dist/annotation-types.js.map +0 -1
- package/dist/annotation-utils.d.ts +0 -18
- package/dist/annotation-utils.d.ts.map +0 -1
- package/dist/annotation-utils.js +0 -70
- package/dist/annotation-utils.js.map +0 -1
- package/dist/auth-types.d.ts +0 -8
- package/dist/auth-types.d.ts.map +0 -1
- package/dist/auth-types.js +0 -6
- package/dist/auth-types.js.map +0 -1
- package/dist/config/config-validator.d.ts +0 -25
- package/dist/config/config-validator.d.ts.map +0 -1
- package/dist/config/config-validator.js +0 -112
- package/dist/config/config-validator.js.map +0 -1
- package/dist/config/config.schema.json +0 -678
- package/dist/config/config.types.d.ts +0 -574
- package/dist/config/config.types.d.ts.map +0 -1
- package/dist/config/config.types.js +0 -4
- package/dist/config/config.types.js.map +0 -1
- package/dist/config/configuration-error.d.ts +0 -17
- package/dist/config/configuration-error.d.ts.map +0 -1
- package/dist/config/configuration-error.js +0 -36
- package/dist/config/configuration-error.js.map +0 -1
- package/dist/config/environment-loader.d.ts +0 -98
- package/dist/config/environment-loader.d.ts.map +0 -1
- package/dist/config/environment-loader.js +0 -229
- package/dist/config/environment-loader.js.map +0 -1
- package/dist/config/environment-validator.d.ts +0 -22
- package/dist/config/environment-validator.d.ts.map +0 -1
- package/dist/config/environment-validator.js +0 -50
- package/dist/config/environment-validator.js.map +0 -1
- package/dist/config/platform-types.d.ts +0 -26
- package/dist/config/platform-types.d.ts.map +0 -1
- package/dist/config/platform-types.js +0 -28
- package/dist/config/platform-types.js.map +0 -1
- package/dist/config/project-discovery.d.ts +0 -35
- package/dist/config/project-discovery.d.ts.map +0 -1
- package/dist/config/project-discovery.js +0 -99
- package/dist/config/project-discovery.js.map +0 -1
- package/dist/creation-methods.d.ts +0 -19
- package/dist/creation-methods.d.ts.map +0 -1
- package/dist/creation-methods.js +0 -18
- package/dist/creation-methods.js.map +0 -1
- package/dist/crypto.d.ts +0 -32
- package/dist/crypto.d.ts.map +0 -1
- package/dist/crypto.js +0 -52
- package/dist/crypto.js.map +0 -1
- package/dist/did-utils.d.ts +0 -51
- package/dist/did-utils.d.ts.map +0 -1
- package/dist/did-utils.js +0 -62
- package/dist/did-utils.js.map +0 -1
- package/dist/errors.d.ts +0 -51
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -89
- package/dist/errors.js.map +0 -1
- package/dist/events.d.ts +0 -223
- package/dist/events.d.ts.map +0 -1
- package/dist/events.js +0 -45
- package/dist/events.js.map +0 -1
- package/dist/graph.d.ts +0 -31
- package/dist/graph.d.ts.map +0 -1
- package/dist/graph.js +0 -6
- package/dist/graph.js.map +0 -1
- package/dist/http-client.d.ts +0 -32
- package/dist/http-client.d.ts.map +0 -1
- package/dist/http-client.js +0 -56
- package/dist/http-client.js.map +0 -1
- package/dist/identifiers.d.ts +0 -24
- package/dist/identifiers.d.ts.map +0 -1
- package/dist/identifiers.js +0 -40
- package/dist/identifiers.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/resource-types.d.ts +0 -15
- package/dist/resource-types.d.ts.map +0 -1
- package/dist/resource-types.js +0 -6
- package/dist/resource-types.js.map +0 -1
- package/dist/type-guards.d.ts +0 -44
- package/dist/type-guards.d.ts.map +0 -1
- package/dist/type-guards.js +0 -76
- package/dist/type-guards.js.map +0 -1
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Environment Loader Module
|
|
3
|
-
*
|
|
4
|
-
* Responsible for loading and merging environment configurations.
|
|
5
|
-
* Handles semiont.json base config and environment-specific overrides.
|
|
6
|
-
*/
|
|
7
|
-
import { PlatformType } from './platform-types';
|
|
8
|
-
import type { EnvironmentConfig, SiteConfig, AppConfig, SemiontConfig, ServicesConfig, BackendServiceConfig, FrontendServiceConfig, DatabaseServiceConfig, GraphServiceConfig, FilesystemServiceConfig, InferenceServiceConfig, ServicePlatformConfig } from './config.types.js';
|
|
9
|
-
/**
|
|
10
|
-
* Re-export generated types from JSON Schema
|
|
11
|
-
* These types are automatically generated from config.schema.json
|
|
12
|
-
*/
|
|
13
|
-
export type { EnvironmentConfig, SiteConfig, AppConfig, SemiontConfig, PlatformType, ServicesConfig, BackendServiceConfig, FrontendServiceConfig, DatabaseServiceConfig, GraphServiceConfig, FilesystemServiceConfig, InferenceServiceConfig, ServicePlatformConfig };
|
|
14
|
-
/**
|
|
15
|
-
* Generic service configuration
|
|
16
|
-
* Platform-specific fields should be accessed through platform-specific interfaces
|
|
17
|
-
*/
|
|
18
|
-
export interface ServiceConfig {
|
|
19
|
-
platform?: {
|
|
20
|
-
type: PlatformType;
|
|
21
|
-
};
|
|
22
|
-
port?: number;
|
|
23
|
-
name?: string;
|
|
24
|
-
[key: string]: any;
|
|
25
|
-
}
|
|
26
|
-
export interface AWSConfig {
|
|
27
|
-
region: string;
|
|
28
|
-
accountId: string;
|
|
29
|
-
certificateArn?: string;
|
|
30
|
-
hostedZoneId?: string;
|
|
31
|
-
rootDomain?: string;
|
|
32
|
-
stacks?: {
|
|
33
|
-
data?: string;
|
|
34
|
-
app?: string;
|
|
35
|
-
};
|
|
36
|
-
database?: {
|
|
37
|
-
name?: string;
|
|
38
|
-
instanceClass?: string;
|
|
39
|
-
allocatedStorage?: number;
|
|
40
|
-
backupRetentionDays?: number;
|
|
41
|
-
multiAZ?: boolean;
|
|
42
|
-
};
|
|
43
|
-
ecs?: {
|
|
44
|
-
desiredCount?: number;
|
|
45
|
-
minCapacity?: number;
|
|
46
|
-
maxCapacity?: number;
|
|
47
|
-
};
|
|
48
|
-
monitoring?: {
|
|
49
|
-
enableDetailedMonitoring?: boolean;
|
|
50
|
-
logRetentionDays?: number;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Load environment configuration
|
|
55
|
-
* Merges semiont.json with environment-specific config
|
|
56
|
-
*
|
|
57
|
-
* @param projectRoot - Absolute path to project directory containing semiont.json
|
|
58
|
-
* @param environment - Environment name (must match a file in environments/)
|
|
59
|
-
* @returns Merged environment configuration
|
|
60
|
-
* @throws ConfigurationError if files are missing or invalid
|
|
61
|
-
*/
|
|
62
|
-
export declare function loadEnvironmentConfig(projectRoot: string, environment: string): EnvironmentConfig;
|
|
63
|
-
/**
|
|
64
|
-
* Get NODE_ENV value from environment config
|
|
65
|
-
*
|
|
66
|
-
* @param config - Environment configuration
|
|
67
|
-
* @returns NODE_ENV value (defaults to 'development' if not specified)
|
|
68
|
-
*/
|
|
69
|
-
export declare function getNodeEnvForEnvironment(config: EnvironmentConfig): 'development' | 'production' | 'test';
|
|
70
|
-
/**
|
|
71
|
-
* Get available environments by scanning environments directory
|
|
72
|
-
*
|
|
73
|
-
* @returns Array of environment names
|
|
74
|
-
*/
|
|
75
|
-
export declare function getAvailableEnvironments(): string[];
|
|
76
|
-
/**
|
|
77
|
-
* Check if an environment exists
|
|
78
|
-
*
|
|
79
|
-
* @param environment - Environment name to check
|
|
80
|
-
* @returns True if environment exists
|
|
81
|
-
*/
|
|
82
|
-
export declare function isValidEnvironment(environment: string): boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Type guard to check if config has AWS settings
|
|
85
|
-
*
|
|
86
|
-
* @param config - Environment configuration
|
|
87
|
-
* @returns True if AWS configuration is present
|
|
88
|
-
*/
|
|
89
|
-
export declare function hasAWSConfig(config: EnvironmentConfig): config is EnvironmentConfig & {
|
|
90
|
-
aws: AWSConfig;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Display configuration for debugging
|
|
94
|
-
*
|
|
95
|
-
* @param config - Configuration to display
|
|
96
|
-
*/
|
|
97
|
-
export declare function displayConfiguration(config: EnvironmentConfig): void;
|
|
98
|
-
//# sourceMappingURL=environment-loader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"environment-loader.d.ts","sourceRoot":"","sources":["../../src/config/environment-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAE3B;;;GAGG;AACH,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,aAAa,EACb,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACtB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,YAAY,CAAC;KACpB,CAAC;IAEF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,G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ment configurations.
|
|
6
|
-
* Handles semiont.json base config and environment-specific overrides.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.loadEnvironmentConfig = loadEnvironmentConfig;
|
|
43
|
-
exports.getNodeEnvForEnvironment = getNodeEnvForEnvironment;
|
|
44
|
-
exports.getAvailableEnvironments = getAvailableEnvironments;
|
|
45
|
-
exports.isValidEnvironment = isValidEnvironment;
|
|
46
|
-
exports.hasAWSConfig = hasAWSConfig;
|
|
47
|
-
exports.displayConfiguration = displayConfiguration;
|
|
48
|
-
const fs = __importStar(require("fs"));
|
|
49
|
-
const path = __importStar(require("path"));
|
|
50
|
-
const configuration_error_1 = require("./configuration-error");
|
|
51
|
-
const project_discovery_1 = require("./project-discovery");
|
|
52
|
-
const index_1 = require("../index");
|
|
53
|
-
const config_validator_js_1 = require("./config-validator.js");
|
|
54
|
-
/**
|
|
55
|
-
* Deep merge utility for configuration objects
|
|
56
|
-
*/
|
|
57
|
-
function deepMerge(target, ...sources) {
|
|
58
|
-
if (!sources.length)
|
|
59
|
-
return target;
|
|
60
|
-
const source = sources.shift();
|
|
61
|
-
if ((0, index_1.isObject)(target) && (0, index_1.isObject)(source)) {
|
|
62
|
-
for (const key in source) {
|
|
63
|
-
if ((0, index_1.isObject)(source[key])) {
|
|
64
|
-
if (!target[key])
|
|
65
|
-
Object.assign(target, { [key]: {} });
|
|
66
|
-
deepMerge(target[key], source[key]);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
Object.assign(target, { [key]: source[key] });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return deepMerge(target, ...sources);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Recursively resolve environment variable placeholders in configuration
|
|
77
|
-
* Replaces ${VAR_NAME} with the value from process.env
|
|
78
|
-
*
|
|
79
|
-
* @param obj - Configuration object to process
|
|
80
|
-
* @returns Configuration with resolved environment variables
|
|
81
|
-
*/
|
|
82
|
-
function resolveEnvVars(obj) {
|
|
83
|
-
if (typeof obj === 'string') {
|
|
84
|
-
// Replace ${VAR_NAME} with actual environment variable value
|
|
85
|
-
return obj.replace(/\$\{([^}]+)\}/g, (match, varName) => {
|
|
86
|
-
return process.env[varName] || match;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
if (Array.isArray(obj)) {
|
|
90
|
-
return obj.map(item => resolveEnvVars(item));
|
|
91
|
-
}
|
|
92
|
-
if (obj && typeof obj === 'object') {
|
|
93
|
-
const resolved = {};
|
|
94
|
-
for (const key in obj) {
|
|
95
|
-
resolved[key] = resolveEnvVars(obj[key]);
|
|
96
|
-
}
|
|
97
|
-
return resolved;
|
|
98
|
-
}
|
|
99
|
-
return obj;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Load environment configuration
|
|
103
|
-
* Merges semiont.json with environment-specific config
|
|
104
|
-
*
|
|
105
|
-
* @param projectRoot - Absolute path to project directory containing semiont.json
|
|
106
|
-
* @param environment - Environment name (must match a file in environments/)
|
|
107
|
-
* @returns Merged environment configuration
|
|
108
|
-
* @throws ConfigurationError if files are missing or invalid
|
|
109
|
-
*/
|
|
110
|
-
function loadEnvironmentConfig(projectRoot, environment) {
|
|
111
|
-
try {
|
|
112
|
-
// Load base semiont.json
|
|
113
|
-
const baseConfigPath = path.join(projectRoot, 'semiont.json');
|
|
114
|
-
let baseConfig = {};
|
|
115
|
-
if (fs.existsSync(baseConfigPath)) {
|
|
116
|
-
const baseContent = fs.readFileSync(baseConfigPath, 'utf-8');
|
|
117
|
-
baseConfig = JSON.parse(baseContent);
|
|
118
|
-
}
|
|
119
|
-
// Load environment-specific config
|
|
120
|
-
const envPath = path.join(projectRoot, 'environments', `${environment}.json`);
|
|
121
|
-
if (!fs.existsSync(envPath)) {
|
|
122
|
-
throw new configuration_error_1.ConfigurationError(`Environment configuration missing: ${envPath}`, environment, `Create the configuration file or use: semiont init`);
|
|
123
|
-
}
|
|
124
|
-
const envContent = fs.readFileSync(envPath, 'utf-8');
|
|
125
|
-
const envConfig = JSON.parse(envContent);
|
|
126
|
-
// Merge configurations: base defaults -> environment config
|
|
127
|
-
const merged = deepMerge({}, { site: baseConfig.site }, // Site config from semiont.json
|
|
128
|
-
baseConfig.defaults || {}, // Default config from semiont.json
|
|
129
|
-
envConfig // Environment-specific overrides
|
|
130
|
-
);
|
|
131
|
-
// Resolve environment variables in the merged configuration
|
|
132
|
-
const resolved = resolveEnvVars(merged);
|
|
133
|
-
// Ensure services exists (even if empty)
|
|
134
|
-
if (!resolved.services) {
|
|
135
|
-
resolved.services = {};
|
|
136
|
-
}
|
|
137
|
-
// Validate NODE_ENV if specified
|
|
138
|
-
if (resolved.env?.NODE_ENV) {
|
|
139
|
-
const validNodeEnv = ['development', 'production', 'test'];
|
|
140
|
-
if (!validNodeEnv.includes(resolved.env.NODE_ENV)) {
|
|
141
|
-
throw new configuration_error_1.ConfigurationError(`Invalid NODE_ENV value: ${resolved.env.NODE_ENV}`, environment, `NODE_ENV must be one of: ${validNodeEnv.join(', ')}`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
// Add metadata about where this config came from
|
|
145
|
-
const configWithMetadata = {
|
|
146
|
-
...resolved,
|
|
147
|
-
_metadata: {
|
|
148
|
-
environment,
|
|
149
|
-
projectRoot
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
// Validate with AJV
|
|
153
|
-
const validationResult = (0, config_validator_js_1.validateEnvironmentConfig)(configWithMetadata);
|
|
154
|
-
if (!validationResult.valid) {
|
|
155
|
-
throw new configuration_error_1.ConfigurationError(`Invalid environment configuration: ${validationResult.errorMessage}`, environment, `Fix the validation errors in your environments/${environment}.json file`);
|
|
156
|
-
}
|
|
157
|
-
return configWithMetadata;
|
|
158
|
-
}
|
|
159
|
-
catch (error) {
|
|
160
|
-
if (error instanceof configuration_error_1.ConfigurationError) {
|
|
161
|
-
throw error; // Re-throw our custom errors
|
|
162
|
-
}
|
|
163
|
-
if (error instanceof SyntaxError && error.message.includes('JSON')) {
|
|
164
|
-
throw new configuration_error_1.ConfigurationError(`Invalid JSON syntax in configuration file`, environment, `Check for missing commas, quotes, or brackets. Use a JSON validator to verify syntax.`);
|
|
165
|
-
}
|
|
166
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
167
|
-
throw new configuration_error_1.ConfigurationError(`Failed to load environment configuration: ${message}`, environment, `Check the configuration files exist and are valid JSON`);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Get NODE_ENV value from environment config
|
|
172
|
-
*
|
|
173
|
-
* @param config - Environment configuration
|
|
174
|
-
* @returns NODE_ENV value (defaults to 'development' if not specified)
|
|
175
|
-
*/
|
|
176
|
-
function getNodeEnvForEnvironment(config) {
|
|
177
|
-
const nodeEnv = config.env?.NODE_ENV;
|
|
178
|
-
// Default to 'development' if not specified
|
|
179
|
-
return nodeEnv || 'development';
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Get available environments by scanning environments directory
|
|
183
|
-
*
|
|
184
|
-
* @returns Array of environment names
|
|
185
|
-
*/
|
|
186
|
-
function getAvailableEnvironments() {
|
|
187
|
-
try {
|
|
188
|
-
const projectRoot = (0, project_discovery_1.findProjectRoot)();
|
|
189
|
-
const configDir = path.join(projectRoot, 'environments');
|
|
190
|
-
if (!fs.existsSync(configDir)) {
|
|
191
|
-
return [];
|
|
192
|
-
}
|
|
193
|
-
return fs.readdirSync(configDir)
|
|
194
|
-
.filter(file => file.endsWith('.json'))
|
|
195
|
-
.map(file => path.basename(file, '.json'))
|
|
196
|
-
.sort();
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
return [];
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Check if an environment exists
|
|
204
|
-
*
|
|
205
|
-
* @param environment - Environment name to check
|
|
206
|
-
* @returns True if environment exists
|
|
207
|
-
*/
|
|
208
|
-
function isValidEnvironment(environment) {
|
|
209
|
-
return getAvailableEnvironments().includes(environment);
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Type guard to check if config has AWS settings
|
|
213
|
-
*
|
|
214
|
-
* @param config - Environment configuration
|
|
215
|
-
* @returns True if AWS configuration is present
|
|
216
|
-
*/
|
|
217
|
-
function hasAWSConfig(config) {
|
|
218
|
-
return !!config.aws && !!config.aws.region;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Display configuration for debugging
|
|
222
|
-
*
|
|
223
|
-
* @param config - Configuration to display
|
|
224
|
-
*/
|
|
225
|
-
function displayConfiguration(config) {
|
|
226
|
-
console.log('Environment Configuration:');
|
|
227
|
-
console.log(JSON.stringify(config, null, 2));
|
|
228
|
-
}
|
|
229
|
-
//# sourceMappingURL=environment-loader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"environment-loader.js","sourceRoot":"","sources":["../../src/config/environment-loader.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqJH,sDA6FC;AAQD,4DAKC;AAOD,4DAgBC;AAQD,gDAEC;AAQD,oCAEC;AAOD,oDAGC;AAlTD,uCAAyB;AACzB,2CAA6B;AAC7B,+DAA2D;AAC3D,2DAAsD;AAEtD,oCAAoC;AACpC,+DAAkE;AAgFlE;;GAEG;AACH,SAAS,SAAS,CAAC,MAAW,EAAE,GAAG,OAAc;IAC/C,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IACnC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAE/B,IAAI,IAAA,gBAAQ,EAAC,MAAM,CAAC,IAAI,IAAA,gBAAQ,EAAC,MAAM,CAAC,EAAE,CAAC;QACzC,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;YACzB,IAAI,IAAA,gBAAQ,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;oBAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gB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G,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Environment validation utilities
|
|
3
|
-
*/
|
|
4
|
-
export type Environment = string;
|
|
5
|
-
/**
|
|
6
|
-
* Type guard to check if a string is a valid Environment
|
|
7
|
-
*/
|
|
8
|
-
export declare function isValidEnvironment(value: string | undefined): value is Environment;
|
|
9
|
-
/**
|
|
10
|
-
* Parse environment string to Environment type
|
|
11
|
-
* @param value - The environment string to parse
|
|
12
|
-
* @returns Valid Environment type
|
|
13
|
-
* @throws Error if environment is invalid or not provided
|
|
14
|
-
*/
|
|
15
|
-
export declare function parseEnvironment(value: string | undefined): Environment;
|
|
16
|
-
/**
|
|
17
|
-
* Validate and return environment or throw error
|
|
18
|
-
* @param value - The environment string to validate
|
|
19
|
-
* @throws Error if environment is invalid
|
|
20
|
-
*/
|
|
21
|
-
export declare function validateEnvironment(value: string | undefined): Environment;
|
|
22
|
-
//# sourceMappingURL=environment-validator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"environment-validator.d.ts","sourceRoot":"","sources":["../../src/config/environment-validator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,IAAI,WAAW,CAIlF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,CASvE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,CAS1E"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Environment validation utilities
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isValidEnvironment = isValidEnvironment;
|
|
7
|
-
exports.parseEnvironment = parseEnvironment;
|
|
8
|
-
exports.validateEnvironment = validateEnvironment;
|
|
9
|
-
const environment_loader_1 = require("./environment-loader");
|
|
10
|
-
/**
|
|
11
|
-
* Type guard to check if a string is a valid Environment
|
|
12
|
-
*/
|
|
13
|
-
function isValidEnvironment(value) {
|
|
14
|
-
if (!value)
|
|
15
|
-
return false;
|
|
16
|
-
// Use dynamic check from filesystem to support custom environments like 'production'
|
|
17
|
-
return (0, environment_loader_1.getAvailableEnvironments)().includes(value);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Parse environment string to Environment type
|
|
21
|
-
* @param value - The environment string to parse
|
|
22
|
-
* @returns Valid Environment type
|
|
23
|
-
* @throws Error if environment is invalid or not provided
|
|
24
|
-
*/
|
|
25
|
-
function parseEnvironment(value) {
|
|
26
|
-
if (!value) {
|
|
27
|
-
throw new Error('Environment is required');
|
|
28
|
-
}
|
|
29
|
-
if (!isValidEnvironment(value)) {
|
|
30
|
-
const availableEnvs = (0, environment_loader_1.getAvailableEnvironments)();
|
|
31
|
-
throw new Error(`Invalid environment: ${value}. Available environments: ${availableEnvs.join(', ')}`);
|
|
32
|
-
}
|
|
33
|
-
return value;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Validate and return environment or throw error
|
|
37
|
-
* @param value - The environment string to validate
|
|
38
|
-
* @throws Error if environment is invalid
|
|
39
|
-
*/
|
|
40
|
-
function validateEnvironment(value) {
|
|
41
|
-
if (!value) {
|
|
42
|
-
throw new Error('Environment is required');
|
|
43
|
-
}
|
|
44
|
-
if (!isValidEnvironment(value)) {
|
|
45
|
-
const availableEnvs = (0, environment_loader_1.getAvailableEnvironments)();
|
|
46
|
-
throw new Error(`Invalid environment: ${value}. Available environments: ${availableEnvs.join(', ')}`);
|
|
47
|
-
}
|
|
48
|
-
return value;
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=environment-validator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"environment-validator.js","sourceRoot":"","sources":["../../src/config/environment-validator.ts"],"names":[],"mappings":";AAAA;;GAEG;;AASH,gDAIC;AAQD,4CASC;AAOD,kDASC;AA5CD,6DAAgE;AAIhE;;GAEG;AACH,SAAgB,kBAAkB,CAAC,KAAyB;IAC1D,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,qFAAqF;IACrF,OAAO,IAAA,6CAAwB,GAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,KAAyB;IACxD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,aAAa,GAAG,IAAA,6CAAwB,GAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,wBAAwB,KAAK,6BAA6B,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,KAAyB;IAC3D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,aAAa,GAAG,IAAA,6CAAwB,GAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,wBAAwB,KAAK,6BAA6B,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Platform Types Module
|
|
3
|
-
*
|
|
4
|
-
* Re-exports PlatformType from schema-generated types.
|
|
5
|
-
* Platforms represent WHERE services run (infrastructure targets).
|
|
6
|
-
*/
|
|
7
|
-
import { PlatformType as SchemaPlatformType } from './config.types.js';
|
|
8
|
-
/**
|
|
9
|
-
* Platform type literals from JSON Schema
|
|
10
|
-
* These represent the infrastructure targets where services can be deployed
|
|
11
|
-
*/
|
|
12
|
-
export type PlatformType = SchemaPlatformType;
|
|
13
|
-
/**
|
|
14
|
-
* Type guard to check if a string is a valid platform type
|
|
15
|
-
*
|
|
16
|
-
* @param value - Value to check
|
|
17
|
-
* @returns True if value is a valid PlatformType
|
|
18
|
-
*/
|
|
19
|
-
export declare function isValidPlatformType(value: string): value is PlatformType;
|
|
20
|
-
/**
|
|
21
|
-
* Get all valid platform types
|
|
22
|
-
*
|
|
23
|
-
* @returns Array of all platform types
|
|
24
|
-
*/
|
|
25
|
-
export declare function getAllPlatformTypes(): PlatformType[];
|
|
26
|
-
//# sourceMappingURL=platform-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platform-types.d.ts","sourceRoot":"","sources":["../../src/config/platform-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvE;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAE9C;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,YAAY,CAExE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,EAAE,CAEpD"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Platform Types Module
|
|
4
|
-
*
|
|
5
|
-
* Re-exports PlatformType from schema-generated types.
|
|
6
|
-
* Platforms represent WHERE services run (infrastructure targets).
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.isValidPlatformType = isValidPlatformType;
|
|
10
|
-
exports.getAllPlatformTypes = getAllPlatformTypes;
|
|
11
|
-
/**
|
|
12
|
-
* Type guard to check if a string is a valid platform type
|
|
13
|
-
*
|
|
14
|
-
* @param value - Value to check
|
|
15
|
-
* @returns True if value is a valid PlatformType
|
|
16
|
-
*/
|
|
17
|
-
function isValidPlatformType(value) {
|
|
18
|
-
return ['aws', 'container', 'posix', 'external'].includes(value);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Get all valid platform types
|
|
22
|
-
*
|
|
23
|
-
* @returns Array of all platform types
|
|
24
|
-
*/
|
|
25
|
-
function getAllPlatformTypes() {
|
|
26
|
-
return ['aws', 'container', 'posix', 'external'];
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=platform-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platform-types.js","sourceRoot":"","sources":["../../src/config/platform-types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAgBH,kDAEC;AAOD,kDAEC;AAjBD;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,KAAa;IAC/C,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB;IACjC,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project Discovery Module
|
|
3
|
-
*
|
|
4
|
-
* Responsible for finding the Semiont project root directory.
|
|
5
|
-
* Looks for semiont.json or environments directory to identify a valid project.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Find project root - returns SEMIONT_ROOT environment variable
|
|
9
|
-
*
|
|
10
|
-
* @returns The absolute path to the project root
|
|
11
|
-
* @throws ConfigurationError if SEMIONT_ROOT is not set or invalid
|
|
12
|
-
*/
|
|
13
|
-
export declare function findProjectRoot(): string;
|
|
14
|
-
/**
|
|
15
|
-
* Check if a path looks like a Semiont project root
|
|
16
|
-
*
|
|
17
|
-
* @param projectPath - Path to check
|
|
18
|
-
* @returns True if path contains semiont.json or environments directory
|
|
19
|
-
*/
|
|
20
|
-
export declare function isProjectRoot(projectPath: string): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Get the path to the environments directory
|
|
23
|
-
*
|
|
24
|
-
* @param projectRoot - Project root directory (optional, will find if not provided)
|
|
25
|
-
* @returns Path to environments directory
|
|
26
|
-
*/
|
|
27
|
-
export declare function getEnvironmentsPath(projectRoot?: string): string;
|
|
28
|
-
/**
|
|
29
|
-
* Get the path to semiont.json
|
|
30
|
-
*
|
|
31
|
-
* @param projectRoot - Project root directory (optional, will find if not provided)
|
|
32
|
-
* @returns Path to semiont.json
|
|
33
|
-
*/
|
|
34
|
-
export declare function getSemiontConfigPath(projectRoot?: string): string;
|
|
35
|
-
//# sourceMappingURL=project-discovery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-discovery.d.ts","sourceRoot":"","sources":["../../src/config/project-discovery.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,MAAM,CA6BxC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAGjE"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Project Discovery Module
|
|
4
|
-
*
|
|
5
|
-
* Responsible for finding the Semiont project root directory.
|
|
6
|
-
* Looks for semiont.json or environments directory to identify a valid project.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.findProjectRoot = findProjectRoot;
|
|
43
|
-
exports.isProjectRoot = isProjectRoot;
|
|
44
|
-
exports.getEnvironmentsPath = getEnvironmentsPath;
|
|
45
|
-
exports.getSemiontConfigPath = getSemiontConfigPath;
|
|
46
|
-
const fs = __importStar(require("fs"));
|
|
47
|
-
const path = __importStar(require("path"));
|
|
48
|
-
const configuration_error_1 = require("./configuration-error");
|
|
49
|
-
/**
|
|
50
|
-
* Find project root - returns SEMIONT_ROOT environment variable
|
|
51
|
-
*
|
|
52
|
-
* @returns The absolute path to the project root
|
|
53
|
-
* @throws ConfigurationError if SEMIONT_ROOT is not set or invalid
|
|
54
|
-
*/
|
|
55
|
-
function findProjectRoot() {
|
|
56
|
-
const root = process.env.SEMIONT_ROOT;
|
|
57
|
-
if (!root) {
|
|
58
|
-
throw new configuration_error_1.ConfigurationError('SEMIONT_ROOT environment variable is not set', undefined, 'Set SEMIONT_ROOT to your project directory, or use the semiont CLI which sets it automatically');
|
|
59
|
-
}
|
|
60
|
-
if (!fs.existsSync(root)) {
|
|
61
|
-
throw new configuration_error_1.ConfigurationError(`SEMIONT_ROOT points to non-existent directory: ${root}`, undefined, 'Check that SEMIONT_ROOT environment variable is set correctly');
|
|
62
|
-
}
|
|
63
|
-
// Verify it's a valid project root
|
|
64
|
-
if (!isProjectRoot(root)) {
|
|
65
|
-
throw new configuration_error_1.ConfigurationError(`SEMIONT_ROOT does not point to a valid Semiont project: ${root}`, undefined, 'Ensure SEMIONT_ROOT points to a directory containing semiont.json or environments/');
|
|
66
|
-
}
|
|
67
|
-
return root;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Check if a path looks like a Semiont project root
|
|
71
|
-
*
|
|
72
|
-
* @param projectPath - Path to check
|
|
73
|
-
* @returns True if path contains semiont.json or environments directory
|
|
74
|
-
*/
|
|
75
|
-
function isProjectRoot(projectPath) {
|
|
76
|
-
return fs.existsSync(path.join(projectPath, 'semiont.json')) ||
|
|
77
|
-
fs.existsSync(path.join(projectPath, 'environments'));
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Get the path to the environments directory
|
|
81
|
-
*
|
|
82
|
-
* @param projectRoot - Project root directory (optional, will find if not provided)
|
|
83
|
-
* @returns Path to environments directory
|
|
84
|
-
*/
|
|
85
|
-
function getEnvironmentsPath(projectRoot) {
|
|
86
|
-
const root = projectRoot || findProjectRoot();
|
|
87
|
-
return path.join(root, 'environments');
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Get the path to semiont.json
|
|
91
|
-
*
|
|
92
|
-
* @param projectRoot - Project root directory (optional, will find if not provided)
|
|
93
|
-
* @returns Path to semiont.json
|
|
94
|
-
*/
|
|
95
|
-
function getSemiontConfigPath(projectRoot) {
|
|
96
|
-
const root = projectRoot || findProjectRoot();
|
|
97
|
-
return path.join(root, 'semiont.json');
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=project-discovery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-discovery.js","sourceRoot":"","sources":["../../src/config/project-discovery.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYH,0CA6BC;AAQD,sCAGC;AAQD,kDAGC;AAQD,oDAGC;AAxED,uCAAyB;AACzB,2CAA6B;AAC7B,+DAA2D;AAE3D;;;;;GAKG;AACH,SAAgB,eAAe;IAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAEtC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,wCAAkB,CAC1B,8CAA8C,EAC9C,SAAS,EACT,gGAAgG,CACjG,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,wCAAkB,CAC1B,kDAAkD,IAAI,EAAE,EACxD,SAAS,EACT,+DAA+D,CAChE,CAAC;IACJ,CAAC;IAED,mCAAmC;IACnC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,wCAAkB,CAC1B,2DAA2D,IAAI,EAAE,EACjE,SAAS,EACT,oFAAoF,CACrF,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,WAAmB;IAC/C,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QACrD,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,WAAoB;IACtD,MAAM,IAAI,GAAG,WAAW,IAAI,eAAe,EAAE,CAAC;IAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;AACzC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,WAAoB;IACvD,MAAM,IAAI,GAAG,WAAW,IAAI,eAAe,EAAE,CAAC;IAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resource creation methods - How resources are created in the system
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Enumeration of all possible resource creation methods
|
|
6
|
-
*/
|
|
7
|
-
export declare const CREATION_METHODS: {
|
|
8
|
-
readonly API: "api";
|
|
9
|
-
readonly UPLOAD: "upload";
|
|
10
|
-
readonly UI: "ui";
|
|
11
|
-
readonly REFERENCE: "reference";
|
|
12
|
-
readonly CLONE: "clone";
|
|
13
|
-
readonly GENERATED: "generated";
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Type for resource creation methods
|
|
17
|
-
*/
|
|
18
|
-
export type CreationMethod = typeof CREATION_METHODS[keyof typeof CREATION_METHODS];
|
|
19
|
-
//# sourceMappingURL=creation-methods.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"creation-methods.d.ts","sourceRoot":"","sources":["../src/creation-methods.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;CAOnB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,gBAAgB,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC"}
|