@n8n/frontend-module-type-availability-policies 0.1.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.md ADDED
@@ -0,0 +1,88 @@
1
+ # License
2
+
3
+ Portions of this software are licensed as follows:
4
+
5
+ - Content of branches other than the main branch (i.e. "master") are not licensed.
6
+ - Source code files that contain ".ee." in their filename or ".ee" in their dirname are NOT licensed under
7
+ the Sustainable Use License.
8
+ To use source code files that contain ".ee." in their filename or ".ee" in their dirname you must hold a
9
+ valid n8n Enterprise License specifically allowing you access to such source code files and as defined
10
+ in "LICENSE_EE.md".
11
+ - All third party components incorporated into the n8n Software are licensed under the original license
12
+ provided by the owner of the applicable component.
13
+ - Content outside of the above mentioned files or restrictions is available under the "Sustainable Use
14
+ License" as defined below.
15
+
16
+ ## Sustainable Use License
17
+
18
+ Version 1.0
19
+
20
+ ### Acceptance
21
+
22
+ By using the software, you agree to all of the terms and conditions below.
23
+
24
+ ### Copyright License
25
+
26
+ The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license
27
+ to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject
28
+ to the limitations below.
29
+
30
+ ### Limitations
31
+
32
+ You may use or modify the software only for your own internal business purposes or for non-commercial or
33
+ personal use. You may distribute the software or provide it to others only if you do so free of charge for
34
+ non-commercial purposes. You may not alter, remove, or obscure any licensing, copyright, or other notices of
35
+ the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
36
+
37
+ ### Patents
38
+
39
+ The licensor grants you a license, under any patent claims the licensor can license, or becomes able to
40
+ license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case
41
+ subject to the limitations and conditions in this license. This license does not cover any patent claims that
42
+ you cause to be infringed by modifications or additions to the software. If you or your company make any
43
+ written claim that the software infringes or contributes to infringement of any patent, your patent license
44
+ for the software granted under these terms ends immediately. If your company makes such a claim, your patent
45
+ license ends immediately for work on behalf of your company.
46
+
47
+ ### Notices
48
+
49
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these
50
+ terms. If you modify the software, you must include in any modified copies of the software a prominent notice
51
+ stating that you have modified the software.
52
+
53
+ ### No Other Rights
54
+
55
+ These terms do not imply any licenses other than those expressly granted in these terms.
56
+
57
+ ### Termination
58
+
59
+ If you use the software in violation of these terms, such use is not licensed, and your license will
60
+ automatically terminate. If the licensor provides you with a notice of your violation, and you cease all
61
+ violation of this license no later than 30 days after you receive that notice, your license will be reinstated
62
+ retroactively. However, if you violate these terms after such reinstatement, any additional violation of these
63
+ terms will cause your license to terminate automatically and permanently.
64
+
65
+ ### No Liability
66
+
67
+ As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will
68
+ not be liable to you for any damages arising out of these terms or the use or nature of the software, under
69
+ any kind of legal claim.
70
+
71
+ ### Definitions
72
+
73
+ The “licensor” is the entity offering these terms.
74
+
75
+ The “software” is the software the licensor makes available under these terms, including any portion of it.
76
+
77
+ “You” refers to the individual or entity agreeing to these terms.
78
+
79
+ “Your company” is any legal entity, sole proprietorship, or other kind of organization that you work for, plus
80
+ all organizations that have control over, are under the control of, or are under common control with that
81
+ organization. Control means ownership of substantially all the assets of an entity, or the power to direct its
82
+ management and policies by vote, contract, or otherwise. Control can be direct or indirect.
83
+
84
+ “Your license” is the license granted to you for the software under these terms.
85
+
86
+ “Use” means anything you do with the software requiring your license.
87
+
88
+ “Trademark” means trademarks, service marks, and similar rights.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # @n8n/frontend-module-type-availability-policies
2
+
3
+ Frontend module for node type availability policies. The editor-ui shell consumes it from
4
+ source through `src/app/modules.manifest.ts`, so there is no build step and no `dist`.
5
+
6
+ The descriptor `id` must match the backend module id
7
+ (`packages/cli/src/modules/type-availability-policies`). Both `settings.activeModules` and
8
+ `/rest/module-settings` are keyed by that string, and a mismatch fails silently.
9
+
10
+ The module is license-gated on `feat:nodeTypePolicies` and is not a default module. Enable it
11
+ in a dev instance with `N8N_ENABLED_MODULES=type-availability-policies`.
12
+
13
+ ```bash
14
+ pnpm turbo typecheck lint test --filter=@n8n/frontend-module-type-availability-policies
15
+ ```
16
+
17
+ Use turbo and not `pnpm --filter`: this package reads its platform dependencies from source,
18
+ and on a cold tree turbo builds them first.
19
+
20
+ `packages/@n8n/module-cli/frontend-module-guide.md` holds the descriptor contract, the
21
+ registration points, the import boundaries and the setup a module needs to render UI.
package/biome.jsonc ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "../../../../node_modules/@biomejs/biome/configuration_schema.json",
3
+ "extends": ["../../../../biome.jsonc"]
4
+ }
@@ -0,0 +1,4 @@
1
+ import { defineConfig } from 'eslint/config';
2
+ import { frontendConfig } from '@n8n/eslint-config/frontend';
3
+
4
+ export default defineConfig(frontendConfig);
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@n8n/frontend-module-type-availability-policies",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "src/index.ts",
6
+ "exports": {
7
+ ".": "./src/index.ts"
8
+ },
9
+ "dependencies": {
10
+ "@n8n/frontend-module-sdk": "0.10.0"
11
+ },
12
+ "devDependencies": {
13
+ "@n8n/eslint-config": "0.0.1",
14
+ "@n8n/frontend-test-utils": "0.1.0",
15
+ "@n8n/frontend-vite-config": "0.1.0",
16
+ "@n8n/playwright-janitor": "0.1.0",
17
+ "@n8n/typescript-config": "1.12.0",
18
+ "@n8n/vitest-config": "1.22.0",
19
+ "@testing-library/jest-dom": "^6.6.3",
20
+ "@testing-library/vue": "^8.1.0",
21
+ "@vitejs/plugin-vue": "^6.0.8",
22
+ "eslint": "9.29.0",
23
+ "typescript": "6.0.2",
24
+ "unplugin-icons": "^23.0.1",
25
+ "vite": "^8.0.2",
26
+ "vitest": "^4.1.9",
27
+ "vue-tsc": "^2.2.8"
28
+ },
29
+ "license": "LicenseRef-n8n-sustainable-use",
30
+ "scripts": {
31
+ "clean": "rimraf .turbo",
32
+ "typecheck": "vue-tsc --noEmit",
33
+ "test": "vitest run",
34
+ "test:changed": "janitor test-scoped",
35
+ "test:dev": "vitest",
36
+ "lint": "eslint src --quiet",
37
+ "lint:fix": "eslint src --fix",
38
+ "format": "biome format --write . && prettier --write . --ignore-path ../../../../.prettierignore",
39
+ "format:check": "biome ci . && prettier --check . --ignore-path ../../../../.prettierignore"
40
+ }
41
+ }
@@ -0,0 +1,4 @@
1
+ // The shared frontend test harness: the jsdom environment, english messages, and a fresh pinia
2
+ // per test. It lives in `@n8n/frontend-test-utils` rather than in `@n8n/vitest-config`, because
3
+ // `@n8n/i18n` devDepends on the latter and importing i18n there closes a cycle in the turbo graph.
4
+ import '@n8n/frontend-test-utils/setup';
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { TypeAvailabilityPoliciesModule } from './type-availability-policies.module';
@@ -0,0 +1,2 @@
1
+ /** Must stay the same as the backend module id: `settings.activeModules` is keyed by it. */
2
+ export const TYPE_AVAILABILITY_POLICIES_MODULE_ID = 'type-availability-policies';
@@ -0,0 +1,9 @@
1
+ import { TypeAvailabilityPoliciesModule } from './type-availability-policies.module';
2
+
3
+ describe('TypeAvailabilityPoliciesModule', () => {
4
+ it('keeps the id the backend module publishes in `activeModules`', () => {
5
+ // A mismatch is silent: `isModuleActive` compares strings, so the module would
6
+ // never report active. The twin is `packages/cli/src/modules/type-availability-policies`.
7
+ expect(TypeAvailabilityPoliciesModule.id).toBe('type-availability-policies');
8
+ });
9
+ });
@@ -0,0 +1,11 @@
1
+ import { defineFrontendModule } from '@n8n/frontend-module-sdk';
2
+
3
+ import { TYPE_AVAILABILITY_POLICIES_MODULE_ID } from './type-availability-policies.constants';
4
+
5
+ /** Keep this file import-light: the shell runs every descriptor body before Pinia starts. */
6
+ export const TypeAvailabilityPoliciesModule = defineFrontendModule({
7
+ id: TYPE_AVAILABILITY_POLICIES_MODULE_ID,
8
+ name: 'Type Availability Policies',
9
+ description: 'Reports which node types a project can use, and why a type is unavailable',
10
+ icon: 'shield',
11
+ });
package/vite.config.ts ADDED
@@ -0,0 +1,23 @@
1
+ import vue from '@vitejs/plugin-vue';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { resolve } from 'node:path';
4
+ import { defineConfig, mergeConfig } from 'vite';
5
+ import { frontendAliases } from '@n8n/frontend-vite-config';
6
+ import { vitestConfig } from '@n8n/vitest-config/frontend';
7
+
8
+ const packageDir = fileURLToPath(new URL('.', import.meta.url));
9
+ const packagesDir = resolve(packageDir, '..', '..', '..');
10
+
11
+ export default mergeConfig(
12
+ defineConfig({
13
+ plugins: [vue()],
14
+ resolve: {
15
+ // The same platform mapping the editor-ui dev server uses, so a test resolves
16
+ // `@n8n/stores/...` from source rather than from a stale `dist` — the two disagreeing is
17
+ // what put 1,111 specifiers on the wrong side of the src/dist line. Sibling modules are
18
+ // deliberately absent: nothing here should make a cross-module import resolve.
19
+ alias: frontendAliases(packagesDir),
20
+ },
21
+ }),
22
+ vitestConfig,
23
+ );