create-erxes 0.1.25 → 0.1.27
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.js +1 -1
- package/dist/templates/base/.github/workflows/mutation.yml +45 -0
- package/dist/templates/base/api/AGENTS.md +6 -3
- package/dist/templates/base/api/package.json +2 -2
- package/dist/templates/base/api/src/__tests__/server.test.ts +25 -1
- package/dist/templates/base/api/src/__tests__/startup.test.ts +82 -0
- package/dist/templates/base/api/src/db/client.ts +7 -0
- package/dist/templates/base/api/src/logger.ts +10 -2
- package/dist/templates/base/api/src/main.ts +31 -10
- package/dist/templates/base/api/src/server.ts +3 -2
- package/dist/templates/base/api/src/test/core-calls.sql +28 -2
- package/dist/templates/base/api/src/test/core-functions.sql +4 -2
- package/dist/templates/base/tools/check-rls.sh +1 -1
- package/dist/templates/base/ui/AGENTS.md +7 -4
- package/dist/templates/base/ui/package.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { mkdir, readFile, readdir, symlink, writeFile } from "node:fs/promises";
|
|
|
9
9
|
import { homedir } from "node:os";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
// package.json
|
|
12
|
-
var version = "0.1.
|
|
12
|
+
var version = "0.1.27";
|
|
13
13
|
// src/existing-plugins.ts
|
|
14
14
|
/** The old erxes plugins a new-core plugin can be migrated from (`backend/plugins/<name>_api`). */
|
|
15
15
|
const OLD_PLUGINS = [
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Whether the tests catch changes to the code they run over, with core's shared mutation testing
|
|
2
|
+
# (erxes/erxes .github/workflows/mutation.yml). Pull requests get a comment; the branch runs open
|
|
3
|
+
# one `false-test` issue per folder and close it once every change is caught. It never blocks.
|
|
4
|
+
# Twice a week, so the last results stay cached: GitHub drops a cache nobody read for 7 days.
|
|
5
|
+
# 18:17 UTC is 02:17 in Ulaanbaatar, when the org's shared job slots are free. Give each plugin
|
|
6
|
+
# its own hour and minute between 17:00 and 21:59 UTC, so they don't all start at once.
|
|
7
|
+
name: Mutation tests
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
pull_request:
|
|
11
|
+
paths: ['api/src/**', 'ui/src/**']
|
|
12
|
+
schedule:
|
|
13
|
+
- cron: '17 18 * * 0,3'
|
|
14
|
+
workflow_dispatch:
|
|
15
|
+
|
|
16
|
+
concurrency:
|
|
17
|
+
group: mutation-${{ github.ref }}
|
|
18
|
+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: read
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
mutation:
|
|
25
|
+
uses: erxes/erxes/.github/workflows/mutation.yml@postgre
|
|
26
|
+
permissions:
|
|
27
|
+
contents: read
|
|
28
|
+
issues: write
|
|
29
|
+
pull-requests: write
|
|
30
|
+
with:
|
|
31
|
+
# Left out: tests and their helpers, table declarations and migrations, start-up code no test
|
|
32
|
+
# runs, and .tsx screens, which only a browser checks.
|
|
33
|
+
mutate: |
|
|
34
|
+
api/src/**/*.ts
|
|
35
|
+
ui/src/**/*.ts
|
|
36
|
+
!**/*.test.ts
|
|
37
|
+
!**/*.d.ts
|
|
38
|
+
!**/__tests__/**
|
|
39
|
+
!api/src/test/**
|
|
40
|
+
!api/src/db/schema.ts
|
|
41
|
+
!api/src/db/schema/**
|
|
42
|
+
!api/src/db/migrate.ts
|
|
43
|
+
!api/src/migrate.ts
|
|
44
|
+
!api/src/main.ts
|
|
45
|
+
!api/src/telemetry.ts
|
|
@@ -46,9 +46,12 @@ Node 26 runs the TypeScript directly; imports carry `.ts` and `#/` is `src/`.
|
|
|
46
46
|
fills the list from `GET /api/automations/records/<recordType>?parent=<value>`,
|
|
47
47
|
sent with the member's session token like `/api/rpc/*`; answer
|
|
48
48
|
`[{ value, label }]` with the records that member may see. Never ask a member
|
|
49
|
-
to type an id. Name what the action answers in `outputs`
|
|
50
|
-
(`[{ key: 'dealId', label: 'Deal', type: 'text' }]`) and
|
|
51
|
-
|
|
49
|
+
to type an id; `multiple: true` takes a list. Name what the action answers in `outputs`
|
|
50
|
+
(`[{ key: 'dealId', label: 'Deal', type: 'text', recordType: 'deal' }]`), and for each
|
|
51
|
+
event the record it is about (`record: 'Order'`) and what its payload holds in `fields`:
|
|
52
|
+
"Insert data" lists them as "The order", and a `recordType` puts the value in that
|
|
53
|
+
type's pickers ("Order created: Order"). `core.registerManifest` answers `warnings`
|
|
54
|
+
for what is missing; `src/main.ts` logs them.
|
|
52
55
|
- A fact the plugin computes about a customer or company (total spent, last
|
|
53
56
|
order) is a field in the manifest's `fields` (`code`, `contentType`, `label`,
|
|
54
57
|
`type`: number, date, text, select or multiselect). Core shows it read-only
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"db:check": "drizzle-kit check"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@erxes/core-contract": "0.1.0-v2.
|
|
25
|
-
"@erxes/plugin-sdk": "0.1.0-v2.
|
|
24
|
+
"@erxes/core-contract": "0.1.0-v2.28",
|
|
25
|
+
"@erxes/plugin-sdk": "0.1.0-v2.27",
|
|
26
26
|
"@opentelemetry/instrumentation-express": "^0.73.0",
|
|
27
27
|
"@opentelemetry/instrumentation-http": "^0.301.1",
|
|
28
28
|
"@opentelemetry/instrumentation-pg": "^0.78.0",
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { once } from 'node:events';
|
|
2
|
+
import { pino } from 'pino';
|
|
3
|
+
import { afterAll, beforeAll, describe, expect, it, vi } from 'vite-plus/test';
|
|
4
|
+
import { loggerOptions } from '#/logger.ts';
|
|
2
5
|
import { createApp } from '#/server.ts';
|
|
3
6
|
|
|
4
7
|
let base = '';
|
|
@@ -45,6 +48,27 @@ describe('server', () => {
|
|
|
45
48
|
expect(response.status).toBe(401);
|
|
46
49
|
});
|
|
47
50
|
|
|
51
|
+
it('keeps credentials out of its request logs', async () => {
|
|
52
|
+
const lines: string[] = [];
|
|
53
|
+
const log = pino({ ...loggerOptions, level: 'info' }, { write: (line) => lines.push(line) });
|
|
54
|
+
const logged = createApp(log).listen(0);
|
|
55
|
+
|
|
56
|
+
await once(logged, 'listening');
|
|
57
|
+
|
|
58
|
+
const address = logged.address();
|
|
59
|
+
|
|
60
|
+
if (!address || typeof address === 'string') throw new Error('not listening on a port');
|
|
61
|
+
|
|
62
|
+
await fetch(`http://127.0.0.1:${address.port}/health`, {
|
|
63
|
+
headers: { authorization: 'Bearer session-secret', cookie: 'sid=cookie-secret' },
|
|
64
|
+
});
|
|
65
|
+
logged.close();
|
|
66
|
+
|
|
67
|
+
await vi.waitFor(() => expect(lines.join('')).toContain('request completed'));
|
|
68
|
+
expect(lines.join('')).not.toMatch(/session-secret|cookie-secret/);
|
|
69
|
+
expect(lines.join('')).toContain('"authorization":"[Redacted]"');
|
|
70
|
+
});
|
|
71
|
+
|
|
48
72
|
it('lets web call it from any organisation address', async () => {
|
|
49
73
|
const response = await fetch(`${base}/api/rpc/items/list`, {
|
|
50
74
|
method: 'OPTIONS',
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { once } from 'node:events';
|
|
3
|
+
import { Client } from 'pg';
|
|
4
|
+
import { describe, expect, it, vi } from 'vite-plus/test';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { config } from '#/config.ts';
|
|
7
|
+
import { pool } from '#/db/client.ts';
|
|
8
|
+
import { logger } from '#/logger.ts';
|
|
9
|
+
|
|
10
|
+
const Line = z.object({
|
|
11
|
+
level: z.number(),
|
|
12
|
+
msg: z.string(),
|
|
13
|
+
err: z.object({ message: z.string() }).optional(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/** The log lines of `node src/main.ts` against the test database, and its exit code. */
|
|
17
|
+
const startApi = async () => {
|
|
18
|
+
const child = spawn(process.execPath, ['src/main.ts'], {
|
|
19
|
+
cwd: new URL('../..', import.meta.url),
|
|
20
|
+
// CORE_URL is a port nothing listens on (vite.config.ts).
|
|
21
|
+
env: {
|
|
22
|
+
DATA_URL: config.dataUrl,
|
|
23
|
+
CORE_URL: config.coreUrl,
|
|
24
|
+
PLUGIN_SECRET: config.pluginSecret,
|
|
25
|
+
LOG_LEVEL: 'info',
|
|
26
|
+
},
|
|
27
|
+
stdio: ['ignore', 'pipe', 'inherit'],
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
let output = '';
|
|
31
|
+
|
|
32
|
+
child.stdout.on('data', (chunk: Buffer) => {
|
|
33
|
+
output += chunk.toString();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const [code] = z
|
|
37
|
+
.tuple([z.number().nullable()])
|
|
38
|
+
.rest(z.unknown())
|
|
39
|
+
.parse(await once(child, 'close'));
|
|
40
|
+
|
|
41
|
+
const lines = output
|
|
42
|
+
.split('\n')
|
|
43
|
+
.filter((line) => line.startsWith('{'))
|
|
44
|
+
.map((line) => Line.parse(JSON.parse(line)));
|
|
45
|
+
|
|
46
|
+
return { code, lines };
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
describe('startup', () => {
|
|
50
|
+
// Starts a Node process, which migrates and asks core twice.
|
|
51
|
+
it(
|
|
52
|
+
'logs why and exits with 1 when core does not take the manifest',
|
|
53
|
+
{ timeout: 30_000 },
|
|
54
|
+
async () => {
|
|
55
|
+
const { code, lines } = await startApi();
|
|
56
|
+
const fatal = lines.find((line) => line.level === 60);
|
|
57
|
+
|
|
58
|
+
expect(code).toBe(1);
|
|
59
|
+
expect(fatal?.msg).toBe('failed to start');
|
|
60
|
+
expect(fatal?.err?.message).toContain(
|
|
61
|
+
'did not take the manifest: check CORE_URL and PLUGIN_SECRET',
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
it('logs a broken idle database connection and keeps running', async () => {
|
|
67
|
+
const failed = vi.spyOn(logger, 'error');
|
|
68
|
+
const anError: unknown = expect.any(Error);
|
|
69
|
+
const { rows } = await pool.query<{ pid: number }>('select pg_backend_pid() as pid');
|
|
70
|
+
const admin = new Client({ connectionString: config.dataUrl });
|
|
71
|
+
|
|
72
|
+
// Postgres ends the pool's idle connection, as on a restart or failover.
|
|
73
|
+
await admin.connect();
|
|
74
|
+
await admin.query('select pg_terminate_backend($1)', [rows[0]?.pid]);
|
|
75
|
+
await admin.end();
|
|
76
|
+
|
|
77
|
+
await vi.waitFor(() =>
|
|
78
|
+
expect(failed).toHaveBeenCalledWith({ err: anError }, 'idle database connection failed'),
|
|
79
|
+
);
|
|
80
|
+
expect((await pool.query<{ one: number }>('select 1 as one')).rows).toEqual([{ one: 1 }]);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -2,10 +2,17 @@ import { DrizzleQueryError, sql } from 'drizzle-orm';
|
|
|
2
2
|
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
3
3
|
import { DatabaseError, Pool } from 'pg';
|
|
4
4
|
import { config, PLUGIN } from '#/config.ts';
|
|
5
|
+
import { logger } from '#/logger.ts';
|
|
5
6
|
import * as schema from './schema.ts';
|
|
6
7
|
|
|
7
8
|
export const pool = new Pool({ connectionString: config.dataUrl, application_name: PLUGIN });
|
|
8
9
|
|
|
10
|
+
// An idle connection that breaks (Postgres restarted, a failover) is dropped and replaced. Without
|
|
11
|
+
// a listener, its error would end the process.
|
|
12
|
+
pool.on('error', (error) => {
|
|
13
|
+
logger.error({ err: error }, 'idle database connection failed');
|
|
14
|
+
});
|
|
15
|
+
|
|
9
16
|
export const db = drizzle({ client: pool, schema, casing: 'snake_case' });
|
|
10
17
|
|
|
11
18
|
export type Tx = Parameters<Parameters<typeof db.transaction>[0]>[0];
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LOG_REDACT } from '@erxes/plugin-sdk/logger';
|
|
2
|
+
import { pino, type LoggerOptions } from 'pino';
|
|
2
3
|
import { config, PLUGIN } from '#/config.ts';
|
|
3
4
|
|
|
5
|
+
/** Credentials and secret fields never reach a line: the same list core's logger redacts. */
|
|
6
|
+
export const loggerOptions: LoggerOptions = {
|
|
7
|
+
name: PLUGIN,
|
|
8
|
+
level: config.logLevel,
|
|
9
|
+
redact: LOG_REDACT,
|
|
10
|
+
};
|
|
11
|
+
|
|
4
12
|
/** JSON logs on stdout. With OpenTelemetry on, each line carries its trace id. */
|
|
5
|
-
export const logger = pino(
|
|
13
|
+
export const logger = pino(loggerOptions);
|
|
@@ -5,19 +5,40 @@ import { runMigrations } from '#/db/migrate.ts';
|
|
|
5
5
|
import { logger } from '#/logger.ts';
|
|
6
6
|
import { createApp } from '#/server.ts';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/** Core installs it automatically in development and self-hosted (PLUGINS_AUTO_INSTALL). */
|
|
9
|
+
const register = async () => {
|
|
10
|
+
try {
|
|
11
|
+
return await core.registerManifest(manifest);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
`core at ${config.coreUrl} did not take the manifest: check CORE_URL and PLUGIN_SECRET, and that core is up`,
|
|
15
|
+
{ cause: error },
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
9
19
|
|
|
10
|
-
|
|
20
|
+
const start = async () => {
|
|
21
|
+
const applied = await runMigrations();
|
|
11
22
|
|
|
12
|
-
|
|
13
|
-
await core.registerManifest(manifest);
|
|
23
|
+
if (applied.length) logger.info({ applied }, 'applied migrations');
|
|
14
24
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
});
|
|
25
|
+
const { warnings } = await register();
|
|
26
|
+
|
|
27
|
+
for (const warning of warnings) logger.warn({ warning }, 'manifest');
|
|
28
|
+
|
|
29
|
+
const server = createApp().listen(config.port, () => {
|
|
30
|
+
logger.info(`API on ${config.publicUrl}, UI entry ${manifest.ui.entry}`);
|
|
31
|
+
});
|
|
18
32
|
|
|
19
|
-
const stop = () => server.close(() => void pool.end());
|
|
33
|
+
const stop = () => server.close(() => void pool.end());
|
|
20
34
|
|
|
21
|
-
process.once('SIGTERM', stop);
|
|
35
|
+
process.once('SIGTERM', stop);
|
|
22
36
|
|
|
23
|
-
process.once('SIGINT', stop);
|
|
37
|
+
process.once('SIGINT', stop);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Like core: a failed start logs why and exits, and the container restarts it.
|
|
41
|
+
start().catch((error: unknown) => {
|
|
42
|
+
logger.fatal({ err: error }, 'failed to start');
|
|
43
|
+
process.exit(1);
|
|
44
|
+
});
|
|
@@ -51,11 +51,12 @@ const memberOf = async (authorization: string | undefined) => {
|
|
|
51
51
|
.catch(() => null);
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
/** The API; requests log to `log` (tests pass their own). */
|
|
55
|
+
export const createApp = (log = logger) => {
|
|
55
56
|
const app = express();
|
|
56
57
|
|
|
57
58
|
app.disable('x-powered-by');
|
|
58
|
-
app.use(pinoHttp({ logger }));
|
|
59
|
+
app.use(pinoHttp({ logger: log }));
|
|
59
60
|
// The plugin UI calls this API from web, at whatever address the organisation
|
|
60
61
|
// uses (acme.app.erxes.io, its own domain). Any origin may: access is the
|
|
61
62
|
// Bearer session token core issues, never a cookie, so CORS guards nothing here.
|
|
@@ -55,20 +55,46 @@ CREATE OR REPLACE FUNCTION core_record_audit(
|
|
|
55
55
|
p_ip text DEFAULT NULL,
|
|
56
56
|
p_user_agent text DEFAULT NULL
|
|
57
57
|
) RETURNS text
|
|
58
|
-
|
|
58
|
+
-- As 0026 set it: plugin roles reach core only through this function.
|
|
59
|
+
LANGUAGE plpgsql SECURITY DEFINER SET search_path = public, pg_temp AS $$
|
|
59
60
|
DECLARE
|
|
60
61
|
v_id text := replace(gen_random_uuid()::text, '-', '');
|
|
62
|
+
v_changes jsonb := NULL;
|
|
63
|
+
v_other jsonb := '{}'::jsonb;
|
|
64
|
+
v_metadata jsonb := p_metadata;
|
|
61
65
|
BEGIN
|
|
62
66
|
IF p_action NOT LIKE p_source || '.%' THEN
|
|
63
67
|
RAISE EXCEPTION 'core_record_audit: the action must start with "%."', p_source;
|
|
64
68
|
END IF;
|
|
69
|
+
|
|
70
|
+
IF p_changes IS NOT NULL AND jsonb_typeof(p_changes) = 'object' THEN
|
|
71
|
+
SELECT
|
|
72
|
+
jsonb_object_agg(key, value) FILTER (
|
|
73
|
+
WHERE jsonb_typeof(value) = 'array' AND jsonb_array_length(value) = 2
|
|
74
|
+
),
|
|
75
|
+
coalesce(jsonb_object_agg(key, value) FILTER (
|
|
76
|
+
WHERE NOT (jsonb_typeof(value) = 'array' AND jsonb_array_length(value) = 2)
|
|
77
|
+
), '{}'::jsonb)
|
|
78
|
+
INTO v_changes, v_other
|
|
79
|
+
FROM jsonb_each(p_changes);
|
|
80
|
+
ELSIF p_changes IS NOT NULL AND jsonb_typeof(p_changes) <> 'null' THEN
|
|
81
|
+
v_other := jsonb_build_object('changes', p_changes);
|
|
82
|
+
END IF;
|
|
83
|
+
|
|
84
|
+
IF v_other <> '{}'::jsonb THEN
|
|
85
|
+
v_metadata := v_other || CASE
|
|
86
|
+
WHEN jsonb_typeof(p_metadata) = 'object' THEN p_metadata
|
|
87
|
+
ELSE '{}'::jsonb
|
|
88
|
+
END;
|
|
89
|
+
END IF;
|
|
90
|
+
|
|
65
91
|
PERFORM core_enter_org(p_org_id, p_source);
|
|
66
92
|
INSERT INTO core_audit_logs (
|
|
67
93
|
id, org_id, source, actor_type, actor_id, action, target_type, target_id, target_label, changes, metadata, ip, user_agent
|
|
68
94
|
) VALUES (
|
|
69
95
|
v_id, p_org_id, p_source, CASE WHEN p_actor_user_id IS NULL THEN 'plugin' ELSE 'user' END,
|
|
70
96
|
coalesce(p_actor_user_id, p_source), p_action, p_target_type, p_target_id, p_target_label,
|
|
71
|
-
|
|
97
|
+
v_changes, v_metadata, p_ip, p_user_agent
|
|
72
98
|
);
|
|
73
99
|
RETURN v_id;
|
|
74
100
|
END $$;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
-- Core's tenant functions, which plugin migrations
|
|
2
|
-
-- packages/db/drizzle
|
|
1
|
+
-- Core's extensions and tenant functions, which plugin migrations use, as erxes
|
|
2
|
+
-- packages/db/drizzle creates them. Tests and tools/check-rls.sh install them
|
|
3
3
|
-- in their throwaway databases.
|
|
4
|
+
CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
|
5
|
+
CREATE EXTENSION IF NOT EXISTS btree_gist;
|
|
4
6
|
CREATE OR REPLACE FUNCTION core_tenant_visible(p_org_id text) RETURNS boolean
|
|
5
7
|
LANGUAGE sql STABLE AS $$
|
|
6
8
|
SELECT p_org_id = current_setting('app.org_id', true)
|
|
@@ -13,7 +13,7 @@ url=$(node -e 'const u = new URL(process.argv[1]); u.pathname = `/${process.argv
|
|
|
13
13
|
psql "$server" -qX -v ON_ERROR_STOP=1 -c "CREATE DATABASE $name"
|
|
14
14
|
trap 'psql "$server" -qX -c "DROP DATABASE IF EXISTS $name WITH (FORCE)"' EXIT
|
|
15
15
|
|
|
16
|
-
# Core's tenant functions, which the migrations
|
|
16
|
+
# Core's extensions and tenant functions, which the migrations use.
|
|
17
17
|
psql "$url" -qX -v ON_ERROR_STOP=1 -f api/src/test/core-functions.sql
|
|
18
18
|
# Only DATA_URL matters to a migration; the others satisfy config.ts.
|
|
19
19
|
DATA_URL="$url" CORE_URL=http://127.0.0.1:9 PLUGIN_SECRET=rls-check-only-secret-xxxxxxxxxxxx \
|
|
@@ -63,11 +63,14 @@ and renders `./__id__` (the `__Pascal__` export) under `/__id__/*`.
|
|
|
63
63
|
record; its `listPath` is the list a deleted or closed record goes back to, when
|
|
64
64
|
that isn't the plugin's first page. A plugin's records of other records' customers are `relationTabs`
|
|
65
65
|
(the `ui-patterns` skill). A settings page is a route of the plugin's
|
|
66
|
-
(`/__id__/settings/<page>`) that `CONFIG.settings` lists (`{ path, label, icon }`)
|
|
67
|
-
|
|
66
|
+
(`/__id__/settings/<page>`) that `CONFIG.settings` lists (`{ path, label, icon }`),
|
|
67
|
+
drawn in the plugin's own layout and opened from an `AppLayoutFooterLink` in the
|
|
68
|
+
plugin sidebar's `footer`; a plugin with several pages lists them in its own
|
|
69
|
+
settings. Core's settings show one link per plugin, to its first page. Custom fields
|
|
68
70
|
on a record type are its `properties` (`type: '__id__.item'`, `values(id)`,
|
|
69
|
-
`save(id, patch)`): core keeps the fields and draws
|
|
70
|
-
|
|
71
|
+
`save(id, patch)`): core keeps the fields and draws the Properties tab and their
|
|
72
|
+
settings page, `/settings/properties/__id__.item`, which the plugin's own settings
|
|
73
|
+
link when it has any; the API keeps the values in a jsonb column and checks a patch
|
|
71
74
|
with core's `fields.check` before saving. Tiles for core's
|
|
72
75
|
home dashboard are `CONFIG.dashboardWidgets`: `name`, `title`, `icon`, `preview`,
|
|
73
76
|
`size` and a `lazy` `component`, which core draws as the tile's body under the
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"build": "rsbuild build"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@erxes/core-contract": "0.1.0-v2.
|
|
11
|
+
"@erxes/core-contract": "0.1.0-v2.28",
|
|
12
12
|
"@orpc/client": "1.16.2",
|
|
13
13
|
"@orpc/tanstack-query": "1.16.2",
|
|
14
14
|
"@tabler/icons-react": "3.34.0",
|
|
15
15
|
"@tanstack/react-query": "^5.107.1",
|
|
16
|
-
"erxes-ui": "npm:@erxes/ui@4.0.0-v2.
|
|
16
|
+
"erxes-ui": "npm:@erxes/ui@4.0.0-v2.25",
|
|
17
17
|
"jotai": "^3.0.2",
|
|
18
18
|
"nuqs": "^2.10.3",
|
|
19
19
|
"react": "19.3.1",
|