@fntio/infra-client-plugin-cdk 0.0.0-stage → 0.2.0
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/LICENSE +93 -0
- package/README.md +85 -2
- package/dist/index.d.ts +40 -0
- package/dist/index.js +77 -0
- package/package.json +70 -4
- package/skills/integrate-infra-client-plugin/SKILL.md +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Elastic License 2.0
|
|
2
|
+
|
|
3
|
+
URL: https://www.elastic.co/licensing/elastic-license
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
12
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
13
|
+
available, and prepare derivative works of the software, in each case subject to
|
|
14
|
+
the limitations and conditions below.
|
|
15
|
+
|
|
16
|
+
## Limitations
|
|
17
|
+
|
|
18
|
+
You may not provide the software to third parties as a hosted or managed
|
|
19
|
+
service, where the service provides users with access to any substantial set of
|
|
20
|
+
the features or functionality of the software.
|
|
21
|
+
|
|
22
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
23
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
24
|
+
software that is protected by the license key.
|
|
25
|
+
|
|
26
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
27
|
+
of the licensor in the software. Any use of the licensor’s trademarks is subject
|
|
28
|
+
to applicable law.
|
|
29
|
+
|
|
30
|
+
## Patents
|
|
31
|
+
|
|
32
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
+
sale, import and have imported the software, in each case subject to the
|
|
35
|
+
limitations and conditions in this license. This license does not cover any
|
|
36
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
+
the software. If you or your company make any written claim that the software
|
|
38
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
39
|
+
the software granted under these terms ends immediately. If your company makes
|
|
40
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
41
|
+
company.
|
|
42
|
+
|
|
43
|
+
## Notices
|
|
44
|
+
|
|
45
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
46
|
+
also gets a copy of these terms.
|
|
47
|
+
|
|
48
|
+
If you modify the software, you must include in any modified copies of the
|
|
49
|
+
software prominent notices stating that you have modified the software.
|
|
50
|
+
|
|
51
|
+
## No Other Rights
|
|
52
|
+
|
|
53
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
+
these terms.
|
|
55
|
+
|
|
56
|
+
## Termination
|
|
57
|
+
|
|
58
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
59
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
60
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
61
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
62
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
63
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
64
|
+
to terminate automatically and permanently.
|
|
65
|
+
|
|
66
|
+
## No Liability
|
|
67
|
+
|
|
68
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
+
legal claim.*
|
|
72
|
+
|
|
73
|
+
## Definitions
|
|
74
|
+
|
|
75
|
+
The **licensor** is the entity offering these terms, and the **software** is the
|
|
76
|
+
software the licensor makes available under these terms, including any portion
|
|
77
|
+
of it.
|
|
78
|
+
|
|
79
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
80
|
+
|
|
81
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
82
|
+
organization that you work for, plus all organizations that have control over,
|
|
83
|
+
are under the control of, or are under common control with that
|
|
84
|
+
organization. **control** means ownership of substantially all the assets of an
|
|
85
|
+
entity, or the power to direct its management and policies by vote, contract, or
|
|
86
|
+
otherwise. Control can be direct or indirect.
|
|
87
|
+
|
|
88
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
89
|
+
these terms.
|
|
90
|
+
|
|
91
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
92
|
+
|
|
93
|
+
**trademark** means trademarks, service marks, and similar rights.
|
package/README.md
CHANGED
|
@@ -1,3 +1,86 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @fntio/infra-client-plugin-cdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Registers customer plugins from an existing CDK application. This package holds
|
|
4
|
+
`definePlugin`, the synth-time validation of a definition; the constructs that create the
|
|
5
|
+
gateway methods, upload the assets and write the catalog record (`resolvePlugins`,
|
|
6
|
+
`PluginApi`, `PluginCatalogActivation`) live in `@fntio/infra-client` and run when the
|
|
7
|
+
definition is passed to `addAccessPortal` — see the core README's
|
|
8
|
+
[Plugins](../infra-client/README.md#plugins) section. Private until publishing is enabled.
|
|
9
|
+
|
|
10
|
+
## `definePlugin`
|
|
11
|
+
|
|
12
|
+
Turns a customer's definition into a validated `PluginDefinition`: the serializable
|
|
13
|
+
manifest (what the catalog stores and the portal discovers) separated from the
|
|
14
|
+
deployment inputs (the asset directory and the Lambda handlers).
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { definePlugin } from "@fntio/infra-client-plugin-cdk";
|
|
18
|
+
|
|
19
|
+
export const parameters = definePlugin({
|
|
20
|
+
schemaVersion: 1,
|
|
21
|
+
id: "parameters",
|
|
22
|
+
displayName: "Application parameters",
|
|
23
|
+
version: "1.0.0",
|
|
24
|
+
hostApiVersion: 1,
|
|
25
|
+
enabled: true,
|
|
26
|
+
accounts: [{ accountNumber: "123456789012", regions: ["eu-central-1"] }],
|
|
27
|
+
permissions: [
|
|
28
|
+
{ id: "user", label: "View application parameters" },
|
|
29
|
+
{ id: "admin", label: "Edit application parameters" },
|
|
30
|
+
],
|
|
31
|
+
ui: {
|
|
32
|
+
assets: "./plugins/parameters/dist",
|
|
33
|
+
user: { label: "Parameters", entry: "index.html#/user" },
|
|
34
|
+
admin: { label: "Parameters", entry: "index.html#/admin" },
|
|
35
|
+
},
|
|
36
|
+
backend: {
|
|
37
|
+
handlers: { api: (scope) => new lambda.Function(scope, "ParametersApi", { /* ... */ }) },
|
|
38
|
+
routes: [
|
|
39
|
+
{ id: "list", method: "GET", path: "/parameters", permission: "user", handlerKey: "api" },
|
|
40
|
+
{ id: "update", method: "PUT", path: "/parameters/{name}", permission: "admin", handlerKey: "api" },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
A handler is either an existing `IFunction` or a factory that the registration
|
|
47
|
+
construct calls once inside its own scope. `ui.assets` resolves like a CDK asset
|
|
48
|
+
path, from the process working directory.
|
|
49
|
+
|
|
50
|
+
`definePlugin` throws one `PluginValidationError` listing every problem: the SDK's
|
|
51
|
+
manifest rules (see the SDK README), plus routes naming a handler key that has no
|
|
52
|
+
handler, a missing asset directory, and an entry file that is not in it. It runs at
|
|
53
|
+
synth time, so a bad definition fails `cdk synth`, never a deploy.
|
|
54
|
+
|
|
55
|
+
## Develop
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
cd packages/infra-client-plugin-cdk
|
|
59
|
+
npx tsc --noEmit && npm test
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Type checks and tests resolve `@fntio/infra-client-plugin-sdk` to its `src/`
|
|
63
|
+
(tsconfig `paths` + Jest `moduleNameMapper`); `npm run build` uses the SDK's built
|
|
64
|
+
`dist/`, so run `npm run build:plugins` at the repository root to build all three.
|
|
65
|
+
|
|
66
|
+
## Agent skill
|
|
67
|
+
|
|
68
|
+
`skills/integrate-infra-client-plugin/` ships with this package: it inspects an existing CDK
|
|
69
|
+
application's own conventions — where the portal is composed, how Lambdas are built, how it deploys —
|
|
70
|
+
and makes the smallest correct change, then diffs it. Make it available the way your agent setup
|
|
71
|
+
already does; there is no installer and no generated project.
|
|
72
|
+
|
|
73
|
+
## The lifecycle in one place
|
|
74
|
+
|
|
75
|
+
| Step | What to change | What happens |
|
|
76
|
+
| --- | --- | --- |
|
|
77
|
+
| Install | add the definition to `plugins` | assets upload, routes mount, a catalog record is written |
|
|
78
|
+
| Update | change the definition | a new revision; a running frame prompts to reload |
|
|
79
|
+
| Rollback | redeploy the previous definition | the record returns through the same provider |
|
|
80
|
+
| Disable | `enabled: false` | hidden and refused; grants stay, dormant and revocable |
|
|
81
|
+
| Remove | delete the registration | record tombstoned before the routes go; grants deliberately kept |
|
|
82
|
+
| Reinstall | add the same id back | still-valid grants come back with it |
|
|
83
|
+
|
|
84
|
+
Removing the registrations and turning the whole feature off are two separate deploys, in that order.
|
|
85
|
+
|
|
86
|
+
A worked example of everything above is [`@fntio/infra-client-plugin-example`](../infra-client-plugin-example/README.md).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { IFunction } from "aws-cdk-lib/aws-lambda";
|
|
2
|
+
import type { Construct } from "constructs";
|
|
3
|
+
import { PluginAccountBinding, PluginManifestV1, PluginPermissionDefinition, PluginRoute, PluginUiEntry } from "@fntio/infra-client-plugin-sdk";
|
|
4
|
+
export { PluginValidationError } from "@fntio/infra-client-plugin-sdk";
|
|
5
|
+
export type { PluginManifestV1, PluginRoute, PluginUiEntry } from "@fntio/infra-client-plugin-sdk";
|
|
6
|
+
/** An existing function, or a factory the registration construct calls once inside its own scope. */
|
|
7
|
+
export type PluginHandlerSource = IFunction | ((scope: Construct) => IFunction);
|
|
8
|
+
export interface PluginUiDefinition {
|
|
9
|
+
/** Built frontend directory (relative paths resolve from the process working directory, like CDK assets). */
|
|
10
|
+
readonly assets: string;
|
|
11
|
+
readonly user?: PluginUiEntry;
|
|
12
|
+
readonly admin?: PluginUiEntry;
|
|
13
|
+
}
|
|
14
|
+
export interface PluginBackendDefinition {
|
|
15
|
+
/** Keyed by the `handlerKey` routes refer to. */
|
|
16
|
+
readonly handlers: Readonly<Record<string, PluginHandlerSource>>;
|
|
17
|
+
readonly routes: readonly PluginRoute[];
|
|
18
|
+
}
|
|
19
|
+
/** What a customer writes: the manifest fields plus deployment inputs (assets, handlers). */
|
|
20
|
+
export interface PluginDefinitionInput {
|
|
21
|
+
readonly schemaVersion: 1;
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly displayName: string;
|
|
24
|
+
readonly description?: string;
|
|
25
|
+
readonly version: string;
|
|
26
|
+
readonly hostApiVersion: 1;
|
|
27
|
+
readonly enabled: boolean;
|
|
28
|
+
readonly accounts: readonly PluginAccountBinding[];
|
|
29
|
+
readonly permissions: readonly PluginPermissionDefinition[];
|
|
30
|
+
readonly ui?: PluginUiDefinition;
|
|
31
|
+
readonly backend?: PluginBackendDefinition;
|
|
32
|
+
}
|
|
33
|
+
/** A validated definition: the serializable manifest, separated from the deployment-only inputs. */
|
|
34
|
+
export interface PluginDefinition {
|
|
35
|
+
readonly manifest: PluginManifestV1;
|
|
36
|
+
/** Absolute path of the asset directory; absent for backend-only plugins. */
|
|
37
|
+
readonly assetDirectory?: string;
|
|
38
|
+
readonly handlers: Readonly<Record<string, PluginHandlerSource>>;
|
|
39
|
+
}
|
|
40
|
+
export declare function definePlugin(input: PluginDefinitionInput): PluginDefinition;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.PluginValidationError = void 0;
|
|
37
|
+
exports.definePlugin = definePlugin;
|
|
38
|
+
const fs = __importStar(require("node:fs"));
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
40
|
+
const infra_client_plugin_sdk_1 = require("@fntio/infra-client-plugin-sdk");
|
|
41
|
+
var infra_client_plugin_sdk_2 = require("@fntio/infra-client-plugin-sdk");
|
|
42
|
+
Object.defineProperty(exports, "PluginValidationError", { enumerable: true, get: function () { return infra_client_plugin_sdk_2.PluginValidationError; } });
|
|
43
|
+
function definePlugin(input) {
|
|
44
|
+
const { ui, backend, ...fields } = input;
|
|
45
|
+
const handlers = backend?.handlers ?? {};
|
|
46
|
+
const manifestInput = { ...fields, routes: backend?.routes ?? [] };
|
|
47
|
+
if (ui !== undefined) {
|
|
48
|
+
manifestInput.ui = {
|
|
49
|
+
...(ui.user === undefined ? {} : { user: ui.user }),
|
|
50
|
+
...(ui.admin === undefined ? {} : { admin: ui.admin }),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const manifest = (0, infra_client_plugin_sdk_1.assertPluginManifest)(manifestInput, { handlerKeys: Object.keys(handlers) });
|
|
54
|
+
const assetDirectory = ui === undefined ? undefined : resolveAssetDirectory(ui.assets, manifest);
|
|
55
|
+
return { manifest, assetDirectory, handlers };
|
|
56
|
+
}
|
|
57
|
+
function resolveAssetDirectory(assets, manifest) {
|
|
58
|
+
const dir = path.resolve(assets);
|
|
59
|
+
const issues = [];
|
|
60
|
+
if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) {
|
|
61
|
+
issues.push({ code: "ui-assets-directory", path: "ui.assets", message: `${dir} is not a directory (build the plugin frontend first?)` });
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
for (const kind of ["user", "admin"]) {
|
|
65
|
+
const entry = manifest.ui?.[kind];
|
|
66
|
+
if (!entry)
|
|
67
|
+
continue;
|
|
68
|
+
const file = path.resolve(dir, (0, infra_client_plugin_sdk_1.pluginEntryFile)(entry.entry));
|
|
69
|
+
if (!file.startsWith(dir + path.sep) || !fs.existsSync(file) || !fs.statSync(file).isFile()) {
|
|
70
|
+
issues.push({ code: "ui-entry-missing", path: `ui.${kind}.entry`, message: `${(0, infra_client_plugin_sdk_1.pluginEntryFile)(entry.entry)} not found under ${dir}` });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (issues.length > 0)
|
|
75
|
+
throw new infra_client_plugin_sdk_1.PluginValidationError(issues, `Plugin "${manifest.id}"`);
|
|
76
|
+
return dir;
|
|
77
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fntio/infra-client-plugin-cdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Define and register infra-client customer plugins from an existing CDK application.",
|
|
5
|
+
"license": "Elastic-2.0",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/FNTIO/aws-infrastructure-client.git",
|
|
12
|
+
"directory": "packages/infra-client-plugin-cdk"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/FNTIO/aws-infrastructure-client/wiki",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/FNTIO/aws-infrastructure-client/issues"
|
|
17
|
+
},
|
|
18
|
+
"main": "dist/index.js",
|
|
19
|
+
"types": "dist/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"skills",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=20"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc -p tsconfig.build.json",
|
|
30
|
+
"prepack": "npm run build",
|
|
31
|
+
"test": "jest"
|
|
32
|
+
},
|
|
33
|
+
"jest": {
|
|
34
|
+
"testEnvironment": "node",
|
|
35
|
+
"roots": [
|
|
36
|
+
"<rootDir>/src"
|
|
37
|
+
],
|
|
38
|
+
"testMatch": [
|
|
39
|
+
"**/*.test.ts"
|
|
40
|
+
],
|
|
41
|
+
"transform": {
|
|
42
|
+
"^.+\\.tsx?$": [
|
|
43
|
+
"ts-jest",
|
|
44
|
+
{
|
|
45
|
+
"tsconfig": "<rootDir>/tsconfig.jest.json"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"moduleNameMapper": {
|
|
50
|
+
"^@fntio/infra-client-plugin-sdk$": "<rootDir>/../infra-client-plugin-sdk/src/index.ts",
|
|
51
|
+
"^@fntio/infra-client-plugin-sdk/(.*)$": "<rootDir>/../infra-client-plugin-sdk/src/$1/index.ts"
|
|
52
|
+
},
|
|
53
|
+
"maxWorkers": "50%",
|
|
54
|
+
"workerIdleMemoryLimit": "2GB"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@fntio/infra-client-plugin-sdk": "^0.2.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"aws-cdk-lib": "^2.263.0",
|
|
61
|
+
"constructs": "^10.3.0"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@types/jest": "^29.5.14",
|
|
65
|
+
"@types/node": "^20.19.43",
|
|
66
|
+
"aws-cdk-lib": "2.263.0",
|
|
67
|
+
"constructs": "10.6.0",
|
|
68
|
+
"jest": "^29.7.0",
|
|
69
|
+
"ts-jest": "^29.2.0",
|
|
70
|
+
"typescript": "^5.5.0"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: integrate-infra-client-plugin
|
|
3
|
+
description: Add an existing infra-client plugin to a CDK application that already exists — registration, asset build, IAM, and the deploy, update, rollback, disable and remove lifecycle. Use when someone asks to install, register, upgrade or remove a portal plugin in their infrastructure.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Integrate a plugin into an existing CDK application
|
|
7
|
+
|
|
8
|
+
This is infrastructure work on a codebase someone already owns and deploys. The goal is the smallest
|
|
9
|
+
correct change to their existing app — not a new project, not a new pipeline, not a restructure.
|
|
10
|
+
|
|
11
|
+
**Read the installed package's documentation first** — `README.md` in `@fntio/infra-client-plugin-cdk`
|
|
12
|
+
and the `Plugins` section of `@fntio/infra-client`'s README. They describe the version installed here.
|
|
13
|
+
|
|
14
|
+
## Inspect before you change anything
|
|
15
|
+
|
|
16
|
+
1. **Find where the portal is composed.** Either `addAccessPortal(...)`, or the stacks composed by
|
|
17
|
+
hand. The plugin list goes wherever that call already is.
|
|
18
|
+
2. **Find their Lambda conventions** — construct, bundler, runtime, log retention — and their asset
|
|
19
|
+
build. A plugin's handler and frontend should be built the way everything else here is built.
|
|
20
|
+
3. **Find their deployment path.** A pipeline, a workflow, a manual command. The plugin's frontend
|
|
21
|
+
must be built before synth, so that build belongs wherever their other build steps already are.
|
|
22
|
+
4. **Check the feature is on.** Plugins need the `plugins` block enabled in the project config.
|
|
23
|
+
Registering one while the feature is off fails at synth, on purpose.
|
|
24
|
+
|
|
25
|
+
## Make the change
|
|
26
|
+
|
|
27
|
+
- Add the registration to the existing plugin list. Do not create a stack for it unless the project's
|
|
28
|
+
own conventions call for one.
|
|
29
|
+
- Keep construct ids stable. Renaming one replaces resources.
|
|
30
|
+
- Scope the handler's IAM to exactly what it needs, in the project's usual style.
|
|
31
|
+
- Then synthesize and **diff against the deployed state**. Expect: the plugin's methods, its authorizer
|
|
32
|
+
if this is the first plugin with routes, an asset upload, and a catalog record. Anything else
|
|
33
|
+
appearing — especially a changed identity on an unrelated resource — means something moved that
|
|
34
|
+
should not have.
|
|
35
|
+
|
|
36
|
+
## The lifecycle, and what each step does
|
|
37
|
+
|
|
38
|
+
- **Update**: change the definition, redeploy. A new revision is recorded; a running frame prompts the
|
|
39
|
+
user to reload rather than being swapped out.
|
|
40
|
+
- **Rollback**: redeploy the previous definition. The record returns through the same provider.
|
|
41
|
+
- **Disable**: `enabled: false` keeps everything but hides the plugin and refuses its calls. Grants
|
|
42
|
+
stay, visible and dormant.
|
|
43
|
+
- **Remove**: delete the registration. The record is tombstoned before the routes go, holders are
|
|
44
|
+
notified, and grant rows are deliberately kept so reinstalling the same id restores still-valid
|
|
45
|
+
access.
|
|
46
|
+
- **Turn the whole feature off**: remove the registrations first, in their own deploy, then disable the
|
|
47
|
+
feature. Doing both at once can fail on an export still in use.
|
|
48
|
+
|
|
49
|
+
## Hand back
|
|
50
|
+
|
|
51
|
+
State plainly what the diff contained, what a deploy will do to existing grants, and which steps are
|
|
52
|
+
manual. If anything the customer must decide is missing — which accounts, which prefixes, which
|
|
53
|
+
execution role — ask rather than inventing a value.
|