@sdlcworks/components 0.0.36 → 0.0.37

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +16 -6
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -245,18 +245,26 @@ export type ProviderPulumiCtx<I, S, P extends CloudProvider = CloudProvider> = {
245
245
  };
246
246
  /**
247
247
  * Context passed to the connect function.
248
- * Called once per app component requesting a connection.
248
+ * Called once per each connection being established.
249
249
  * The connect function returns handler entries that can capture this context via closure.
250
+ *
251
+ * connectorComponentName — the app component that is requesting the connection (the consumer).
252
+ * selfComponentName — the app component being connected TO (the dependency / the "self" of the
253
+ * infra component being called). For hosting infra components (e.g. k3s) this is the specific
254
+ * app component whose allocation info should be used to construct URIs.
255
+ * For URL register flows, connectorComponentName is set to ANONYMOUS_CONNECTION_TYPE.
250
256
  */
251
257
  export type ConnectFnCtx<S, P extends CloudProvider = CloudProvider> = {
252
258
  state: S;
253
259
  getCredentials: GetCredentialsFn<P>;
254
- componentName: string;
260
+ connectorComponentName: string;
261
+ selfComponentName: string;
255
262
  };
256
263
  /**
257
264
  * Reduced context passed to individual connection handlers.
258
265
  * Only contains the per-invocation essentials (connectionData, connectionType, and $).
259
- * Handlers access state, getCredentials, and componentName via closure from the connect function.
266
+ * Handlers access state, getCredentials, connectorComponentName, and selfComponentName
267
+ * via closure from the connect function.
260
268
  *
261
269
  * $ - Naming function for Pulumi resources created by this handler. Always use $ for resource
262
270
  * names so the orchestrator can track which resources are created by connection logic and
@@ -287,7 +295,8 @@ export type ConnectionHandlerResult<TMetadata = undefined> = {
287
295
  /**
288
296
  * A connection handler entry mapping a ConnectionInterfaceDef to its handler function.
289
297
  * The handler receives a reduced context (connectionData and connectionType only).
290
- * State, getCredentials, and componentName are accessed via closure from the connect function.
298
+ * State, getCredentials, connectorComponentName, and selfComponentName are accessed via
299
+ * closure from the connect function.
291
300
  * The handler returns typed metadata based on the interface's resultSchema.
292
301
  */
293
302
  export type ConnectionHandlerEntry<ConnectionType extends string, D extends ConnectionInterfaceDef> = {
@@ -305,8 +314,9 @@ export type ConnectionHandlerDef<D extends ConnectionInterfaceDef> = {
305
314
  export declare function connectionHandler<D extends ConnectionInterfaceDef>(entry: ConnectionHandlerDef<D>): ConnectionHandlerDef<D>;
306
315
  /**
307
316
  * Type for the connect function.
308
- * Called once per app component requesting a connection.
309
- * Returns an array of handler entries that can use the context via closure.
317
+ * Called once per connection being established.
318
+ * Returns an array of handler entries that can use the context (including
319
+ * connectorComponentName and selfComponentName) via closure.
310
320
  */
311
321
  export type ConnectFn<S, ConnectionType extends string, P extends CloudProvider = CloudProvider> = (ctx: ConnectFnCtx<S, P>) => readonly ConnectionHandlerEntry<ConnectionType, any>[];
312
322
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdlcworks/components",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "module": "dist/index.js",
5
5
  "files": [
6
6
  "dist"