@di-framework/cloudfoundry 5.2.3
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/README.md +128 -0
- package/dist/application-info.d.ts +6 -0
- package/dist/application-info.js +126 -0
- package/dist/bindings.d.ts +9 -0
- package/dist/bindings.js +61 -0
- package/dist/creators/amqp.d.ts +6 -0
- package/dist/creators/amqp.js +109 -0
- package/dist/creators/blob-storage.d.ts +6 -0
- package/dist/creators/blob-storage.js +95 -0
- package/dist/creators/redis.d.ts +6 -0
- package/dist/creators/redis.js +95 -0
- package/dist/creators/relational.d.ts +6 -0
- package/dist/creators/relational.js +179 -0
- package/dist/creators/user-provided.d.ts +6 -0
- package/dist/creators/user-provided.js +36 -0
- package/dist/decorators.d.ts +34 -0
- package/dist/decorators.js +202 -0
- package/dist/detector.d.ts +22 -0
- package/dist/detector.js +35 -0
- package/dist/environment.d.ts +62 -0
- package/dist/environment.js +326 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +11 -0
- package/dist/spi/creator.d.ts +15 -0
- package/dist/spi/creator.js +1 -0
- package/dist/spi/registry.d.ts +28 -0
- package/dist/spi/registry.js +161 -0
- package/dist/types.d.ts +145 -0
- package/dist/types.js +5 -0
- package/package.json +51 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core type definitions for Cloud Foundry metadata, VCAP parsing,
|
|
3
|
+
* ServiceInfo models, and connector SPI interfaces.
|
|
4
|
+
*/
|
|
5
|
+
export interface RawVcapServiceData {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly tags?: readonly string[];
|
|
9
|
+
readonly plan?: string;
|
|
10
|
+
readonly credentials?: Readonly<Record<string, unknown>>;
|
|
11
|
+
readonly volume_mounts?: readonly unknown[];
|
|
12
|
+
readonly syslog_drain_url?: string | null;
|
|
13
|
+
readonly provider?: string | null;
|
|
14
|
+
readonly binding_name?: string | null;
|
|
15
|
+
readonly instance_name?: string | null;
|
|
16
|
+
readonly [key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
export interface CloudFoundryApplicationInfo {
|
|
19
|
+
readonly applicationId: string;
|
|
20
|
+
readonly applicationName: string;
|
|
21
|
+
readonly applicationUris: readonly string[];
|
|
22
|
+
readonly applicationVersion?: string;
|
|
23
|
+
readonly spaceId: string;
|
|
24
|
+
readonly spaceName: string;
|
|
25
|
+
readonly organizationId?: string;
|
|
26
|
+
readonly organizationName?: string;
|
|
27
|
+
readonly instanceId?: string;
|
|
28
|
+
readonly instanceIndex?: number;
|
|
29
|
+
readonly host?: string;
|
|
30
|
+
readonly port?: number;
|
|
31
|
+
readonly limits?: {
|
|
32
|
+
readonly disk?: number;
|
|
33
|
+
readonly fds?: number;
|
|
34
|
+
readonly mem?: number;
|
|
35
|
+
};
|
|
36
|
+
readonly rawConfig: Readonly<Record<string, unknown>>;
|
|
37
|
+
}
|
|
38
|
+
export interface CloudFoundryServiceInfo {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly label: string;
|
|
42
|
+
readonly plan?: string;
|
|
43
|
+
readonly tags: readonly string[];
|
|
44
|
+
readonly credentials: Readonly<Record<string, unknown>>;
|
|
45
|
+
}
|
|
46
|
+
export type RelationalDialect = 'postgres' | 'mysql' | 'mariadb' | 'sqlite';
|
|
47
|
+
export interface RelationalServiceInfo extends CloudFoundryServiceInfo {
|
|
48
|
+
readonly dialect: RelationalDialect;
|
|
49
|
+
readonly host: string;
|
|
50
|
+
readonly port: number;
|
|
51
|
+
readonly database: string;
|
|
52
|
+
readonly username?: string;
|
|
53
|
+
readonly password?: string;
|
|
54
|
+
readonly uri: string;
|
|
55
|
+
readonly jdbcUrl?: string;
|
|
56
|
+
readonly ssl?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface RedisServiceInfo extends CloudFoundryServiceInfo {
|
|
59
|
+
readonly host: string;
|
|
60
|
+
readonly port: number;
|
|
61
|
+
readonly password?: string;
|
|
62
|
+
readonly database?: number;
|
|
63
|
+
readonly uri: string;
|
|
64
|
+
readonly tls?: boolean;
|
|
65
|
+
readonly cluster?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface AmqpServiceInfo extends CloudFoundryServiceInfo {
|
|
68
|
+
readonly host: string;
|
|
69
|
+
readonly port: number;
|
|
70
|
+
readonly virtualHost?: string;
|
|
71
|
+
readonly username?: string;
|
|
72
|
+
readonly password?: string;
|
|
73
|
+
readonly uri: string;
|
|
74
|
+
readonly uris: readonly string[];
|
|
75
|
+
readonly ssl?: boolean;
|
|
76
|
+
readonly httpManagementUri?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface BlobStorageServiceInfo extends CloudFoundryServiceInfo {
|
|
79
|
+
readonly endpoint?: string;
|
|
80
|
+
readonly bucketName: string;
|
|
81
|
+
readonly region?: string;
|
|
82
|
+
readonly accessKeyId?: string;
|
|
83
|
+
readonly secretAccessKey?: string;
|
|
84
|
+
readonly uri?: string;
|
|
85
|
+
readonly pathStyle?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface UserProvidedServiceInfo extends CloudFoundryServiceInfo {
|
|
88
|
+
readonly uri?: string;
|
|
89
|
+
readonly host?: string;
|
|
90
|
+
readonly port?: number;
|
|
91
|
+
readonly username?: string;
|
|
92
|
+
readonly password?: string;
|
|
93
|
+
}
|
|
94
|
+
export type ServicePredicate = (service: CloudFoundryServiceInfo) => boolean;
|
|
95
|
+
export interface ServiceFilter {
|
|
96
|
+
readonly name?: string | RegExp;
|
|
97
|
+
readonly label?: string | RegExp;
|
|
98
|
+
readonly tag?: string | RegExp;
|
|
99
|
+
readonly dialect?: RelationalDialect;
|
|
100
|
+
readonly predicate?: ServicePredicate;
|
|
101
|
+
}
|
|
102
|
+
export interface CloudFoundryServiceOptions {
|
|
103
|
+
/**
|
|
104
|
+
* Environment variable key(s) to inspect for fallback when service is not bound in Cloud Foundry.
|
|
105
|
+
*/
|
|
106
|
+
readonly fallbackEnv?: string | readonly string[];
|
|
107
|
+
/**
|
|
108
|
+
* If true, throws an error if the service cannot be resolved. Defaults to true.
|
|
109
|
+
*/
|
|
110
|
+
readonly required?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Default value to inject if the service is not found and required is false.
|
|
113
|
+
*/
|
|
114
|
+
readonly defaultValue?: unknown;
|
|
115
|
+
/**
|
|
116
|
+
* Target container for resolution or binding.
|
|
117
|
+
*/
|
|
118
|
+
readonly container?: unknown;
|
|
119
|
+
}
|
|
120
|
+
export interface LocalFallbackOptions {
|
|
121
|
+
/** Environment variable keys for relational database fallback (e.g. ['DATABASE_URL', 'POSTGRES_URL']) */
|
|
122
|
+
readonly relationalUriEnv?: readonly string[];
|
|
123
|
+
/** Environment variable keys for Redis fallback (e.g. ['REDIS_URL', 'REDIS_TLS_URL']) */
|
|
124
|
+
readonly redisUriEnv?: readonly string[];
|
|
125
|
+
/** Environment variable keys for AMQP / RabbitMQ fallback (e.g. ['AMQP_URL', 'RABBITMQ_URL', 'CLOUDAMQP_URL']) */
|
|
126
|
+
readonly amqpUriEnv?: readonly string[];
|
|
127
|
+
/** S3 / Blob storage fallback credentials */
|
|
128
|
+
readonly blobStorageEnv?: {
|
|
129
|
+
readonly bucket?: string;
|
|
130
|
+
readonly endpoint?: string;
|
|
131
|
+
readonly region?: string;
|
|
132
|
+
readonly accessKeyId?: string;
|
|
133
|
+
readonly secretAccessKey?: string;
|
|
134
|
+
};
|
|
135
|
+
/** Explicit fallback service infos keyed by service name */
|
|
136
|
+
readonly services?: Record<string, Partial<CloudFoundryServiceInfo>>;
|
|
137
|
+
}
|
|
138
|
+
export interface EnableCloudFoundryConnectorsOptions {
|
|
139
|
+
/** Custom environment dictionary (defaults to process.env) */
|
|
140
|
+
readonly env?: Record<string, string | undefined>;
|
|
141
|
+
/** Enable local fallback resolution when not in Cloud Foundry */
|
|
142
|
+
readonly localFallback?: boolean | LocalFallbackOptions;
|
|
143
|
+
/** Custom DI container to bind discovered services into */
|
|
144
|
+
readonly container?: unknown;
|
|
145
|
+
}
|
package/dist/types.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@di-framework/cloudfoundry",
|
|
3
|
+
"version": "5.2.3",
|
|
4
|
+
"description": "Cloud Foundry connector for VCAP_SERVICES discovery, application metadata, and automated DI binding.",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"license": "(MIT OR Apache-2.0)",
|
|
10
|
+
"author": "@di-framework Contributors",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/di-framework/di-framework",
|
|
14
|
+
"directory": "packages/di-framework-cloudfoundry"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/di-framework/di-framework/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/di-framework/di-framework#readme",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"cloudfoundry",
|
|
22
|
+
"vcap",
|
|
23
|
+
"vcap_services",
|
|
24
|
+
"vcap_application",
|
|
25
|
+
"tanzu",
|
|
26
|
+
"spring-cloud-connectors",
|
|
27
|
+
"dependency-injection",
|
|
28
|
+
"decorators",
|
|
29
|
+
"connectors"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"test": "bun test",
|
|
33
|
+
"build": "rm -rf dist && bun x tsc -p tsconfig.build.json"
|
|
34
|
+
},
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"bun": "./dist/index.js",
|
|
39
|
+
"import": "./dist/index.js",
|
|
40
|
+
"default": "./dist/index.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@di-framework/core": "^5",
|
|
45
|
+
"typescript": "^5"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"dist",
|
|
49
|
+
"README.md"
|
|
50
|
+
]
|
|
51
|
+
}
|