create-erxes 0.1.20 → 0.1.22

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.20";
12
+ var version = "0.1.22";
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,6 +54,18 @@ Node 26 runs the TypeScript directly; imports carry `.ts` and `#/` is `src/`.
54
54
  while the plugin has `fields:write` there, so fill the values that existed
55
55
  before in a job with `onInstall: true`: core runs it once when an
56
56
  organisation installs the plugin or approves its new scopes.
57
+ - Records that belong to customers or companies (deals, orders, tickets) are a
58
+ relation in the manifest's `relations` (`key`, `contentType`, `label`,
59
+ `view`, `permission?`, `fields`: `key`, `label`, `type` text, number, date,
60
+ boolean, select or member, `options`, `array`, `money`). Members then filter
61
+ contacts by them, live, with no values to sync: "Deals: count ≥ 3 where
62
+ Stage is Won", "Deals: Amount (total) > 1,000,000", "Deals: Closed (latest)
63
+ more than 60 days ago". Keep a view `<plugin>_*` in a migration, owned by the
64
+ plugin's role, with `record_id` (the customer's or company's id) and one
65
+ column per field, and grant it:
66
+ `GRANT SELECT ON sales_customer_deals TO erxes_core_reader;`. It reads the
67
+ plugin's tables as their owner, so their row level security keeps it to the
68
+ organisation. Index what it joins on (`org_id`, the customer id).
57
69
  - A segment (a price list's audience, a campaign's) is a shared view members
58
70
  build in core. Store its id; `views.list({ recordType })` lists the shared
59
71
  ones and `views.matches({ viewId, recordIds })` says which records it
@@ -21,8 +21,8 @@
21
21
  "db:check": "drizzle-kit check"
22
22
  },
23
23
  "dependencies": {
24
- "@erxes/core-contract": "0.1.0-v2.20",
25
- "@erxes/plugin-sdk": "0.1.0-v2.19",
24
+ "@erxes/core-contract": "0.1.0-v2.22",
25
+ "@erxes/plugin-sdk": "0.1.0-v2.21",
26
26
  "@opentelemetry/instrumentation-express": "^0.73.0",
27
27
  "@opentelemetry/instrumentation-http": "^0.301.1",
28
28
  "@opentelemetry/instrumentation-pg": "^0.78.0",
@@ -8,7 +8,7 @@
8
8
  "build": "rsbuild build"
9
9
  },
10
10
  "dependencies": {
11
- "@erxes/core-contract": "0.1.0-v2.20",
11
+ "@erxes/core-contract": "0.1.0-v2.22",
12
12
  "@orpc/client": "1.16.2",
13
13
  "@orpc/tanstack-query": "1.16.2",
14
14
  "@tabler/icons-react": "3.34.0",
@@ -54,7 +54,10 @@ export const WHOLE_MODULES: Record<string, Equivalent> = {
54
54
  clientPortals: CLIENT_PORTAL,
55
55
  clientPortalUsers: CLIENT_PORTAL,
56
56
  cpUsers: CLIENT_PORTAL,
57
- cpNotifications: CLIENT_PORTAL,
57
+ cpNotifications: sdk(
58
+ 'customerNotifications.create',
59
+ 'scope notifications:write; customerIds or everyone who signs in, channels email/sms; customers read them at /customer/notifications (decision 45)',
60
+ ),
58
61
  };
59
62
 
60
63
  /** Starting automations for a record: they start from the events a plugin publishes. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-erxes",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
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",