create-erxes 0.1.11 → 0.1.12

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.11";
12
+ var version = "0.1.12";
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 = [
@@ -54,8 +54,9 @@ 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`. There is no public route yet, because core can't
58
- tell a public request's organisation.
57
+ with `verifyPluginSession`. A caller outside erxes (a webhook) reaches a path
58
+ the manifest's `publicPaths` lists through core, which names the organisation:
59
+ check it with `verifyPublicCall` (`@erxes/plugin-sdk`'s overview has the route).
59
60
  - Skills in `.agents/skills/`: `endpoint` for a procedure, `schema-change` for a
60
61
  table or column, `ui-patterns` for any page (lists, filters, forms, record
61
62
  details look like core's), `verify` before calling a change done.__migrationSkill__
@@ -7,7 +7,9 @@ Node 26 runs the TypeScript directly; imports carry `.ts` and `#/` is `src/`.
7
7
  (`PLUGINS_AUTO_INSTALL`).
8
8
  - `src/core.ts` holds the core client and the manifest. Every permission, event
9
9
  and kind in the manifest starts with `__id__.`. A new scope waits for the
10
- owner's approval, so ask for one only when a procedure needs it.
10
+ owner's approval, so ask for one only when a procedure needs it. Owners and
11
+ admins hold every permission; a permission set with `defaultRoles: ['member']`
12
+ is what members get on install, and owners change it from there.
11
13
  - `src/server.ts` verifies the session token on `/api/rpc/*` and hands
12
14
  procedures `context.member` (`PluginMember`: `orgId`, `userId`, `can()`,
13
15
  `canChange()`).
@@ -38,7 +40,10 @@ Node 26 runs the TypeScript directly; imports carry `.ts` and `#/` is `src/`.
38
40
  and `dependsOn: 'pipelineId'` on another narrows it to that pipeline's. Web
39
41
  fills the list from `GET /api/automations/records/<recordType>?parent=<value>`,
40
42
  sent with the member's session token like `/api/rpc/*`; answer
41
- `[{ value, label }]` with the records that member may see.
43
+ `[{ 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".
42
47
  - A fact the plugin computes about a customer or company (total spent, last
43
48
  order) is a field in the manifest's `fields` (`code`, `contentType`, `label`,
44
49
  `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.9",
25
- "@erxes/plugin-sdk": "0.1.0-v2.8",
24
+ "@erxes/core-contract": "0.1.0-v2.11",
25
+ "@erxes/plugin-sdk": "0.1.0-v2.10",
26
26
  "@opentelemetry/instrumentation-express": "^0.73.0",
27
27
  "@opentelemetry/instrumentation-http": "^0.301.1",
28
28
  "@opentelemetry/instrumentation-pg": "^0.78.0",
@@ -36,5 +36,15 @@ export const manifest = {
36
36
  { action: PERMISSIONS.view, label: 'View items', group: '__title__' },
37
37
  { action: PERMISSIONS.manage, label: 'Create and change items', group: '__title__' },
38
38
  ],
39
+ // Ready-made sets owners add to roles; core gives Members this one when the plugin is installed.
40
+ permissionSets: [
41
+ {
42
+ key: 'member',
43
+ label: '__title__ member',
44
+ description: 'Views, creates and changes items',
45
+ permissions: [PERMISSIONS.view, PERMISSIONS.manage],
46
+ defaultRoles: ['member'],
47
+ },
48
+ ],
39
49
  jobs: manifestJobs,
40
50
  } satisfies PluginManifest;
@@ -41,7 +41,8 @@ and renders `./__id__` (the `__Pascal__` export) under `/__id__/*`.
41
41
  - Pages look and behave like core's: follow the `ui-patterns` skill.
42
42
  - Lists have core's bar (`src/modules/items/ItemsPage.tsx`): erxes-ui's `ViewBar` with
43
43
  `ListFilter`, given the list's fields and, for `member` fields, `members={memberQueries}`
44
- (a `tags` query for `tags` fields). It draws the bar itself, in erxes or on its own. Its conditions and search live in the
44
+ (a `tags` query for `tags` fields, `contacts={contactSearchQueries}` for `customer` and
45
+ `company` fields). It draws the bar itself, in erxes or on its own. Its conditions and search live in the
45
46
  address; `useListFilterParams()` hands them to the list's query, and the API
46
47
  applies them with `@erxes/plugin-sdk/filter`'s `compileFilter`, core's own compiler, on a map
47
48
  of the same paths to columns (`FILTER_FIELDS` in `api/src/modules/items/items.ts`). No search boxes, toggle
@@ -52,10 +53,15 @@ and renders `./__id__` (the `__Pascal__` export) under `/__id__/*`.
52
53
  `CONFIG.recordTypes` (`src/config.tsx`) fills its slots, the item's `Title`,
53
54
  `Detail` and `New` (`src/modules/items/ItemPanel.tsx`). `useOpenRecord()`
54
55
  opens them, and `/__id__/:id` renders erxes-ui's `RecordPage` for the expanded
55
- record. A plugin's records of other records' customers are `relationTabs`
56
+ record; its `listPath` is the list a deleted or closed record goes back to, when
57
+ that isn't the plugin's first page. A plugin's records of other records' customers are `relationTabs`
56
58
  (the `ui-patterns` skill). A settings page is a route of the plugin's
57
59
  (`/__id__/settings/<page>`) that `CONFIG.settings` lists (`{ path, label, icon }`):
58
- core links it from its settings sidebar, under the plugin's name. Tiles for core's
60
+ core links it from its settings sidebar, under the plugin's name. Custom fields
61
+ on a record type are its `properties` (`type: '__id__.item'`, `values(id)`,
62
+ `save(id, patch)`): core keeps the fields and draws their settings page and the
63
+ Properties tab; the API keeps the values in a jsonb column and checks a patch
64
+ with core's `fields.check` before saving. Tiles for core's
59
65
  home dashboard are `CONFIG.dashboardWidgets`: `name`, `title`, `icon`, `preview`,
60
66
  `size` and a `lazy` `component`, which core draws as the tile's body under the
61
67
  title. Forms are core's
@@ -8,12 +8,12 @@
8
8
  "build": "rsbuild build"
9
9
  },
10
10
  "dependencies": {
11
- "@erxes/core-contract": "0.1.0-v2.9",
11
+ "@erxes/core-contract": "0.1.0-v2.11",
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.15",
16
+ "erxes-ui": "npm:@erxes/ui@4.0.0-v2.16",
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.11",
3
+ "version": "0.1.12",
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",