create-erxes 0.1.17 → 0.1.19
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/AGENTS.md +3 -2
- package/dist/templates/base/api/package.json +2 -2
- package/dist/templates/base/api/src/core.ts +4 -1
- package/dist/templates/base/api/src/server.ts +9 -5
- 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.19";
|
|
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 = [
|
|
@@ -55,9 +55,10 @@ without line-by-line review.
|
|
|
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
57
|
with `verifyPluginSession`. The same procedures are REST at `/api/v1` for
|
|
58
|
-
scripts, which get the token from core with an API key; `/api/openapi.json`
|
|
58
|
+
scripts, which get the token from core with an API key; `/api/openapi/member.json`
|
|
59
59
|
documents them (`pluginOpenApi`), and core's Settings › Developer › API reference
|
|
60
|
-
shows it.
|
|
60
|
+
shows it. Routes for employees in the plugin's own app, customers or a website get
|
|
61
|
+
their own document with that `audience`, listed in the manifest's `api.docs`. Renaming a procedure breaks those scripts. A caller outside erxes (a webhook) reaches a path
|
|
61
62
|
the manifest's `publicPaths` lists through core, which names the organisation:
|
|
62
63
|
check it with `verifyPublicCall` (`@erxes/plugin-sdk`'s overview has the route).
|
|
63
64
|
- Skills in `.agents/skills/`: `endpoint` for a procedure, `schema-change` for a
|
|
@@ -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.20",
|
|
25
|
+
"@erxes/plugin-sdk": "0.1.0-v2.18",
|
|
26
26
|
"@opentelemetry/instrumentation-express": "^0.73.0",
|
|
27
27
|
"@opentelemetry/instrumentation-http": "^0.301.1",
|
|
28
28
|
"@opentelemetry/instrumentation-pg": "^0.78.0",
|
|
@@ -31,7 +31,10 @@ export const manifest = {
|
|
|
31
31
|
version: config.version,
|
|
32
32
|
ui: { remote: '__id___ui', entry: config.uiEntryUrl },
|
|
33
33
|
// `server.ts` serves the REST routes at /api/v1 and their document here.
|
|
34
|
-
api: {
|
|
34
|
+
api: {
|
|
35
|
+
url: `${config.publicUrl}/api`,
|
|
36
|
+
docs: [{ audience: 'member', path: '/openapi/member.json' }],
|
|
37
|
+
},
|
|
35
38
|
scopes: [],
|
|
36
39
|
permissions: [
|
|
37
40
|
{ action: PERMISSIONS.view, label: 'View items', group: '__title__' },
|
|
@@ -20,9 +20,13 @@ const logFailure = (error: unknown) => {
|
|
|
20
20
|
const rpc = new RPCHandler(router, { interceptors: [onError(logFailure)] });
|
|
21
21
|
const rest = new OpenAPIHandler(router, { interceptors: [onError(logFailure)] });
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Settings › Developer › API reference shows it (the manifest's `api.docs`). Routes for
|
|
25
|
+
* customers or a website get their own document with that `audience`.
|
|
26
|
+
*/
|
|
27
|
+
const memberDoc = pluginOpenApi(router, {
|
|
25
28
|
plugin: PLUGIN,
|
|
29
|
+
audience: 'member',
|
|
26
30
|
title: manifest.title,
|
|
27
31
|
version: manifest.version,
|
|
28
32
|
description: manifest.description,
|
|
@@ -48,7 +52,7 @@ export const createApp = () => {
|
|
|
48
52
|
// Bearer session token core issues, never a cookie, so CORS guards nothing here.
|
|
49
53
|
// Routes for websites (an API key, customer tokens) set their own CORS.
|
|
50
54
|
app.use(
|
|
51
|
-
['/api/rpc', '/api/v1', '/api/openapi
|
|
55
|
+
['/api/rpc', '/api/v1', '/api/openapi', '/ui'],
|
|
52
56
|
cors({ origin: true, credentials: false, maxAge: 600 }),
|
|
53
57
|
);
|
|
54
58
|
|
|
@@ -56,8 +60,8 @@ export const createApp = () => {
|
|
|
56
60
|
res.json({ ok: true });
|
|
57
61
|
});
|
|
58
62
|
|
|
59
|
-
app.get('/api/openapi.json', async (_req, res) => {
|
|
60
|
-
res.json(await
|
|
63
|
+
app.get('/api/openapi/member.json', async (_req, res) => {
|
|
64
|
+
res.json(await memberDoc);
|
|
61
65
|
});
|
|
62
66
|
|
|
63
67
|
// A 5-minute session token core issued for this member and plugin: erxes-ui's pluginFetch
|
|
@@ -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.20",
|
|
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.20",
|
|
17
17
|
"jotai": "^3.0.2",
|
|
18
18
|
"nuqs": "^2.10.3",
|
|
19
19
|
"react": "19.3.1",
|