@ornncompute/cli 1.0.150 → 1.0.152
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/package.json +1 -1
- package/src/catalog-shell.mjs +17 -11
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
client for customer compute journeys and the explicit staff namespace. It
|
|
5
5
|
sends browser and CLI traffic only through the API gateway.
|
|
6
6
|
|
|
7
|
-
For
|
|
7
|
+
For customer installation and usage, see the [Ornn CLI guide](https://docs.ornn.com/cli).
|
|
8
8
|
The [shared capability catalog](../../packages/capabilities/README.md) is the authority for
|
|
9
9
|
command identity, role visibility, input schemas, help, and resource discovery.
|
|
10
10
|
The CLI imports `@ornn/capabilities/cli`; packaging includes its dependencies,
|
|
@@ -14,6 +14,8 @@ packages run without workspace links or React.
|
|
|
14
14
|
Native Commerce requests use the caller’s bearer directly through the gateway:
|
|
15
15
|
`/commerce/*` for public APIs and `/internal/v1/*` for staff APIs.
|
|
16
16
|
The gateway and Commerce enforce the caller’s organization and staff permissions.
|
|
17
|
+
Listing output follows the live session's
|
|
18
|
+
[visibility rules in the internal reference](../../docs/cli.md#staff-namespace).
|
|
17
19
|
All Commerce operations use `@ornn/api-client/commerce`, including the reservation
|
|
18
20
|
reads inside launch, connect, and evidence flows. Customer reservation pickers
|
|
19
21
|
explicitly scope every page to the selected organization, including for staff.
|
package/package.json
CHANGED
package/src/catalog-shell.mjs
CHANGED
|
@@ -788,16 +788,23 @@ const CUSTOMER_FORBIDDEN_FIELDS = {
|
|
|
788
788
|
};
|
|
789
789
|
const SUPPLIER_OWNER_FIELDS = { organizationId: true, organization_id: true };
|
|
790
790
|
|
|
791
|
-
//
|
|
792
|
-
function assertCustomerResultSafe(value,
|
|
791
|
+
// Native listings expose supplierId to their owner and to verified staff.
|
|
792
|
+
function assertCustomerResultSafe(value, listingSession) {
|
|
793
793
|
if (Array.isArray(value)) {
|
|
794
|
-
for (const item of value) assertCustomerResultSafe(item,
|
|
794
|
+
for (const item of value) assertCustomerResultSafe(item, listingSession);
|
|
795
795
|
return;
|
|
796
796
|
}
|
|
797
797
|
if (!value || typeof value !== "object") return;
|
|
798
|
+
const ownOrganizationId = listingSession?.selectedOrganization?.id;
|
|
798
799
|
const ownedBySupplier = supplierOwnedRecord(value);
|
|
799
800
|
for (const [key, child] of Object.entries(value)) {
|
|
800
|
-
if (
|
|
801
|
+
if (
|
|
802
|
+
key === "supplierId" &&
|
|
803
|
+
value.capacityListingId &&
|
|
804
|
+
typeof child === "string" &&
|
|
805
|
+
(listingSession?.role === "admin" || child === ownOrganizationId)
|
|
806
|
+
)
|
|
807
|
+
continue;
|
|
801
808
|
if (
|
|
802
809
|
CUSTOMER_FORBIDDEN_FIELDS[key] === true ||
|
|
803
810
|
(ownedBySupplier &&
|
|
@@ -809,7 +816,7 @@ function assertCustomerResultSafe(value, ownOrganizationId) {
|
|
|
809
816
|
"customer_result_unsafe"
|
|
810
817
|
);
|
|
811
818
|
}
|
|
812
|
-
assertCustomerResultSafe(child,
|
|
819
|
+
assertCustomerResultSafe(child, listingSession);
|
|
813
820
|
}
|
|
814
821
|
}
|
|
815
822
|
|
|
@@ -989,7 +996,7 @@ async function executeCapability(
|
|
|
989
996
|
`${resolveApiBaseUrl({ env: io.env })}/v1/orchestrator`)
|
|
990
997
|
: undefined;
|
|
991
998
|
const parsedInput = parseCapabilityInput(capability, rawInput);
|
|
992
|
-
let
|
|
999
|
+
let listingSession;
|
|
993
1000
|
let data;
|
|
994
1001
|
try {
|
|
995
1002
|
data = await (capability.cli?.execute ?? capability.execute)(
|
|
@@ -1009,12 +1016,11 @@ async function executeCapability(
|
|
|
1009
1016
|
: path;
|
|
1010
1017
|
return adminFetch(io, endpoint, init);
|
|
1011
1018
|
}
|
|
1012
|
-
if (capability.domain === "listings" &&
|
|
1013
|
-
//
|
|
1014
|
-
|
|
1019
|
+
if (capability.domain === "listings" && listingSession === undefined) {
|
|
1020
|
+
// Resolve listing visibility before the request, never after a committed mutation.
|
|
1021
|
+
listingSession = await getCliSession((path, init) =>
|
|
1015
1022
|
customerCapabilityFetch(io, path, init, authSnapshot)
|
|
1016
1023
|
);
|
|
1017
|
-
ownOrganizationId = session.selectedOrganization?.id ?? null;
|
|
1018
1024
|
}
|
|
1019
1025
|
return customerCapabilityFetch(io, path, init, authSnapshot);
|
|
1020
1026
|
},
|
|
@@ -1038,7 +1044,7 @@ async function executeCapability(
|
|
|
1038
1044
|
interaction?.close();
|
|
1039
1045
|
}
|
|
1040
1046
|
if (audience === "customer") {
|
|
1041
|
-
assertCustomerResultSafe(data,
|
|
1047
|
+
assertCustomerResultSafe(data, listingSession);
|
|
1042
1048
|
}
|
|
1043
1049
|
if (audience === "admin" || sessionCommand || isInteractionExecution(data)) return data;
|
|
1044
1050
|
return {
|