@xemahq/authorization-internal-api-client 0.4.14 → 0.4.15
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/endpoints/resources/resources.d.ts +11 -1
- package/dist/endpoints/resources/resources.js +22 -1
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.js +4 -0
- package/dist/models/listRegisteredResourcesDto.d.ts +9 -0
- package/dist/models/listRegisteredResourcesDto.js +7 -0
- package/dist/models/registerResourceOwnershipDto.d.ts +4 -2
- package/dist/models/registeredResourceDto.d.ts +12 -0
- package/dist/models/registeredResourceDto.js +2 -0
- package/dist/models/registeredResourcesDto.d.ts +10 -0
- package/dist/models/registeredResourcesDto.js +2 -0
- package/dist/models/registeredResourcesDtoDataEnvelope.d.ts +9 -0
- package/dist/models/registeredResourcesDtoDataEnvelope.js +2 -0
- package/dist/models/replaceResourceOwnershipDto.d.ts +12 -2
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Authorization API
|
|
4
4
|
* OpenAPI spec version: 0.1.1
|
|
5
5
|
*/
|
|
6
|
-
import type { AddResourceShareDto, ListVisibleResourcesDto, RegisterResourceOwnershipDto, RemoveResourceShareDto, ReplaceResourceOwnershipDto, ResourceOwnershipDtoDataEnvelope, ResourceOwnershipReadDtoDataEnvelope, VisibleResourcesDtoDataEnvelope } from '../../models';
|
|
6
|
+
import type { AddResourceShareDto, ListRegisteredResourcesDto, ListVisibleResourcesDto, RegisterResourceOwnershipDto, RegisteredResourcesDtoDataEnvelope, RemoveResourceShareDto, ReplaceResourceOwnershipDto, ResourceOwnershipDtoDataEnvelope, ResourceOwnershipReadDtoDataEnvelope, VisibleResourcesDtoDataEnvelope } from '../../models';
|
|
7
7
|
export declare const getResourcesControllerRegisterUrl: () => string;
|
|
8
8
|
/**
|
|
9
9
|
* Writes the ownership rows + OpenFGA tuples so the PDP ANDs the verb verdict with instance ownership. Idempotent (upsert + ignore-duplicate tuples). Org scope is forced from the caller context.
|
|
@@ -16,6 +16,16 @@ export declare const getResourcesControllerListVisibleUrl: () => string;
|
|
|
16
16
|
* @summary List the instances of a resource type a subject may see
|
|
17
17
|
*/
|
|
18
18
|
export declare const resourcesControllerListVisible: (listVisibleResourcesDto: ListVisibleResourcesDto, options?: RequestInit) => Promise<VisibleResourcesDtoDataEnvelope>;
|
|
19
|
+
export declare const getResourcesControllerListRegisteredUrl: () => string;
|
|
20
|
+
/**
|
|
21
|
+
* Every registered instance of `resourceType` in the caller org, with the subjects that OWN it. Org scope is forced from the caller context.
|
|
22
|
+
*
|
|
23
|
+
* This is NOT `resource.listVisible` with a privileged subject, and the difference is the reason it exists. `listVisible` answers "what may THIS SUBJECT see"; a service needing "what has this org registered" used to ask it about a subject it had made the owner of everything — which works only for as long as that fixed owner exists, and turns any later ownership change into a silent, total loss of the enumeration. A convergence pass built on the substitute does not just stop registering: it reads every live instance as registered-but-not-live and DEREGISTERS it.
|
|
24
|
+
*
|
|
25
|
+
* A POST rather than a GET because `resource.getOwnership` is mounted at `GET /resources/:type/:id`, which would shadow any `GET /resources/registered/...` shape; the body carries the one input.
|
|
26
|
+
* @summary List the instances of a resource type this ORG has registered
|
|
27
|
+
*/
|
|
28
|
+
export declare const resourcesControllerListRegistered: (listRegisteredResourcesDto: ListRegisteredResourcesDto, options?: RequestInit) => Promise<RegisteredResourcesDtoDataEnvelope>;
|
|
19
29
|
export declare const getResourcesControllerGetOwnershipUrl: (type: string, id: string) => string;
|
|
20
30
|
/**
|
|
21
31
|
* Returns the instance visibility and the combined set of registered subjects (owners + shares; the SQL authority does not split them). 404 when the instance was never registered.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resourcesControllerRemoveShare = exports.getResourcesControllerRemoveShareUrl = exports.resourcesControllerAddShare = exports.getResourcesControllerAddShareUrl = exports.resourcesControllerDeregister = exports.getResourcesControllerDeregisterUrl = exports.resourcesControllerReplaceOwnership = exports.getResourcesControllerReplaceOwnershipUrl = exports.resourcesControllerGetOwnership = exports.getResourcesControllerGetOwnershipUrl = exports.resourcesControllerListVisible = exports.getResourcesControllerListVisibleUrl = exports.resourcesControllerRegister = exports.getResourcesControllerRegisterUrl = void 0;
|
|
3
|
+
exports.resourcesControllerRemoveShare = exports.getResourcesControllerRemoveShareUrl = exports.resourcesControllerAddShare = exports.getResourcesControllerAddShareUrl = exports.resourcesControllerDeregister = exports.getResourcesControllerDeregisterUrl = exports.resourcesControllerReplaceOwnership = exports.getResourcesControllerReplaceOwnershipUrl = exports.resourcesControllerGetOwnership = exports.getResourcesControllerGetOwnershipUrl = exports.resourcesControllerListRegistered = exports.getResourcesControllerListRegisteredUrl = exports.resourcesControllerListVisible = exports.getResourcesControllerListVisibleUrl = exports.resourcesControllerRegister = exports.getResourcesControllerRegisterUrl = void 0;
|
|
4
4
|
const custom_fetch_1 = require("../../custom-fetch");
|
|
5
5
|
const getResourcesControllerRegisterUrl = () => {
|
|
6
6
|
return `/resources`;
|
|
@@ -36,6 +36,27 @@ const resourcesControllerListVisible = async (listVisibleResourcesDto, options)
|
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
38
|
exports.resourcesControllerListVisible = resourcesControllerListVisible;
|
|
39
|
+
const getResourcesControllerListRegisteredUrl = () => {
|
|
40
|
+
return `/resources/registered`;
|
|
41
|
+
};
|
|
42
|
+
exports.getResourcesControllerListRegisteredUrl = getResourcesControllerListRegisteredUrl;
|
|
43
|
+
/**
|
|
44
|
+
* Every registered instance of `resourceType` in the caller org, with the subjects that OWN it. Org scope is forced from the caller context.
|
|
45
|
+
*
|
|
46
|
+
* This is NOT `resource.listVisible` with a privileged subject, and the difference is the reason it exists. `listVisible` answers "what may THIS SUBJECT see"; a service needing "what has this org registered" used to ask it about a subject it had made the owner of everything — which works only for as long as that fixed owner exists, and turns any later ownership change into a silent, total loss of the enumeration. A convergence pass built on the substitute does not just stop registering: it reads every live instance as registered-but-not-live and DEREGISTERS it.
|
|
47
|
+
*
|
|
48
|
+
* A POST rather than a GET because `resource.getOwnership` is mounted at `GET /resources/:type/:id`, which would shadow any `GET /resources/registered/...` shape; the body carries the one input.
|
|
49
|
+
* @summary List the instances of a resource type this ORG has registered
|
|
50
|
+
*/
|
|
51
|
+
const resourcesControllerListRegistered = async (listRegisteredResourcesDto, options) => {
|
|
52
|
+
return (0, custom_fetch_1.customFetch)((0, exports.getResourcesControllerListRegisteredUrl)(), {
|
|
53
|
+
...options,
|
|
54
|
+
method: 'POST',
|
|
55
|
+
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
56
|
+
body: JSON.stringify(listRegisteredResourcesDto)
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
exports.resourcesControllerListRegistered = resourcesControllerListRegistered;
|
|
39
60
|
const getResourcesControllerGetOwnershipUrl = (type, id) => {
|
|
40
61
|
return `/resources/${type}/${id}`;
|
|
41
62
|
};
|
package/dist/models/index.d.ts
CHANGED
|
@@ -78,6 +78,7 @@ export * from './grantVersionResponseDtoDataEnvelope';
|
|
|
78
78
|
export * from './grantsControllerListParams';
|
|
79
79
|
export * from './impactedOutputRouteConsumerDto';
|
|
80
80
|
export * from './impactedOutputRouteConsumerDtoDataArrayEnvelope';
|
|
81
|
+
export * from './listRegisteredResourcesDto';
|
|
81
82
|
export * from './listVisibleResourcesDto';
|
|
82
83
|
export * from './object';
|
|
83
84
|
export * from './objectLifecycle';
|
|
@@ -134,8 +135,11 @@ export * from './provisionAgentResultDtoDataEnvelope';
|
|
|
134
135
|
export * from './provisionedCapabilityDto';
|
|
135
136
|
export * from './registerResourceOwnershipDto';
|
|
136
137
|
export * from './registerResourceRevisionDto';
|
|
138
|
+
export * from './registeredResourceDto';
|
|
137
139
|
export * from './registeredResourceRevisionDto';
|
|
138
140
|
export * from './registeredResourceRevisionDtoDataEnvelope';
|
|
141
|
+
export * from './registeredResourcesDto';
|
|
142
|
+
export * from './registeredResourcesDtoDataEnvelope';
|
|
139
143
|
export * from './relationshipsControllerListParams';
|
|
140
144
|
export * from './removeResourceShareDto';
|
|
141
145
|
export * from './replaceResourceOwnershipDto';
|
package/dist/models/index.js
CHANGED
|
@@ -95,6 +95,7 @@ __exportStar(require("./grantVersionResponseDtoDataEnvelope"), exports);
|
|
|
95
95
|
__exportStar(require("./grantsControllerListParams"), exports);
|
|
96
96
|
__exportStar(require("./impactedOutputRouteConsumerDto"), exports);
|
|
97
97
|
__exportStar(require("./impactedOutputRouteConsumerDtoDataArrayEnvelope"), exports);
|
|
98
|
+
__exportStar(require("./listRegisteredResourcesDto"), exports);
|
|
98
99
|
__exportStar(require("./listVisibleResourcesDto"), exports);
|
|
99
100
|
__exportStar(require("./object"), exports);
|
|
100
101
|
__exportStar(require("./objectLifecycle"), exports);
|
|
@@ -151,8 +152,11 @@ __exportStar(require("./provisionAgentResultDtoDataEnvelope"), exports);
|
|
|
151
152
|
__exportStar(require("./provisionedCapabilityDto"), exports);
|
|
152
153
|
__exportStar(require("./registerResourceOwnershipDto"), exports);
|
|
153
154
|
__exportStar(require("./registerResourceRevisionDto"), exports);
|
|
155
|
+
__exportStar(require("./registeredResourceDto"), exports);
|
|
154
156
|
__exportStar(require("./registeredResourceRevisionDto"), exports);
|
|
155
157
|
__exportStar(require("./registeredResourceRevisionDtoDataEnvelope"), exports);
|
|
158
|
+
__exportStar(require("./registeredResourcesDto"), exports);
|
|
159
|
+
__exportStar(require("./registeredResourcesDtoDataEnvelope"), exports);
|
|
156
160
|
__exportStar(require("./relationshipsControllerListParams"), exports);
|
|
157
161
|
__exportStar(require("./removeResourceShareDto"), exports);
|
|
158
162
|
__exportStar(require("./replaceResourceOwnershipDto"), exports);
|
|
@@ -13,8 +13,10 @@ export interface RegisterResourceOwnershipDto {
|
|
|
13
13
|
resourceId: string;
|
|
14
14
|
/** Instance visibility pattern. The PDP ANDs the verb verdict with the ownership check resolved per this pattern. */
|
|
15
15
|
visibility: ResourceVisibilityPattern;
|
|
16
|
-
/**
|
|
17
|
-
|
|
16
|
+
/** The `xema://` SPACE that owns the instance — an ADDRESS, which this service expands into the owner SUBJECTS its own vocabulary resolves it to (`xema://orgs/<id>` → the org-owner and org-admin role usersets; `xema://users/<id>` → that user). A producer knows the owning Space (`App.ownerSpaceUri`, `Skill.ownerSpaceUri`) and CANNOT know which subjects it resolves to, because those role instances are this service's own rows. Refused (400 `RESOURCE_OWNER_SPACE_NOT_ADMISSIBLE`) when the address is unparseable, names a tier the resource kind does not admit, names another organisation, or names a tier with no owner-subject expansion. May be combined with `owners`; the effective owner set is the UNION, de-duplicated. At least one of the two must yield an owner. */
|
|
17
|
+
ownerSpaceUri?: string;
|
|
18
|
+
/** Subjects that OWN the instance (full visibility), named explicitly. OPTIONAL only because `ownerSpaceUri` is the other way to say it — the service still refuses a request that yields no owner at all, so the ≥ 1-owner rule is unchanged. It moved from the DTO to the service because validation runs BEFORE the expansion and therefore cannot see the owners the address produces. */
|
|
19
|
+
owners?: ResourceSubjectRefDto[];
|
|
18
20
|
/** Subjects explicitly granted visibility, each at a LEVEL and with an optional expiry. */
|
|
19
21
|
explicitShares?: ResourceShareRefDto[];
|
|
20
22
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by @xemahq/api-client-generator — do not edit manually.
|
|
3
|
+
* Authorization API
|
|
4
|
+
* OpenAPI spec version: 0.1.1
|
|
5
|
+
*/
|
|
6
|
+
import type { ResourceSubjectRefDto } from './resourceSubjectRefDto.js';
|
|
7
|
+
export interface RegisteredResourceDto {
|
|
8
|
+
/** The registered instance id. */
|
|
9
|
+
resourceId: string;
|
|
10
|
+
/** Subjects holding an `owned_by` relation on the instance. Never empty: the write path refuses a registration with no owner. */
|
|
11
|
+
owners: ResourceSubjectRefDto[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by @xemahq/api-client-generator — do not edit manually.
|
|
3
|
+
* Authorization API
|
|
4
|
+
* OpenAPI spec version: 0.1.1
|
|
5
|
+
*/
|
|
6
|
+
import type { RegisteredResourceDto } from './registeredResourceDto.js';
|
|
7
|
+
export interface RegisteredResourcesDto {
|
|
8
|
+
/** Every registered instance of the requested kind in the caller org, ordered by instance id. */
|
|
9
|
+
resources: RegisteredResourceDto[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by @xemahq/api-client-generator — do not edit manually.
|
|
3
|
+
* Authorization API
|
|
4
|
+
* OpenAPI spec version: 0.1.1
|
|
5
|
+
*/
|
|
6
|
+
import type { RegisteredResourcesDto } from './registeredResourcesDto.js';
|
|
7
|
+
export interface RegisteredResourcesDtoDataEnvelope {
|
|
8
|
+
data: RegisteredResourcesDto;
|
|
9
|
+
}
|
|
@@ -9,8 +9,18 @@ import type { ResourceVisibilityPattern } from './resourceVisibilityPattern.js';
|
|
|
9
9
|
export interface ReplaceResourceOwnershipDto {
|
|
10
10
|
/** Instance visibility pattern. The PDP ANDs the verb verdict with the ownership check resolved per this pattern. */
|
|
11
11
|
visibility: ResourceVisibilityPattern;
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/** The `xema://` SPACE that owns the instance — an ADDRESS, which this service expands into the owner SUBJECTS its own vocabulary resolves it to (`xema://orgs/<id>` → the org-owner and org-admin role usersets; `xema://users/<id>` → that user). A producer knows the owning Space (`App.ownerSpaceUri`, `Skill.ownerSpaceUri`) and CANNOT know which subjects it resolves to, because those role instances are this service's own rows. Refused (400 `RESOURCE_OWNER_SPACE_NOT_ADMISSIBLE`) when the address is unparseable, names a tier the resource kind does not admit, names another organisation, or names a tier with no owner-subject expansion. May be combined with `owners`; the effective owner set is the UNION, de-duplicated. At least one of the two must yield an owner. */
|
|
13
|
+
ownerSpaceUri?: string;
|
|
14
|
+
/** Subjects that OWN the instance (full visibility), named explicitly. OPTIONAL only because `ownerSpaceUri` is the other way to say it — the service still refuses a request that yields no owner at all, so the ≥ 1-owner rule is unchanged. It moved from the DTO to the service because validation runs BEFORE the expansion and therefore cannot see the owners the address produces. */
|
|
15
|
+
owners?: ResourceSubjectRefDto[];
|
|
14
16
|
/** Subjects explicitly granted visibility, each at a LEVEL and with an optional expiry. */
|
|
15
17
|
explicitShares?: ResourceShareRefDto[];
|
|
18
|
+
/**
|
|
19
|
+
* Owners the caller is deliberately RETIRING. Named, never inferred.
|
|
20
|
+
*
|
|
21
|
+
* A replace normally REFUSES (409 `RESOURCE_SUBJECT_IS_OWNER`) to drop a registered owner, and that refusal is right: an owner silently absent from a replacement set is a caller bug, and the remedy is deregistering the instance. But deregister-then-register is not available for an ownership MIGRATION — the instance is UNREGISTERED in the window between them, and an unregistered instance resolves at the PDP as a verb-only ALLOW for everybody.
|
|
22
|
+
*
|
|
23
|
+
* So the exemption is per-SUBJECT and explicit: an owner named here is exempt from that probe and has its `owned_by` tuple dropped in the same call that writes the new owners. Naming a subject that is not a registered owner is a no-op, not an error — the migration is then idempotent on replay. A subject named in BOTH `retiringOwners` and `owners` is refused: that is two contradictory instructions about one subject, and either reading is a guess.
|
|
24
|
+
*/
|
|
25
|
+
retiringOwners?: ResourceSubjectRefDto[];
|
|
16
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/authorization-internal-api-client",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.15",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"service": "authorization-api",
|
|
20
20
|
"biome": "authorization",
|
|
21
21
|
"target": "server",
|
|
22
|
-
"generator": "@xemahq/api-client-generator@0.15.
|
|
22
|
+
"generator": "@xemahq/api-client-generator@0.15.2",
|
|
23
23
|
"source": "openapi.internal.json"
|
|
24
24
|
},
|
|
25
25
|
"license": "LicenseRef-Xema-BSL-1.1",
|