create-erxes 0.1.30 → 0.1.31

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.30";
12
+ var version = "0.1.31";
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 = [
@@ -21,8 +21,8 @@
21
21
  "db:check": "drizzle-kit check"
22
22
  },
23
23
  "dependencies": {
24
- "@erxes/core-contract": "0.1.0-v2.31",
25
- "@erxes/plugin-sdk": "0.1.0-v2.30",
24
+ "@erxes/core-contract": "0.1.0-v2.32",
25
+ "@erxes/plugin-sdk": "0.1.0-v2.31",
26
26
  "@opentelemetry/instrumentation-express": "^0.73.0",
27
27
  "@opentelemetry/instrumentation-http": "^0.301.1",
28
28
  "@opentelemetry/instrumentation-pg": "^0.78.0",
@@ -6,7 +6,7 @@ import { z } from 'zod';
6
6
  import { db } from './client.ts';
7
7
 
8
8
  /** Our own tracking table: core and other plugins in the same database keep theirs. */
9
- export const MIGRATIONS_TABLE = '__drizzle_migrations___id__';
9
+ const MIGRATIONS_TABLE = '__drizzle_migrations___id__';
10
10
 
11
11
  const migrationsTable = sql`${sql.identifier('public')}.${sql.identifier(MIGRATIONS_TABLE)}`;
12
12
 
@@ -99,25 +99,13 @@ BEGIN
99
99
  RETURN v_id;
100
100
  END $$;
101
101
  CREATE OR REPLACE FUNCTION core_live_signal(p_org_id text, p_plugin text, p_topic text, p_user_ids text[] DEFAULT NULL)
102
- RETURNS void LANGUAGE plpgsql AS $$
103
- DECLARE
104
- chunk text[];
105
- total int := coalesce(array_length(p_user_ids, 1), 0);
106
- i int := 1;
102
+ RETURNS void LANGUAGE plpgsql SECURITY DEFINER SET search_path = public, pg_temp AS $$
107
103
  BEGIN
108
- IF p_plugin !~ '^[a-z][a-z0-9_]{0,39}$' OR p_topic !~ '^[a-z0-9][a-z0-9._:-]{0,99}$' THEN
104
+ IF p_plugin !~ '^[a-z][a-z0-9_]{0,39}$' OR p_topic !~ '^[A-Za-z0-9][A-Za-z0-9._:-]{0,99}$' THEN
109
105
  RAISE EXCEPTION 'core_live_signal: invalid plugin or topic';
110
106
  END IF;
111
107
  PERFORM core_enter_org(p_org_id, p_plugin);
112
- IF total = 0 THEN
113
- PERFORM pg_notify('core_live', json_build_object('o', p_org_id, 'k', 'plugin', 'p', p_plugin, 't', p_topic)::text);
114
- RETURN;
115
- END IF;
116
- WHILE i <= total LOOP
117
- chunk := p_user_ids[i:i + 99];
118
- PERFORM pg_notify('core_live', json_build_object('o', p_org_id, 'k', 'plugin', 'p', p_plugin, 't', p_topic, 'u', chunk)::text);
119
- i := i + 100;
120
- END LOOP;
108
+ PERFORM core_live_topic(p_org_id, 'plugin:' || p_plugin || ':' || p_topic, p_user_ids);
121
109
  END $$;
122
110
  CREATE OR REPLACE FUNCTION core_enter_org(p_org_id text, p_plugin text) RETURNS void
123
111
  LANGUAGE plpgsql AS $$
@@ -189,5 +177,7 @@ ALTER TABLE "core_audit_logs" ADD COLUMN "hash" text;
189
177
  CREATE INDEX "core_audit_logs_org_source_idx" ON "core_audit_logs" USING btree ("org_id","source","created_at" DESC NULLS LAST);
190
178
  CREATE UNIQUE INDEX "core_audit_logs_chain_key" ON "core_audit_logs" USING btree ("org_id","chain_seq");
191
179
  ALTER TABLE "core_audit_logs" ALTER COLUMN "org_id" SET DEFAULT nullif(current_setting('app.org_id', true), '');
180
+ CREATE INDEX "core_audit_logs_action_trgm_idx" ON "core_audit_logs" USING gin ("action" gin_trgm_ops);
181
+ CREATE INDEX "core_audit_logs_target_label_trgm_idx" ON "core_audit_logs" USING gin ("target_label" gin_trgm_ops);
192
182
  SELECT core_enable_tenant_rls('core_audit_logs');
193
183
  GRANT SELECT, INSERT ON core_audit_logs TO PUBLIC;
@@ -8,12 +8,12 @@
8
8
  "build": "rsbuild build"
9
9
  },
10
10
  "dependencies": {
11
- "@erxes/core-contract": "0.1.0-v2.31",
11
+ "@erxes/core-contract": "0.1.0-v2.32",
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.28",
16
+ "erxes-ui": "npm:@erxes/ui@4.0.0-v2.30",
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.30",
3
+ "version": "0.1.31",
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",