@mercurjs/dashboard-sdk 2.3.6-canary.6 → 2.3.6-canary.7
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.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/vite.cjs +8 -4
- package/dist/vite.js +8 -4
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { a as Permission } from './types-Cziny1v0.cjs';
|
|
2
|
+
export { B as BuiltMercurConfig, M as MercurConfig, P as PERMISSION_RIGHT_RANK, b as PermissionKey, c as PermissionKeys, d as PermissionMap, e as PermissionRight, f as PermissionsContextValue, R as RouteConfig, g as RouteHandle, h as buildPermission, p as parsePermission, s as satisfiesPermission } from './types-Cziny1v0.cjs';
|
|
2
3
|
import { ComponentType, ReactNode } from 'react';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -33,6 +34,11 @@ interface WidgetConfig {
|
|
|
33
34
|
zone: WidgetZoneId | WidgetZoneId[];
|
|
34
35
|
/** Stable id; derived from the file path at build time when omitted. */
|
|
35
36
|
id?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Permission(s) the actor needs for the widget to render. With several, any
|
|
39
|
+
* one is enough.
|
|
40
|
+
*/
|
|
41
|
+
permission?: Permission | Permission[];
|
|
36
42
|
}
|
|
37
43
|
/** Override for a single built-in navigation item. */
|
|
38
44
|
interface NavItemOverride {
|
|
@@ -192,4 +198,4 @@ declare function defineWidgetConfig(config: WidgetConfig): WidgetConfig;
|
|
|
192
198
|
declare function defineNavigationConfig(config: NavigationConfig): NavigationConfig;
|
|
193
199
|
declare function defineCustomFieldsConfig<TModel extends CustomFieldModel>(config: CustomFieldsConfig<TModel>): CustomFieldsConfig<TModel>;
|
|
194
200
|
|
|
195
|
-
export { type ActivityEntry, type CustomColumn, type CustomDisplayEntry, type CustomDisplayField, type CustomFieldAction, type CustomFieldActionRegistry, type CustomFieldModel, type CustomFieldsConfig, type CustomFieldsRegistry, type CustomFormEntry, type CustomFormField, type CustomFormTab, type CustomFormZone, type CustomListExtension, type FieldValidation, type NavItemId, type NavItemOverride, type NavItemRegistry, type NavParentId, type NavParentRegistry, type NavigationConfig, type SectionAction, type WidgetConfig, type WidgetZoneId, type WidgetZoneRegistry, defineCustomFieldsConfig, defineNavigationConfig, defineWidgetConfig };
|
|
201
|
+
export { type ActivityEntry, type CustomColumn, type CustomDisplayEntry, type CustomDisplayField, type CustomFieldAction, type CustomFieldActionRegistry, type CustomFieldModel, type CustomFieldsConfig, type CustomFieldsRegistry, type CustomFormEntry, type CustomFormField, type CustomFormTab, type CustomFormZone, type CustomListExtension, type FieldValidation, type NavItemId, type NavItemOverride, type NavItemRegistry, type NavParentId, type NavParentRegistry, type NavigationConfig, Permission, type SectionAction, type WidgetConfig, type WidgetZoneId, type WidgetZoneRegistry, defineCustomFieldsConfig, defineNavigationConfig, defineWidgetConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { a as Permission } from './types-Cziny1v0.js';
|
|
2
|
+
export { B as BuiltMercurConfig, M as MercurConfig, P as PERMISSION_RIGHT_RANK, b as PermissionKey, c as PermissionKeys, d as PermissionMap, e as PermissionRight, f as PermissionsContextValue, R as RouteConfig, g as RouteHandle, h as buildPermission, p as parsePermission, s as satisfiesPermission } from './types-Cziny1v0.js';
|
|
2
3
|
import { ComponentType, ReactNode } from 'react';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -33,6 +34,11 @@ interface WidgetConfig {
|
|
|
33
34
|
zone: WidgetZoneId | WidgetZoneId[];
|
|
34
35
|
/** Stable id; derived from the file path at build time when omitted. */
|
|
35
36
|
id?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Permission(s) the actor needs for the widget to render. With several, any
|
|
39
|
+
* one is enough.
|
|
40
|
+
*/
|
|
41
|
+
permission?: Permission | Permission[];
|
|
36
42
|
}
|
|
37
43
|
/** Override for a single built-in navigation item. */
|
|
38
44
|
interface NavItemOverride {
|
|
@@ -192,4 +198,4 @@ declare function defineWidgetConfig(config: WidgetConfig): WidgetConfig;
|
|
|
192
198
|
declare function defineNavigationConfig(config: NavigationConfig): NavigationConfig;
|
|
193
199
|
declare function defineCustomFieldsConfig<TModel extends CustomFieldModel>(config: CustomFieldsConfig<TModel>): CustomFieldsConfig<TModel>;
|
|
194
200
|
|
|
195
|
-
export { type ActivityEntry, type CustomColumn, type CustomDisplayEntry, type CustomDisplayField, type CustomFieldAction, type CustomFieldActionRegistry, type CustomFieldModel, type CustomFieldsConfig, type CustomFieldsRegistry, type CustomFormEntry, type CustomFormField, type CustomFormTab, type CustomFormZone, type CustomListExtension, type FieldValidation, type NavItemId, type NavItemOverride, type NavItemRegistry, type NavParentId, type NavParentRegistry, type NavigationConfig, type SectionAction, type WidgetConfig, type WidgetZoneId, type WidgetZoneRegistry, defineCustomFieldsConfig, defineNavigationConfig, defineWidgetConfig };
|
|
201
|
+
export { type ActivityEntry, type CustomColumn, type CustomDisplayEntry, type CustomDisplayField, type CustomFieldAction, type CustomFieldActionRegistry, type CustomFieldModel, type CustomFieldsConfig, type CustomFieldsRegistry, type CustomFormEntry, type CustomFormField, type CustomFormTab, type CustomFormZone, type CustomListExtension, type FieldValidation, type NavItemId, type NavItemOverride, type NavItemRegistry, type NavParentId, type NavParentRegistry, type NavigationConfig, Permission, type SectionAction, type WidgetConfig, type WidgetZoneId, type WidgetZoneRegistry, defineCustomFieldsConfig, defineNavigationConfig, defineWidgetConfig };
|
package/dist/vite.cjs
CHANGED
|
@@ -665,7 +665,7 @@ export default [${sources.join(", ")}].reduce(mergeResources, {})
|
|
|
665
665
|
// src/widgets.ts
|
|
666
666
|
var import_fs5 = __toESM(require("fs"), 1);
|
|
667
667
|
var import_path5 = __toESM(require("path"), 1);
|
|
668
|
-
function
|
|
668
|
+
function extractStrings(value, zones) {
|
|
669
669
|
if ((0, import_types.isStringLiteral)(value)) {
|
|
670
670
|
zones.push(value.value);
|
|
671
671
|
} else if ((0, import_types.isArrayExpression)(value)) {
|
|
@@ -676,18 +676,22 @@ function extractZones(value, zones) {
|
|
|
676
676
|
}
|
|
677
677
|
function readWidgetConfig(properties) {
|
|
678
678
|
const zones = [];
|
|
679
|
+
const permissions = [];
|
|
679
680
|
let id;
|
|
680
681
|
for (const prop of properties) {
|
|
681
682
|
if (!(0, import_types.isObjectProperty)(prop)) continue;
|
|
682
683
|
if ((0, import_types.isIdentifier)(prop.key, { name: "zone" })) {
|
|
683
|
-
|
|
684
|
+
extractStrings(prop.value, zones);
|
|
685
|
+
}
|
|
686
|
+
if ((0, import_types.isIdentifier)(prop.key, { name: "permission" })) {
|
|
687
|
+
extractStrings(prop.value, permissions);
|
|
684
688
|
}
|
|
685
689
|
if ((0, import_types.isIdentifier)(prop.key, { name: "id" }) && (0, import_types.isStringLiteral)(prop.value)) {
|
|
686
690
|
id = prop.value.value;
|
|
687
691
|
}
|
|
688
692
|
}
|
|
689
693
|
if (zones.length === 0) return null;
|
|
690
|
-
return { zones, id };
|
|
694
|
+
return { zones, id, permissions };
|
|
691
695
|
}
|
|
692
696
|
function getConfigProperties(node) {
|
|
693
697
|
if ((0, import_types.isCallExpression)(node) && node.arguments.length > 0 && (0, import_types.isObjectExpression)(node.arguments[0])) {
|
|
@@ -751,7 +755,7 @@ function parseWidgetFile(file, widgetsDir, index) {
|
|
|
751
755
|
import: `import ${name} from "${importPath}"`,
|
|
752
756
|
entry: ` { Component: ${name}, zone: ${zonesLiteral}, widgetId: ${JSON.stringify(
|
|
753
757
|
id
|
|
754
|
-
)} }`
|
|
758
|
+
)}${info.permissions.length ? `, permission: ${JSON.stringify(info.permissions)}` : ""} }`
|
|
755
759
|
};
|
|
756
760
|
}
|
|
757
761
|
function collectWidgets(srcDir, startIndex = 0) {
|
package/dist/vite.js
CHANGED
|
@@ -645,7 +645,7 @@ export default [${sources.join(", ")}].reduce(mergeResources, {})
|
|
|
645
645
|
// src/widgets.ts
|
|
646
646
|
import fs5 from "fs";
|
|
647
647
|
import path5 from "path";
|
|
648
|
-
function
|
|
648
|
+
function extractStrings(value, zones) {
|
|
649
649
|
if (isStringLiteral(value)) {
|
|
650
650
|
zones.push(value.value);
|
|
651
651
|
} else if (isArrayExpression(value)) {
|
|
@@ -656,18 +656,22 @@ function extractZones(value, zones) {
|
|
|
656
656
|
}
|
|
657
657
|
function readWidgetConfig(properties) {
|
|
658
658
|
const zones = [];
|
|
659
|
+
const permissions = [];
|
|
659
660
|
let id;
|
|
660
661
|
for (const prop of properties) {
|
|
661
662
|
if (!isObjectProperty(prop)) continue;
|
|
662
663
|
if (isIdentifier(prop.key, { name: "zone" })) {
|
|
663
|
-
|
|
664
|
+
extractStrings(prop.value, zones);
|
|
665
|
+
}
|
|
666
|
+
if (isIdentifier(prop.key, { name: "permission" })) {
|
|
667
|
+
extractStrings(prop.value, permissions);
|
|
664
668
|
}
|
|
665
669
|
if (isIdentifier(prop.key, { name: "id" }) && isStringLiteral(prop.value)) {
|
|
666
670
|
id = prop.value.value;
|
|
667
671
|
}
|
|
668
672
|
}
|
|
669
673
|
if (zones.length === 0) return null;
|
|
670
|
-
return { zones, id };
|
|
674
|
+
return { zones, id, permissions };
|
|
671
675
|
}
|
|
672
676
|
function getConfigProperties(node) {
|
|
673
677
|
if (isCallExpression(node) && node.arguments.length > 0 && isObjectExpression(node.arguments[0])) {
|
|
@@ -731,7 +735,7 @@ function parseWidgetFile(file, widgetsDir, index) {
|
|
|
731
735
|
import: `import ${name} from "${importPath}"`,
|
|
732
736
|
entry: ` { Component: ${name}, zone: ${zonesLiteral}, widgetId: ${JSON.stringify(
|
|
733
737
|
id
|
|
734
|
-
)} }`
|
|
738
|
+
)}${info.permissions.length ? `, permission: ${JSON.stringify(info.permissions)}` : ""} }`
|
|
735
739
|
};
|
|
736
740
|
}
|
|
737
741
|
function collectWidgets(srcDir, startIndex = 0) {
|