create-erxes 0.1.23 → 0.1.26

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 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.23";
12
+ var version = "0.1.26";
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
@@ -54,7 +54,8 @@ without line-by-line review.
54
54
  through `@erxes/core-contract/client` with the member's session. Neither reads
55
55
  `core_*` tables or imports core's app code.
56
56
  - Members are signed in by core: the UI sends a session token, the API checks it
57
- with `verifyPluginSession`. The same procedures are REST at `/api/v1` for
57
+ with `verifyPluginSession`; another plugin reading for an organisation sends a
58
+ call token, checked with `verifyPluginCall`. The same procedures are REST at `/api/v1` for
58
59
  scripts, which get the token from core with an API key; `/api/openapi/member.json`
59
60
  documents them (`pluginOpenApi`), and core's Settings › Developer › API reference
60
61
  shows it. Routes for employees in the plugin's own app, customers or a website get
@@ -10,9 +10,14 @@ Node 26 runs the TypeScript directly; imports carry `.ts` and `#/` is `src/`.
10
10
  owner's approval, so ask for one only when a procedure needs it. Owners and
11
11
  admins hold every permission; a permission set with `defaultRoles: ['member']`
12
12
  is what members get on install, and owners change it from there.
13
- - `src/server.ts` verifies the session token on `/api/rpc/*` and hands
14
- procedures `context.member` (`PluginMember`: `orgId`, `userId`, `can()`,
15
- `canChange()`).
13
+ - `src/server.ts` verifies the session token, or another plugin's call token
14
+ (`verifyPluginCall`), on `/api/rpc/*` and `/api/v1/*` and hands procedures
15
+ `context.member` (`PluginMember`: `orgId`, `userId`, `can()`, `canChange()`).
16
+ A plugin call's `userId` is `plugin:<name>` and its permissions are the reads
17
+ the owner approved, so `reads(...)` serves it unchanged.
18
+ - To read another plugin's API, name it in the manifest's `pluginReads`
19
+ (`{ plugin, permissions, reason }`, the owner approves it) and call
20
+ `core.fetchPlugin(orgId, plugin, '/v1/...')`, outside `context.tx`.
16
21
  - `src/orpc.ts`: build every procedure on `reads(action)` or `writes(action)`.
17
22
  Both check the permission and run the handler in `withOrg(member.orgId)`, so
18
23
  row-level security shows `context.tx` one organisation's rows. Queries carry
@@ -41,13 +46,17 @@ Node 26 runs the TypeScript directly; imports carry `.ts` and `#/` is `src/`.
41
46
  fills the list from `GET /api/automations/records/<recordType>?parent=<value>`,
42
47
  sent with the member's session token like `/api/rpc/*`; answer
43
48
  `[{ value, label }]` with the records that member may see. Never ask a member
44
- to type an id. Name what the action answers in `outputs`
45
- (`[{ key: 'dealId', label: 'Deal', type: 'text' }]`) and what an event's
46
- payload holds in its `fields`: later steps insert them from "Insert data".
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.
47
55
  - A fact the plugin computes about a customer or company (total spent, last
48
56
  order) is a field in the manifest's `fields` (`code`, `contentType`, `label`,
49
57
  `type`: number, date, text, select or multiselect). Core shows it read-only
50
- and members filter and save views by it. Write values with
58
+ and members filter and save views by it; `filterable: false` keeps it a
59
+ column and sort key only, when a relation filters by the same records. Write values with
51
60
  `core.forOrg(orgId).fields.setPluginValues({ contentType, values })` (scope
52
61
  `fields:write`, up to 500, `value: null` clears) after the change commits; it
53
62
  adds nothing to the timeline and sends no event. Members see the fields only
@@ -57,7 +66,9 @@ Node 26 runs the TypeScript directly; imports carry `.ts` and `#/` is `src/`.
57
66
  - Records that belong to customers or companies (deals, orders, tickets) are a
58
67
  relation in the manifest's `relations` (`key`, `contentType`, `label`,
59
68
  `view`, `permission?`, `fields`: `key`, `label`, `type` text, number, date,
60
- boolean, select or member, `options`, `array`, `money`). Members then filter
69
+ boolean, select, member or product, `options`, `array`, `money`, and
70
+ `measures`: which of `sum`, `avg`, `min`, `max` the filter lists for a
71
+ number or date field, all when absent). Members then filter
61
72
  contacts by them, live, with no values to sync: "Deals: count ≥ 3 where
62
73
  Stage is Won", "Deals: Amount (total) > 1,000,000", "Deals: Closed (latest)
63
74
  more than 60 days ago". Keep a view `<plugin>_*` in a migration, owned by the
@@ -21,8 +21,8 @@
21
21
  "db:check": "drizzle-kit check"
22
22
  },
23
23
  "dependencies": {
24
- "@erxes/core-contract": "0.1.0-v2.23",
25
- "@erxes/plugin-sdk": "0.1.0-v2.22",
24
+ "@erxes/core-contract": "0.1.0-v2.27",
25
+ "@erxes/plugin-sdk": "0.1.0-v2.26",
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 { afterAll, beforeAll, describe, expect, it } from 'vite-plus/test';
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 { pino } from 'pino';
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({ name: PLUGIN, level: config.logLevel });
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
- const applied = await runMigrations();
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
- if (applied.length) logger.info({ applied }, 'applied migrations');
20
+ const start = async () => {
21
+ const applied = await runMigrations();
11
22
 
12
- // Core installs it automatically in development and self-hosted (PLUGINS_AUTO_INSTALL).
13
- await core.registerManifest(manifest);
23
+ if (applied.length) logger.info({ applied }, 'applied migrations');
14
24
 
15
- const server = createApp().listen(config.port, () => {
16
- logger.info(`API on ${config.publicUrl}, UI entry ${manifest.ui.entry}`);
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
+ });
@@ -1,4 +1,4 @@
1
- import { bearerOf, verifyCoreJob, verifyPluginSession } from '@erxes/plugin-sdk';
1
+ import { bearerOf, verifyCoreJob, verifyPluginCall, verifyPluginSession } from '@erxes/plugin-sdk';
2
2
  import { pluginOpenApi } from '@erxes/plugin-sdk/openapi';
3
3
  import { OpenAPIHandler } from '@orpc/openapi/node';
4
4
  import { onError, ORPCError } from '@orpc/server';
@@ -34,20 +34,29 @@ const memberDoc = pluginOpenApi(router, {
34
34
  prefix: '/v1',
35
35
  });
36
36
 
37
- /** The member behind a request from the plugin UI, or null without a valid session token. */
37
+ /**
38
+ * Who is calling: the member behind a request from the plugin UI (a session token), or another
39
+ * plugin reading for an organisation (a plugin call token, `userId` `plugin:<name>`, with the
40
+ * permissions the owner approved for it). Null without a valid token of either kind.
41
+ */
38
42
  const memberOf = async (authorization: string | undefined) => {
39
43
  const token = bearerOf(authorization);
40
44
 
41
45
  if (!token) return null;
42
46
 
43
- return verifyPluginSession(token, { coreUrl: config.coreUrl, plugin: PLUGIN }).catch(() => null);
47
+ const options = { coreUrl: config.coreUrl, plugin: PLUGIN };
48
+
49
+ return verifyPluginSession(token, options)
50
+ .catch(() => verifyPluginCall(token, options))
51
+ .catch(() => null);
44
52
  };
45
53
 
46
- export const createApp = () => {
54
+ /** The API; requests log to `log` (tests pass their own). */
55
+ export const createApp = (log = logger) => {
47
56
  const app = express();
48
57
 
49
58
  app.disable('x-powered-by');
50
- app.use(pinoHttp({ logger }));
59
+ app.use(pinoHttp({ logger: log }));
51
60
  // The plugin UI calls this API from web, at whatever address the organisation
52
61
  // uses (acme.app.erxes.io, its own domain). Any origin may: access is the
53
62
  // Bearer session token core issues, never a cookie, so CORS guards nothing here.
@@ -66,7 +75,8 @@ export const createApp = () => {
66
75
  });
67
76
 
68
77
  // A 5-minute session token core issued for this member and plugin: erxes-ui's pluginFetch
69
- // adds it, and a script gets one from core with an API key.
78
+ // adds it, and a script gets one from core with an API key. Another plugin's
79
+ // `core.fetchPlugin` sends a plugin call token, which `reads(...)` checks the same way.
70
80
  for (const [prefix, handler] of [
71
81
  ['/api/rpc', rpc],
72
82
  ['/api/v1', rest],
@@ -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
- LANGUAGE plpgsql AS $$
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
- p_changes, p_metadata, p_ip, p_user_agent
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 call, as erxes
2
- -- packages/db/drizzle defines them. Tests and tools/check-rls.sh install them
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 call.
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
- core links it from its settings sidebar, under the plugin's name. Custom fields
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 their settings page and the
70
- Properties tab; the API keeps the values in a jsonb column and checks a patch
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.23",
11
+ "@erxes/core-contract": "0.1.0-v2.27",
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.21",
16
+ "erxes-ui": "npm:@erxes/ui@4.0.0-v2.24",
17
17
  "jotai": "^3.0.2",
18
18
  "nuqs": "^2.10.3",
19
19
  "react": "19.3.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-erxes",
3
- "version": "0.1.23",
3
+ "version": "0.1.26",
4
4
  "private": false,
5
5
  "description": "Create an erxes plugin for the new core, or migrate an old erxes plugin onto it: pnpm create erxes",
6
6
  "license": "MIT",