@litusarchieve18/agricore-utils 1.0.24 → 1.0.26
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/README.md +3 -1
- package/dist/{chunk-V2DL7OTH.mjs → chunk-GZRAFNPA.mjs} +13 -7
- package/dist/{constants-BS1AZ5aN.d.mts → constants-C0zV05Cf.d.mts} +6 -0
- package/dist/{constants-BS1AZ5aN.d.ts → constants-C0zV05Cf.d.ts} +6 -0
- package/dist/constants.d.mts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +13 -7
- package/dist/constants.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +24 -10
- package/dist/index.mjs +12 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -183,7 +183,9 @@ Run the publish command:
|
|
|
183
183
|
Bash
|
|
184
184
|
npm publish --access public
|
|
185
185
|
📝 Version History
|
|
186
|
-
V1.0.
|
|
186
|
+
V1.0.26 — updating evaluatebaseAccess to try look up the parent scope given the current scope is not
|
|
187
|
+
|
|
188
|
+
V1.0.25 — adding privileges and changing RESOURCE_PATHS
|
|
187
189
|
|
|
188
190
|
V1.0.24 — splitting role dependency into a new file
|
|
189
191
|
|
|
@@ -17,7 +17,8 @@ var CAT = {
|
|
|
17
17
|
SUBSCRIPTION: "1",
|
|
18
18
|
PERMISSION: "2",
|
|
19
19
|
VALIDATION: "3",
|
|
20
|
-
INTEGRITY: "4"
|
|
20
|
+
INTEGRITY: "4",
|
|
21
|
+
DATABASE: "5"
|
|
21
22
|
};
|
|
22
23
|
var ACT = {
|
|
23
24
|
GENERIC: "00",
|
|
@@ -77,7 +78,12 @@ var UserPrivilege = {
|
|
|
77
78
|
HR: "hr",
|
|
78
79
|
MECHANIC: "mechanic",
|
|
79
80
|
AUDIT_COMPLIANCE: "auditCompliance",
|
|
80
|
-
ADMIN: "admin"
|
|
81
|
+
ADMIN: "admin",
|
|
82
|
+
DOCUMENT: "documents",
|
|
83
|
+
INVENTORY: "inventory",
|
|
84
|
+
FARM_MANAGEMENT: "farmManagement",
|
|
85
|
+
PACKHOUSE: "packhouse",
|
|
86
|
+
ACCOMMODATION: "accommodation"
|
|
81
87
|
};
|
|
82
88
|
var AccessLevel = {
|
|
83
89
|
NONE: "NONE",
|
|
@@ -508,23 +514,23 @@ var RESOURCE_REQUIREMENTS = {
|
|
|
508
514
|
// ── Records & Reports ──────────────────────────────────────────────────────
|
|
509
515
|
[RESOURCE_PATHS.documentHub]: {
|
|
510
516
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
511
|
-
requiredPrivileges: [UserPrivilege.
|
|
517
|
+
requiredPrivileges: [UserPrivilege.DOCUMENT]
|
|
512
518
|
},
|
|
513
519
|
[RESOURCE_PATHS.documentHubTemplates]: {
|
|
514
520
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
515
|
-
requiredPrivileges: [UserPrivilege.
|
|
521
|
+
requiredPrivileges: [UserPrivilege.DOCUMENT]
|
|
516
522
|
},
|
|
517
523
|
[RESOURCE_PATHS.documentHubFolder]: {
|
|
518
524
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
519
|
-
requiredPrivileges: [UserPrivilege.
|
|
525
|
+
requiredPrivileges: [UserPrivilege.DOCUMENT]
|
|
520
526
|
},
|
|
521
527
|
[RESOURCE_PATHS.documentHubExtraction]: {
|
|
522
528
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
523
|
-
requiredPrivileges: [UserPrivilege.
|
|
529
|
+
requiredPrivileges: [UserPrivilege.DOCUMENT]
|
|
524
530
|
},
|
|
525
531
|
[RESOURCE_PATHS.documentHubQueue]: {
|
|
526
532
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
527
|
-
requiredPrivileges: [UserPrivilege.ADMIN, UserPrivilege.AUDIT_COMPLIANCE, UserPrivilege.FINANCE, UserPrivilege.
|
|
533
|
+
requiredPrivileges: [UserPrivilege.ADMIN, UserPrivilege.AUDIT_COMPLIANCE, UserPrivilege.FINANCE, UserPrivilege.DOCUMENT]
|
|
528
534
|
},
|
|
529
535
|
// CONSUMABLES PERMISSIONS
|
|
530
536
|
[RESOURCE_PATHS.inventoryConsumableProduct]: {
|
|
@@ -227,6 +227,7 @@ declare const CAT: {
|
|
|
227
227
|
readonly PERMISSION: "2";
|
|
228
228
|
readonly VALIDATION: "3";
|
|
229
229
|
readonly INTEGRITY: "4";
|
|
230
|
+
readonly DATABASE: "5";
|
|
230
231
|
};
|
|
231
232
|
declare const ACT: {
|
|
232
233
|
readonly GENERIC: "00";
|
|
@@ -255,6 +256,11 @@ declare const UserPrivilege: {
|
|
|
255
256
|
readonly MECHANIC: "mechanic";
|
|
256
257
|
readonly AUDIT_COMPLIANCE: "auditCompliance";
|
|
257
258
|
readonly ADMIN: "admin";
|
|
259
|
+
readonly DOCUMENT: "documents";
|
|
260
|
+
readonly INVENTORY: "inventory";
|
|
261
|
+
readonly FARM_MANAGEMENT: "farmManagement";
|
|
262
|
+
readonly PACKHOUSE: "packhouse";
|
|
263
|
+
readonly ACCOMMODATION: "accommodation";
|
|
258
264
|
};
|
|
259
265
|
declare const AccessLevel: {
|
|
260
266
|
readonly NONE: "NONE";
|
|
@@ -227,6 +227,7 @@ declare const CAT: {
|
|
|
227
227
|
readonly PERMISSION: "2";
|
|
228
228
|
readonly VALIDATION: "3";
|
|
229
229
|
readonly INTEGRITY: "4";
|
|
230
|
+
readonly DATABASE: "5";
|
|
230
231
|
};
|
|
231
232
|
declare const ACT: {
|
|
232
233
|
readonly GENERIC: "00";
|
|
@@ -255,6 +256,11 @@ declare const UserPrivilege: {
|
|
|
255
256
|
readonly MECHANIC: "mechanic";
|
|
256
257
|
readonly AUDIT_COMPLIANCE: "auditCompliance";
|
|
257
258
|
readonly ADMIN: "admin";
|
|
259
|
+
readonly DOCUMENT: "documents";
|
|
260
|
+
readonly INVENTORY: "inventory";
|
|
261
|
+
readonly FARM_MANAGEMENT: "farmManagement";
|
|
262
|
+
readonly PACKHOUSE: "packhouse";
|
|
263
|
+
readonly ACCOMMODATION: "accommodation";
|
|
258
264
|
};
|
|
259
265
|
declare const AccessLevel: {
|
|
260
266
|
readonly NONE: "NONE";
|
package/dist/constants.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as ACCESS_RANK, a as ACT, b as AccessLevel, e as ApprovalStatus, f as ApprovalType, g as AuditStatus, h as AuditType, B as BarcodeNamespace, l as BarcodeType, C as CAR_SUPPORTED_EVIDENCE_MIME_TYPES, o as CAR_SUPPORTED_SIGNATURE_MIME_TYPES, p as CAT, q as CATEGORY_TABS, r as CORRECTIVE_ACTION_GENERATION_SOURCES, s as CORRECTIVE_ACTION_STATUSES, x as CatalogSyncStatus, G as CropCycleStatus, H as DOCUMENT_DISPLAY_INFO, I as DOCUMENT_MENU_MAP, J as DocumentCategory, K as DocumentType, L as ERROR_DICTIONARY, M as EVERYONE, N as EmitterType, O as EnabledModule, P as FORM_REGISTRY, Q as FacilityType, T as HarvestMethod, V as LinkedStatus, W as MOD, X as MODULE_LABELS, Y as MicroclimateZone, Z as MimeType, _ as ModCode, $ as NettingType, a1 as NotificationMode, a2 as OrderStatus, a4 as PhysicalState, a5 as PlantingMethod, a6 as ProductType, a8 as ProductUnit, aa as RESOURCE_MODULE_MAP, ab as RESOURCE_PATHS, ac as RESOURCE_REQUIREMENTS, ad as ROLE_SECTIONS_BY_KEY, ae as RelationshipType, ah as ResourceRequirement, aj as RowOrientation, ak as SENTINEL_UUID, al as SESSION_SCHEMA, am as SIGNATURE_MODES, ar as SoilTexture, as as StockPolicyTier, au as StoragePhases, aw as TASK_TYPE_REGISTRY, ax as TEMPLATE_SCOPE_LEVELS, az as TargetEntityType, aA as TaskStatus, aB as TaskType, aE as TransactionType, aF as TrellisType, aG as UserPrivilege, aI as UserRole, aL as VigorRating, aM as WaterSource } from './constants-
|
|
1
|
+
export { A as ACCESS_RANK, a as ACT, b as AccessLevel, e as ApprovalStatus, f as ApprovalType, g as AuditStatus, h as AuditType, B as BarcodeNamespace, l as BarcodeType, C as CAR_SUPPORTED_EVIDENCE_MIME_TYPES, o as CAR_SUPPORTED_SIGNATURE_MIME_TYPES, p as CAT, q as CATEGORY_TABS, r as CORRECTIVE_ACTION_GENERATION_SOURCES, s as CORRECTIVE_ACTION_STATUSES, x as CatalogSyncStatus, G as CropCycleStatus, H as DOCUMENT_DISPLAY_INFO, I as DOCUMENT_MENU_MAP, J as DocumentCategory, K as DocumentType, L as ERROR_DICTIONARY, M as EVERYONE, N as EmitterType, O as EnabledModule, P as FORM_REGISTRY, Q as FacilityType, T as HarvestMethod, V as LinkedStatus, W as MOD, X as MODULE_LABELS, Y as MicroclimateZone, Z as MimeType, _ as ModCode, $ as NettingType, a1 as NotificationMode, a2 as OrderStatus, a4 as PhysicalState, a5 as PlantingMethod, a6 as ProductType, a8 as ProductUnit, aa as RESOURCE_MODULE_MAP, ab as RESOURCE_PATHS, ac as RESOURCE_REQUIREMENTS, ad as ROLE_SECTIONS_BY_KEY, ae as RelationshipType, ah as ResourceRequirement, aj as RowOrientation, ak as SENTINEL_UUID, al as SESSION_SCHEMA, am as SIGNATURE_MODES, ar as SoilTexture, as as StockPolicyTier, au as StoragePhases, aw as TASK_TYPE_REGISTRY, ax as TEMPLATE_SCOPE_LEVELS, az as TargetEntityType, aA as TaskStatus, aB as TaskType, aE as TransactionType, aF as TrellisType, aG as UserPrivilege, aI as UserRole, aL as VigorRating, aM as WaterSource } from './constants-C0zV05Cf.mjs';
|
package/dist/constants.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as ACCESS_RANK, a as ACT, b as AccessLevel, e as ApprovalStatus, f as ApprovalType, g as AuditStatus, h as AuditType, B as BarcodeNamespace, l as BarcodeType, C as CAR_SUPPORTED_EVIDENCE_MIME_TYPES, o as CAR_SUPPORTED_SIGNATURE_MIME_TYPES, p as CAT, q as CATEGORY_TABS, r as CORRECTIVE_ACTION_GENERATION_SOURCES, s as CORRECTIVE_ACTION_STATUSES, x as CatalogSyncStatus, G as CropCycleStatus, H as DOCUMENT_DISPLAY_INFO, I as DOCUMENT_MENU_MAP, J as DocumentCategory, K as DocumentType, L as ERROR_DICTIONARY, M as EVERYONE, N as EmitterType, O as EnabledModule, P as FORM_REGISTRY, Q as FacilityType, T as HarvestMethod, V as LinkedStatus, W as MOD, X as MODULE_LABELS, Y as MicroclimateZone, Z as MimeType, _ as ModCode, $ as NettingType, a1 as NotificationMode, a2 as OrderStatus, a4 as PhysicalState, a5 as PlantingMethod, a6 as ProductType, a8 as ProductUnit, aa as RESOURCE_MODULE_MAP, ab as RESOURCE_PATHS, ac as RESOURCE_REQUIREMENTS, ad as ROLE_SECTIONS_BY_KEY, ae as RelationshipType, ah as ResourceRequirement, aj as RowOrientation, ak as SENTINEL_UUID, al as SESSION_SCHEMA, am as SIGNATURE_MODES, ar as SoilTexture, as as StockPolicyTier, au as StoragePhases, aw as TASK_TYPE_REGISTRY, ax as TEMPLATE_SCOPE_LEVELS, az as TargetEntityType, aA as TaskStatus, aB as TaskType, aE as TransactionType, aF as TrellisType, aG as UserPrivilege, aI as UserRole, aL as VigorRating, aM as WaterSource } from './constants-
|
|
1
|
+
export { A as ACCESS_RANK, a as ACT, b as AccessLevel, e as ApprovalStatus, f as ApprovalType, g as AuditStatus, h as AuditType, B as BarcodeNamespace, l as BarcodeType, C as CAR_SUPPORTED_EVIDENCE_MIME_TYPES, o as CAR_SUPPORTED_SIGNATURE_MIME_TYPES, p as CAT, q as CATEGORY_TABS, r as CORRECTIVE_ACTION_GENERATION_SOURCES, s as CORRECTIVE_ACTION_STATUSES, x as CatalogSyncStatus, G as CropCycleStatus, H as DOCUMENT_DISPLAY_INFO, I as DOCUMENT_MENU_MAP, J as DocumentCategory, K as DocumentType, L as ERROR_DICTIONARY, M as EVERYONE, N as EmitterType, O as EnabledModule, P as FORM_REGISTRY, Q as FacilityType, T as HarvestMethod, V as LinkedStatus, W as MOD, X as MODULE_LABELS, Y as MicroclimateZone, Z as MimeType, _ as ModCode, $ as NettingType, a1 as NotificationMode, a2 as OrderStatus, a4 as PhysicalState, a5 as PlantingMethod, a6 as ProductType, a8 as ProductUnit, aa as RESOURCE_MODULE_MAP, ab as RESOURCE_PATHS, ac as RESOURCE_REQUIREMENTS, ad as ROLE_SECTIONS_BY_KEY, ae as RelationshipType, ah as ResourceRequirement, aj as RowOrientation, ak as SENTINEL_UUID, al as SESSION_SCHEMA, am as SIGNATURE_MODES, ar as SoilTexture, as as StockPolicyTier, au as StoragePhases, aw as TASK_TYPE_REGISTRY, ax as TEMPLATE_SCOPE_LEVELS, az as TargetEntityType, aA as TaskStatus, aB as TaskType, aE as TransactionType, aF as TrellisType, aG as UserPrivilege, aI as UserRole, aL as VigorRating, aM as WaterSource } from './constants-C0zV05Cf.js';
|
package/dist/constants.js
CHANGED
|
@@ -103,7 +103,8 @@ var CAT = {
|
|
|
103
103
|
SUBSCRIPTION: "1",
|
|
104
104
|
PERMISSION: "2",
|
|
105
105
|
VALIDATION: "3",
|
|
106
|
-
INTEGRITY: "4"
|
|
106
|
+
INTEGRITY: "4",
|
|
107
|
+
DATABASE: "5"
|
|
107
108
|
};
|
|
108
109
|
var ACT = {
|
|
109
110
|
GENERIC: "00",
|
|
@@ -163,7 +164,12 @@ var UserPrivilege = {
|
|
|
163
164
|
HR: "hr",
|
|
164
165
|
MECHANIC: "mechanic",
|
|
165
166
|
AUDIT_COMPLIANCE: "auditCompliance",
|
|
166
|
-
ADMIN: "admin"
|
|
167
|
+
ADMIN: "admin",
|
|
168
|
+
DOCUMENT: "documents",
|
|
169
|
+
INVENTORY: "inventory",
|
|
170
|
+
FARM_MANAGEMENT: "farmManagement",
|
|
171
|
+
PACKHOUSE: "packhouse",
|
|
172
|
+
ACCOMMODATION: "accommodation"
|
|
167
173
|
};
|
|
168
174
|
var AccessLevel = {
|
|
169
175
|
NONE: "NONE",
|
|
@@ -594,23 +600,23 @@ var RESOURCE_REQUIREMENTS = {
|
|
|
594
600
|
// ── Records & Reports ──────────────────────────────────────────────────────
|
|
595
601
|
[RESOURCE_PATHS.documentHub]: {
|
|
596
602
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
597
|
-
requiredPrivileges: [UserPrivilege.
|
|
603
|
+
requiredPrivileges: [UserPrivilege.DOCUMENT]
|
|
598
604
|
},
|
|
599
605
|
[RESOURCE_PATHS.documentHubTemplates]: {
|
|
600
606
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
601
|
-
requiredPrivileges: [UserPrivilege.
|
|
607
|
+
requiredPrivileges: [UserPrivilege.DOCUMENT]
|
|
602
608
|
},
|
|
603
609
|
[RESOURCE_PATHS.documentHubFolder]: {
|
|
604
610
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
605
|
-
requiredPrivileges: [UserPrivilege.
|
|
611
|
+
requiredPrivileges: [UserPrivilege.DOCUMENT]
|
|
606
612
|
},
|
|
607
613
|
[RESOURCE_PATHS.documentHubExtraction]: {
|
|
608
614
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
609
|
-
requiredPrivileges: [UserPrivilege.
|
|
615
|
+
requiredPrivileges: [UserPrivilege.DOCUMENT]
|
|
610
616
|
},
|
|
611
617
|
[RESOURCE_PATHS.documentHubQueue]: {
|
|
612
618
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
613
|
-
requiredPrivileges: [UserPrivilege.ADMIN, UserPrivilege.AUDIT_COMPLIANCE, UserPrivilege.FINANCE, UserPrivilege.
|
|
619
|
+
requiredPrivileges: [UserPrivilege.ADMIN, UserPrivilege.AUDIT_COMPLIANCE, UserPrivilege.FINANCE, UserPrivilege.DOCUMENT]
|
|
614
620
|
},
|
|
615
621
|
// CONSUMABLES PERMISSIONS
|
|
616
622
|
[RESOURCE_PATHS.inventoryConsumableProduct]: {
|
package/dist/constants.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as AgriCoreSession, aJ as UserRoleAssignment, ao as ScopeType, aN as WireSession, ah as ResourceRequirement, c as AccessLevelType, j as AvailableScope, U as InfrastructureFields, S as FormMeta, ay as TabConfig, af as ResolvedError } from './constants-
|
|
2
|
-
export { A as ACCESS_RANK, a as ACT, b as AccessLevel, e as ApprovalStatus, f as ApprovalType, g as AuditStatus, h as AuditType, i as AuthScopeFields, B as BarcodeNamespace, k as BarcodeNamespaceType, l as BarcodeType, m as BarcodeTypeType, n as Base44Id, C as CAR_SUPPORTED_EVIDENCE_MIME_TYPES, o as CAR_SUPPORTED_SIGNATURE_MIME_TYPES, p as CAT, q as CATEGORY_TABS, r as CORRECTIVE_ACTION_GENERATION_SOURCES, s as CORRECTIVE_ACTION_STATUSES, t as CanonicalId, u as CarSupportedEvidenceMimeType, v as CarSupportedSignatureMimeType, w as CarTemplateFileMetadata, x as CatalogSyncStatus, y as CatalogSyncStatusType, z as CompanyConfig, D as CorrectiveActionCompileTaskMetadata, E as CorrectiveActionGenerationSource, F as CorrectiveActionStatus, G as CropCycleStatus, H as DOCUMENT_DISPLAY_INFO, I as DOCUMENT_MENU_MAP, J as DocumentCategory, K as DocumentType, L as ERROR_DICTIONARY, M as EVERYONE, N as EmitterType, O as EnabledModule, P as FORM_REGISTRY, Q as FacilityType, R as FileUploadTaskType, T as HarvestMethod, V as LinkedStatus, W as MOD, X as MODULE_LABELS, Y as MicroclimateZone, Z as MimeType, _ as ModCode, $ as NettingType, a0 as NormalizedSignatureValue, a1 as NotificationMode, a2 as OrderStatus, a3 as PermissionLevel, a4 as PhysicalState, a5 as PlantingMethod, a6 as ProductType, a7 as ProductTypeType, a8 as ProductUnit, a9 as ProductUnitType, aa as RESOURCE_MODULE_MAP, ab as RESOURCE_PATHS, ac as RESOURCE_REQUIREMENTS, ad as ROLE_SECTIONS_BY_KEY, ae as RelationshipType, ag as ResourceOverrides, ai as RoleAssignment, aj as RowOrientation, ak as SENTINEL_UUID, al as SESSION_SCHEMA, am as SIGNATURE_MODES, an as SchemaField, ap as SignatureInput, aq as SignatureMode, ar as SoilTexture, as as StockPolicyTier, at as StockPolicyTierType, au as StoragePhases, av as StorageType, aw as TASK_TYPE_REGISTRY, ax as TEMPLATE_SCOPE_LEVELS, az as TargetEntityType, aA as TaskStatus, aB as TaskType, aC as TaskTypeConfig, aD as TemplateScopeLevel, aE as TransactionType, aF as TrellisType, aG as UserPrivilege, aH as UserPrivilegeType, aI as UserRole, aK as UserRoleType, aL as VigorRating, aM as WaterSource } from './constants-
|
|
1
|
+
import { d as AgriCoreSession, aJ as UserRoleAssignment, ao as ScopeType, aN as WireSession, ah as ResourceRequirement, c as AccessLevelType, j as AvailableScope, U as InfrastructureFields, S as FormMeta, ay as TabConfig, af as ResolvedError } from './constants-C0zV05Cf.mjs';
|
|
2
|
+
export { A as ACCESS_RANK, a as ACT, b as AccessLevel, e as ApprovalStatus, f as ApprovalType, g as AuditStatus, h as AuditType, i as AuthScopeFields, B as BarcodeNamespace, k as BarcodeNamespaceType, l as BarcodeType, m as BarcodeTypeType, n as Base44Id, C as CAR_SUPPORTED_EVIDENCE_MIME_TYPES, o as CAR_SUPPORTED_SIGNATURE_MIME_TYPES, p as CAT, q as CATEGORY_TABS, r as CORRECTIVE_ACTION_GENERATION_SOURCES, s as CORRECTIVE_ACTION_STATUSES, t as CanonicalId, u as CarSupportedEvidenceMimeType, v as CarSupportedSignatureMimeType, w as CarTemplateFileMetadata, x as CatalogSyncStatus, y as CatalogSyncStatusType, z as CompanyConfig, D as CorrectiveActionCompileTaskMetadata, E as CorrectiveActionGenerationSource, F as CorrectiveActionStatus, G as CropCycleStatus, H as DOCUMENT_DISPLAY_INFO, I as DOCUMENT_MENU_MAP, J as DocumentCategory, K as DocumentType, L as ERROR_DICTIONARY, M as EVERYONE, N as EmitterType, O as EnabledModule, P as FORM_REGISTRY, Q as FacilityType, R as FileUploadTaskType, T as HarvestMethod, V as LinkedStatus, W as MOD, X as MODULE_LABELS, Y as MicroclimateZone, Z as MimeType, _ as ModCode, $ as NettingType, a0 as NormalizedSignatureValue, a1 as NotificationMode, a2 as OrderStatus, a3 as PermissionLevel, a4 as PhysicalState, a5 as PlantingMethod, a6 as ProductType, a7 as ProductTypeType, a8 as ProductUnit, a9 as ProductUnitType, aa as RESOURCE_MODULE_MAP, ab as RESOURCE_PATHS, ac as RESOURCE_REQUIREMENTS, ad as ROLE_SECTIONS_BY_KEY, ae as RelationshipType, ag as ResourceOverrides, ai as RoleAssignment, aj as RowOrientation, ak as SENTINEL_UUID, al as SESSION_SCHEMA, am as SIGNATURE_MODES, an as SchemaField, ap as SignatureInput, aq as SignatureMode, ar as SoilTexture, as as StockPolicyTier, at as StockPolicyTierType, au as StoragePhases, av as StorageType, aw as TASK_TYPE_REGISTRY, ax as TEMPLATE_SCOPE_LEVELS, az as TargetEntityType, aA as TaskStatus, aB as TaskType, aC as TaskTypeConfig, aD as TemplateScopeLevel, aE as TransactionType, aF as TrellisType, aG as UserPrivilege, aH as UserPrivilegeType, aI as UserRole, aK as UserRoleType, aL as VigorRating, aM as WaterSource } from './constants-C0zV05Cf.mjs';
|
|
3
3
|
|
|
4
4
|
declare const AgriLogger: {
|
|
5
5
|
log(level: "INFO" | "WARN" | "ERROR", message: string, meta: any): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as AgriCoreSession, aJ as UserRoleAssignment, ao as ScopeType, aN as WireSession, ah as ResourceRequirement, c as AccessLevelType, j as AvailableScope, U as InfrastructureFields, S as FormMeta, ay as TabConfig, af as ResolvedError } from './constants-
|
|
2
|
-
export { A as ACCESS_RANK, a as ACT, b as AccessLevel, e as ApprovalStatus, f as ApprovalType, g as AuditStatus, h as AuditType, i as AuthScopeFields, B as BarcodeNamespace, k as BarcodeNamespaceType, l as BarcodeType, m as BarcodeTypeType, n as Base44Id, C as CAR_SUPPORTED_EVIDENCE_MIME_TYPES, o as CAR_SUPPORTED_SIGNATURE_MIME_TYPES, p as CAT, q as CATEGORY_TABS, r as CORRECTIVE_ACTION_GENERATION_SOURCES, s as CORRECTIVE_ACTION_STATUSES, t as CanonicalId, u as CarSupportedEvidenceMimeType, v as CarSupportedSignatureMimeType, w as CarTemplateFileMetadata, x as CatalogSyncStatus, y as CatalogSyncStatusType, z as CompanyConfig, D as CorrectiveActionCompileTaskMetadata, E as CorrectiveActionGenerationSource, F as CorrectiveActionStatus, G as CropCycleStatus, H as DOCUMENT_DISPLAY_INFO, I as DOCUMENT_MENU_MAP, J as DocumentCategory, K as DocumentType, L as ERROR_DICTIONARY, M as EVERYONE, N as EmitterType, O as EnabledModule, P as FORM_REGISTRY, Q as FacilityType, R as FileUploadTaskType, T as HarvestMethod, V as LinkedStatus, W as MOD, X as MODULE_LABELS, Y as MicroclimateZone, Z as MimeType, _ as ModCode, $ as NettingType, a0 as NormalizedSignatureValue, a1 as NotificationMode, a2 as OrderStatus, a3 as PermissionLevel, a4 as PhysicalState, a5 as PlantingMethod, a6 as ProductType, a7 as ProductTypeType, a8 as ProductUnit, a9 as ProductUnitType, aa as RESOURCE_MODULE_MAP, ab as RESOURCE_PATHS, ac as RESOURCE_REQUIREMENTS, ad as ROLE_SECTIONS_BY_KEY, ae as RelationshipType, ag as ResourceOverrides, ai as RoleAssignment, aj as RowOrientation, ak as SENTINEL_UUID, al as SESSION_SCHEMA, am as SIGNATURE_MODES, an as SchemaField, ap as SignatureInput, aq as SignatureMode, ar as SoilTexture, as as StockPolicyTier, at as StockPolicyTierType, au as StoragePhases, av as StorageType, aw as TASK_TYPE_REGISTRY, ax as TEMPLATE_SCOPE_LEVELS, az as TargetEntityType, aA as TaskStatus, aB as TaskType, aC as TaskTypeConfig, aD as TemplateScopeLevel, aE as TransactionType, aF as TrellisType, aG as UserPrivilege, aH as UserPrivilegeType, aI as UserRole, aK as UserRoleType, aL as VigorRating, aM as WaterSource } from './constants-
|
|
1
|
+
import { d as AgriCoreSession, aJ as UserRoleAssignment, ao as ScopeType, aN as WireSession, ah as ResourceRequirement, c as AccessLevelType, j as AvailableScope, U as InfrastructureFields, S as FormMeta, ay as TabConfig, af as ResolvedError } from './constants-C0zV05Cf.js';
|
|
2
|
+
export { A as ACCESS_RANK, a as ACT, b as AccessLevel, e as ApprovalStatus, f as ApprovalType, g as AuditStatus, h as AuditType, i as AuthScopeFields, B as BarcodeNamespace, k as BarcodeNamespaceType, l as BarcodeType, m as BarcodeTypeType, n as Base44Id, C as CAR_SUPPORTED_EVIDENCE_MIME_TYPES, o as CAR_SUPPORTED_SIGNATURE_MIME_TYPES, p as CAT, q as CATEGORY_TABS, r as CORRECTIVE_ACTION_GENERATION_SOURCES, s as CORRECTIVE_ACTION_STATUSES, t as CanonicalId, u as CarSupportedEvidenceMimeType, v as CarSupportedSignatureMimeType, w as CarTemplateFileMetadata, x as CatalogSyncStatus, y as CatalogSyncStatusType, z as CompanyConfig, D as CorrectiveActionCompileTaskMetadata, E as CorrectiveActionGenerationSource, F as CorrectiveActionStatus, G as CropCycleStatus, H as DOCUMENT_DISPLAY_INFO, I as DOCUMENT_MENU_MAP, J as DocumentCategory, K as DocumentType, L as ERROR_DICTIONARY, M as EVERYONE, N as EmitterType, O as EnabledModule, P as FORM_REGISTRY, Q as FacilityType, R as FileUploadTaskType, T as HarvestMethod, V as LinkedStatus, W as MOD, X as MODULE_LABELS, Y as MicroclimateZone, Z as MimeType, _ as ModCode, $ as NettingType, a0 as NormalizedSignatureValue, a1 as NotificationMode, a2 as OrderStatus, a3 as PermissionLevel, a4 as PhysicalState, a5 as PlantingMethod, a6 as ProductType, a7 as ProductTypeType, a8 as ProductUnit, a9 as ProductUnitType, aa as RESOURCE_MODULE_MAP, ab as RESOURCE_PATHS, ac as RESOURCE_REQUIREMENTS, ad as ROLE_SECTIONS_BY_KEY, ae as RelationshipType, ag as ResourceOverrides, ai as RoleAssignment, aj as RowOrientation, ak as SENTINEL_UUID, al as SESSION_SCHEMA, am as SIGNATURE_MODES, an as SchemaField, ap as SignatureInput, aq as SignatureMode, ar as SoilTexture, as as StockPolicyTier, at as StockPolicyTierType, au as StoragePhases, av as StorageType, aw as TASK_TYPE_REGISTRY, ax as TEMPLATE_SCOPE_LEVELS, az as TargetEntityType, aA as TaskStatus, aB as TaskType, aC as TaskTypeConfig, aD as TemplateScopeLevel, aE as TransactionType, aF as TrellisType, aG as UserPrivilege, aH as UserPrivilegeType, aI as UserRole, aK as UserRoleType, aL as VigorRating, aM as WaterSource } from './constants-C0zV05Cf.js';
|
|
3
3
|
|
|
4
4
|
declare const AgriLogger: {
|
|
5
5
|
log(level: "INFO" | "WARN" | "ERROR", message: string, meta: any): void;
|
package/dist/index.js
CHANGED
|
@@ -389,7 +389,8 @@ var CAT = {
|
|
|
389
389
|
SUBSCRIPTION: "1",
|
|
390
390
|
PERMISSION: "2",
|
|
391
391
|
VALIDATION: "3",
|
|
392
|
-
INTEGRITY: "4"
|
|
392
|
+
INTEGRITY: "4",
|
|
393
|
+
DATABASE: "5"
|
|
393
394
|
};
|
|
394
395
|
var ACT = {
|
|
395
396
|
GENERIC: "00",
|
|
@@ -449,7 +450,12 @@ var UserPrivilege = {
|
|
|
449
450
|
HR: "hr",
|
|
450
451
|
MECHANIC: "mechanic",
|
|
451
452
|
AUDIT_COMPLIANCE: "auditCompliance",
|
|
452
|
-
ADMIN: "admin"
|
|
453
|
+
ADMIN: "admin",
|
|
454
|
+
DOCUMENT: "documents",
|
|
455
|
+
INVENTORY: "inventory",
|
|
456
|
+
FARM_MANAGEMENT: "farmManagement",
|
|
457
|
+
PACKHOUSE: "packhouse",
|
|
458
|
+
ACCOMMODATION: "accommodation"
|
|
453
459
|
};
|
|
454
460
|
var AccessLevel = {
|
|
455
461
|
NONE: "NONE",
|
|
@@ -880,23 +886,23 @@ var RESOURCE_REQUIREMENTS = {
|
|
|
880
886
|
// ── Records & Reports ──────────────────────────────────────────────────────
|
|
881
887
|
[RESOURCE_PATHS.documentHub]: {
|
|
882
888
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
883
|
-
requiredPrivileges: [UserPrivilege.
|
|
889
|
+
requiredPrivileges: [UserPrivilege.DOCUMENT]
|
|
884
890
|
},
|
|
885
891
|
[RESOURCE_PATHS.documentHubTemplates]: {
|
|
886
892
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
887
|
-
requiredPrivileges: [UserPrivilege.
|
|
893
|
+
requiredPrivileges: [UserPrivilege.DOCUMENT]
|
|
888
894
|
},
|
|
889
895
|
[RESOURCE_PATHS.documentHubFolder]: {
|
|
890
896
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
891
|
-
requiredPrivileges: [UserPrivilege.
|
|
897
|
+
requiredPrivileges: [UserPrivilege.DOCUMENT]
|
|
892
898
|
},
|
|
893
899
|
[RESOURCE_PATHS.documentHubExtraction]: {
|
|
894
900
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
895
|
-
requiredPrivileges: [UserPrivilege.
|
|
901
|
+
requiredPrivileges: [UserPrivilege.DOCUMENT]
|
|
896
902
|
},
|
|
897
903
|
[RESOURCE_PATHS.documentHubQueue]: {
|
|
898
904
|
allowedRoles: [UserRole.OWNER, UserRole.MANAGER, UserRole.SUPERVISOR],
|
|
899
|
-
requiredPrivileges: [UserPrivilege.ADMIN, UserPrivilege.AUDIT_COMPLIANCE, UserPrivilege.FINANCE, UserPrivilege.
|
|
905
|
+
requiredPrivileges: [UserPrivilege.ADMIN, UserPrivilege.AUDIT_COMPLIANCE, UserPrivilege.FINANCE, UserPrivilege.DOCUMENT]
|
|
900
906
|
},
|
|
901
907
|
// CONSUMABLES PERMISSIONS
|
|
902
908
|
[RESOURCE_PATHS.inventoryConsumableProduct]: {
|
|
@@ -1560,10 +1566,18 @@ function isTabWritable(session, activeScopeId, tabConfig) {
|
|
|
1560
1566
|
return resolveAccess(session, activeScopeId, tabConfig) === "WRITE";
|
|
1561
1567
|
}
|
|
1562
1568
|
function evaluateBaseAccess(resourcePath, session, activeScopeId, requirements = {}) {
|
|
1563
|
-
const
|
|
1569
|
+
const ancestry = getScopeAncestry(activeScopeId, session.availableScopes);
|
|
1570
|
+
const directRole = getRoleAt(session, activeScopeId);
|
|
1571
|
+
const inheritedRole = !directRole ? ancestry.slice(1).reduce(
|
|
1572
|
+
(found, scopeId) => found ?? getRoleAt(session, scopeId),
|
|
1573
|
+
null
|
|
1574
|
+
) : null;
|
|
1575
|
+
const role = directRole ?? inheritedRole;
|
|
1576
|
+
const isInherited = !directRole && !!inheritedRole;
|
|
1564
1577
|
const privileges = getPrivilegesAt(session, activeScopeId);
|
|
1565
1578
|
if (!role) return "NONE";
|
|
1566
|
-
if (role === UserRole.OWNER) return "WRITE";
|
|
1579
|
+
if (role === UserRole.OWNER) return isInherited ? "READ" : "WRITE";
|
|
1580
|
+
if (role === UserRole.MANAGER) return isInherited ? "READ" : "WRITE";
|
|
1567
1581
|
const requiredModules = RESOURCE_MODULE_MAP[resourcePath] || [];
|
|
1568
1582
|
if (requiredModules.length > 0) {
|
|
1569
1583
|
const hasModule = requiredModules.some((m) => session.enabledModules?.includes(m));
|
|
@@ -1577,7 +1591,7 @@ function evaluateBaseAccess(resourcePath, session, activeScopeId, requirements =
|
|
|
1577
1591
|
const hasPrivilege = requirements.requiredPrivileges.some((p) => privileges.includes(p));
|
|
1578
1592
|
if (!hasPrivilege) return "NONE";
|
|
1579
1593
|
}
|
|
1580
|
-
return
|
|
1594
|
+
return "READ";
|
|
1581
1595
|
}
|
|
1582
1596
|
function resolveEffectiveAccess(base, override) {
|
|
1583
1597
|
return override === void 0 || override === null ? base : override;
|
package/dist/index.mjs
CHANGED
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
UserRole,
|
|
63
63
|
VigorRating,
|
|
64
64
|
WaterSource
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-GZRAFNPA.mjs";
|
|
66
66
|
|
|
67
67
|
// src/index.ts
|
|
68
68
|
import { jwtVerify } from "jose";
|
|
@@ -553,10 +553,18 @@ function isTabWritable(session, activeScopeId, tabConfig) {
|
|
|
553
553
|
return resolveAccess(session, activeScopeId, tabConfig) === "WRITE";
|
|
554
554
|
}
|
|
555
555
|
function evaluateBaseAccess(resourcePath, session, activeScopeId, requirements = {}) {
|
|
556
|
-
const
|
|
556
|
+
const ancestry = getScopeAncestry(activeScopeId, session.availableScopes);
|
|
557
|
+
const directRole = getRoleAt(session, activeScopeId);
|
|
558
|
+
const inheritedRole = !directRole ? ancestry.slice(1).reduce(
|
|
559
|
+
(found, scopeId) => found ?? getRoleAt(session, scopeId),
|
|
560
|
+
null
|
|
561
|
+
) : null;
|
|
562
|
+
const role = directRole ?? inheritedRole;
|
|
563
|
+
const isInherited = !directRole && !!inheritedRole;
|
|
557
564
|
const privileges = getPrivilegesAt(session, activeScopeId);
|
|
558
565
|
if (!role) return "NONE";
|
|
559
|
-
if (role === UserRole.OWNER) return "WRITE";
|
|
566
|
+
if (role === UserRole.OWNER) return isInherited ? "READ" : "WRITE";
|
|
567
|
+
if (role === UserRole.MANAGER) return isInherited ? "READ" : "WRITE";
|
|
560
568
|
const requiredModules = RESOURCE_MODULE_MAP[resourcePath] || [];
|
|
561
569
|
if (requiredModules.length > 0) {
|
|
562
570
|
const hasModule = requiredModules.some((m) => session.enabledModules?.includes(m));
|
|
@@ -570,7 +578,7 @@ function evaluateBaseAccess(resourcePath, session, activeScopeId, requirements =
|
|
|
570
578
|
const hasPrivilege = requirements.requiredPrivileges.some((p) => privileges.includes(p));
|
|
571
579
|
if (!hasPrivilege) return "NONE";
|
|
572
580
|
}
|
|
573
|
-
return
|
|
581
|
+
return "READ";
|
|
574
582
|
}
|
|
575
583
|
function resolveEffectiveAccess(base, override) {
|
|
576
584
|
return override === void 0 || override === null ? base : override;
|