@erxes/plugin-sdk 0.1.0-v2.17 → 0.1.0-v2.18
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.d.ts +1 -1
- package/dist/openapi.js +8 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
*
|
|
123
123
|
* API reference: `@erxes/plugin-sdk/openapi` documents the plugin's routes, served as REST beside
|
|
124
124
|
* the RPC handler. The manifest's `api.docs` lists one document per audience (`member`, and
|
|
125
|
-
* `customer` or `website` for routes those call), and Settings › Developer shows them:
|
|
125
|
+
* `employee`, `customer` or `website` for routes those call), and Settings › Developer shows them:
|
|
126
126
|
*
|
|
127
127
|
* api: { url: `${publicUrl}/api`, docs: [{ audience: 'member', path: '/openapi/member.json' }] },
|
|
128
128
|
* app.use('/api/v1', member check, (req, res, next) => rest.handle(req, res, { prefix: '/api/v1', context }));
|
package/dist/openapi.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CORE_API_PREFIX, CUSTOMER_TOKEN_SCHEME, PLUGIN_SESSION_SCHEME, WEBSITE_KEY_SCHEME } from "@erxes/core-contract";
|
|
1
|
+
import { CORE_API_PREFIX, CUSTOMER_TOKEN_SCHEME, EMPLOYEE_TOKEN_SCHEME, PLUGIN_SESSION_SCHEME, WEBSITE_KEY_SCHEME } from "@erxes/core-contract";
|
|
2
2
|
import { OpenAPIGenerator } from "@orpc/openapi";
|
|
3
3
|
import { ZodToJsonSchemaConverter } from "@orpc/zod/zod4";
|
|
4
4
|
// src/openapi.ts
|
|
@@ -20,6 +20,13 @@ const securityOf = (plugin, audience) => {
|
|
|
20
20
|
} } },
|
|
21
21
|
security: [{ [PLUGIN_SESSION_SCHEME]: [] }]
|
|
22
22
|
};
|
|
23
|
+
if (audience === "employee") return {
|
|
24
|
+
components: { securitySchemes: { [EMPLOYEE_TOKEN_SCHEME]: {
|
|
25
|
+
...BEARER,
|
|
26
|
+
description: "An employee's access token, from this plugin's own sign-in in this document (employees sign in to the plugin's app, not to erxes)."
|
|
27
|
+
} } },
|
|
28
|
+
security: [{ [EMPLOYEE_TOKEN_SCHEME]: [] }]
|
|
29
|
+
};
|
|
23
30
|
if (audience === "customer") return {
|
|
24
31
|
components: { securitySchemes: { [CUSTOMER_TOKEN_SCHEME]: customerToken } },
|
|
25
32
|
security: [{ [CUSTOMER_TOKEN_SCHEME]: [] }]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erxes/plugin-sdk",
|
|
3
|
-
"version": "0.1.0-v2.
|
|
3
|
+
"version": "0.1.0-v2.18",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "For erxes plugin servers: a typed core client with automatic plugin tokens, verification of members' plugin session tokens and of core's deliveries, and plugin jobs",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@orpc/zod": "1.16.2",
|
|
37
37
|
"jose": "^6.2.17",
|
|
38
38
|
"zod": "^4.6.7",
|
|
39
|
-
"@erxes/core-contract": "0.1.0-v2.
|
|
39
|
+
"@erxes/core-contract": "0.1.0-v2.20"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"drizzle-orm": "0.45.4"
|