@pc-nexus/core 0.5.0-next.2 → 0.5.0-next.20
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/index.d.ts +3 -1
- package/index.d.ts.map +1 -1
- package/index.js +2 -0
- package/lib/authorize.d.ts +22 -0
- package/lib/authorize.d.ts.map +1 -0
- package/lib/authorize.js +17 -0
- package/lib/common.d.ts +3 -1
- package/lib/common.d.ts.map +1 -1
- package/lib/common.js +4 -2
- package/lib/handler.d.ts +6 -0
- package/lib/handler.d.ts.map +1 -0
- package/lib/handler.js +1 -0
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { EnvironmentType, NexusCode, NexusError, NexusHttpStatusCode, NexusInnerError, NexusInnerErrorType, Resolver, type Extension, type HandlerFunction, type HandlerFunctionEvent, type NexusAppContext, type ResolverFunction, type Team, type User, } from "@pc-nexus/internal";
|
|
1
|
+
export { EnvironmentType, NexusCode, NexusError, NexusHttpStatusCode, NexusInnerError, NexusInnerErrorType, Resolver, type Extension, type HandlerFunction, type HandlerFunctionEvent, type NexusAppContext, type ResolverFunction, type Team, type User, type WebHookHandlerFunctionReturn, } from "@pc-nexus/internal";
|
|
2
|
+
export * from "./lib/authorize.js";
|
|
2
3
|
export * from "./lib/common.js";
|
|
4
|
+
export * from "./lib/handler.js";
|
|
3
5
|
export * from "./lib/i18n/index.js";
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EACf,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,QAAQ,EACR,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,IAAI,EACT,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EACf,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,QAAQ,EACR,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,4BAA4B,GACpC,MAAM,oBAAoB,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { EnvironmentType, NexusCode, NexusError, NexusHttpStatusCode, NexusInnerError, NexusInnerErrorType, Resolver, } from "@pc-nexus/internal";
|
|
2
|
+
export * from "./lib/authorize.js";
|
|
2
3
|
export * from "./lib/common.js";
|
|
4
|
+
export * from "./lib/handler.js";
|
|
3
5
|
export * from "./lib/i18n/index.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface PermissionPoint {
|
|
2
|
+
key: string;
|
|
3
|
+
name: string;
|
|
4
|
+
group: string;
|
|
5
|
+
}
|
|
6
|
+
export type PermissionPointsResult = Record<string, PermissionPoint[]>;
|
|
7
|
+
type PilotType = "product" | "project" | "library" | "space";
|
|
8
|
+
type PrincipalType = "idea" | "ticket" | "workitem" | "testcase" | "page";
|
|
9
|
+
export type ResourceType = PilotType | PrincipalType;
|
|
10
|
+
export interface UserPermission {
|
|
11
|
+
key: string;
|
|
12
|
+
has_permission: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare function getPermissionPoints(): Promise<PermissionPointsResult>;
|
|
15
|
+
declare function getUserPermissions(type: "global", userId?: string): Promise<UserPermission[]>;
|
|
16
|
+
declare function getUserPermissions(type: ResourceType, id: string, userId?: string): Promise<UserPermission[]>;
|
|
17
|
+
export declare const authorize: {
|
|
18
|
+
getPermissionPoints: typeof getPermissionPoints;
|
|
19
|
+
getUserPermissions: typeof getUserPermissions;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=authorize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../src/lib/authorize.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,eAAe;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;AAIvE,KAAK,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAE7D,KAAK,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AAE1E,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,aAAa,CAAC;AAErD,MAAM,WAAW,cAAc;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,OAAO,CAAC;CAC3B;AASD,iBAAe,mBAAmB,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAIpE;AAED,iBAAe,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AAC9F,iBAAe,kBAAkB,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AAQ9G,eAAO,MAAM,SAAS;;;CAGrB,CAAC"}
|
package/lib/authorize.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { invoke } from "@pc-nexus/internal";
|
|
2
|
+
// ── SDK functions ─────────────────────────────────────────────────────────────
|
|
3
|
+
async function getPermissionPoints() {
|
|
4
|
+
const invokeRes = await invoke("authorize", "get-points", {});
|
|
5
|
+
const result = (await invokeRes.json());
|
|
6
|
+
return result.value ?? {};
|
|
7
|
+
}
|
|
8
|
+
async function getUserPermissions(type, idOrUserId, userId) {
|
|
9
|
+
const payload = type === "global" ? { type, user_id: idOrUserId } : { type, id: idOrUserId, user_id: userId };
|
|
10
|
+
const invokeRes = await invoke("authorize", "get-user-permissions", payload);
|
|
11
|
+
const result = (await invokeRes.json());
|
|
12
|
+
return (result.value ?? []).map((p) => ({ key: p.key, has_permission: p.has_permission === 1 }));
|
|
13
|
+
}
|
|
14
|
+
export const authorize = {
|
|
15
|
+
getPermissionPoints,
|
|
16
|
+
getUserPermissions,
|
|
17
|
+
};
|
package/lib/common.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { NexusAppContext } from "@pc-nexus/internal";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const app: {
|
|
3
|
+
getContext: () => NexusAppContext;
|
|
4
|
+
};
|
|
3
5
|
export declare const I18nResourcesAccessor: {
|
|
4
6
|
getI18nInfoConfig: () => any;
|
|
5
7
|
getTranslationResource: (locale: string) => any;
|
package/lib/common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/lib/common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/lib/common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,eAAO,MAAM,GAAG;sBACI,eAAe;CAGlC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;qCAEG,MAAM;CAC1C,CAAC"}
|
package/lib/common.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { GLOBAL_KEY_NEXUS_RUNTIME } from "@pc-nexus/internal";
|
|
2
|
-
export const
|
|
3
|
-
|
|
2
|
+
export const app = {
|
|
3
|
+
getContext: () => {
|
|
4
|
+
return global[GLOBAL_KEY_NEXUS_RUNTIME].app.getContext();
|
|
5
|
+
},
|
|
4
6
|
};
|
|
5
7
|
export const I18nResourcesAccessor = {
|
|
6
8
|
getI18nInfoConfig: () => global[GLOBAL_KEY_NEXUS_RUNTIME].i18n?.getI18nInfoConfig(),
|
package/lib/handler.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HandlerFunction, LifecycleEventPayload, ScheduledEventPayload, SystemEventPayload, WebHookHandlerFunctionReturn, WebhookPayload } from "@pc-nexus/internal";
|
|
2
|
+
export type SystemEventHandlerFunction = HandlerFunction<SystemEventPayload, void>;
|
|
3
|
+
export type LifecycleEventHandlerFunction = HandlerFunction<LifecycleEventPayload, void>;
|
|
4
|
+
export type WebhokEventHandlerFunction = HandlerFunction<WebhookPayload, WebHookHandlerFunctionReturn>;
|
|
5
|
+
export type ScheduledEventHandlerFunction = HandlerFunction<ScheduledEventPayload, void>;
|
|
6
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/lib/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,EAC5B,cAAc,EACjB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,0BAA0B,GAAG,eAAe,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;AAEnF,MAAM,MAAM,6BAA6B,GAAG,eAAe,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;AAEzF,MAAM,MAAM,0BAA0B,GAAG,eAAe,CAAC,cAAc,EAAE,4BAA4B,CAAC,CAAC;AAEvG,MAAM,MAAM,6BAA6B,GAAG,eAAe,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC"}
|
package/lib/handler.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pc-nexus/core",
|
|
3
|
-
"version": "0.5.0-next.
|
|
3
|
+
"version": "0.5.0-next.20",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"type": "module",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@pc-nexus/internal": "0.5.0-next.
|
|
32
|
+
"@pc-nexus/internal": "0.5.0-next.20",
|
|
33
33
|
"lodash": "^4.17.21"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {},
|