@odatano/core 2.0.0-rc.5 → 2.0.0-rc.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.
@@ -7,16 +7,24 @@ import * as __ from './../_';
7
7
  * Agent grants: scoped, budgeted bearer capabilities an Admin hands to an agent
8
8
  * instead of a full user (see AGENT_GRANTS_DESIGN.md).
9
9
  *
10
- * - CreateAgentGrant / RevokeAgentGrant: Admin-only administration. The token is
11
- * returned ONCE from CreateAgentGrant and stored as SHA-256 only.
10
+ * - CreateAgentGrant / UpdateAgentGrant / RotateAgentGrantToken / RevokeAgentGrant:
11
+ * Admin-only administration, rate limited per principal per hour
12
+ * (AGENT_GRANT_ADMIN_RATE_LIMIT, default 10). The token is returned ONCE from
13
+ * CreateAgentGrant and RotateAgentGrantToken and stored as SHA-256 only.
12
14
  * - AgentGrants: Admin-only projection (no token hash). A request carrying a token
13
15
  * runs as the principal `agent:<grantId>` with the role `agent-grant` and sees
14
16
  * exactly its own row through the row-level restriction below.
15
17
  * - GetGrantStatus: token self-service — what am I allowed to do, how much budget
16
18
  * is left, when do I expire. What an MCP tool needs to describe itself honestly.
19
+ * - GetGrantUsage: admitted calls per service and action over a window — an Admin
20
+ * for any grant, a token for its own (a partner usage view, ledger reconciliation).
21
+ *
22
+ * Names are this repo's PascalCase; semantics mirror NIGHTGATE's agent grants
23
+ * (createAgentGrant / updateAgentGrant / rotateAgentGrantToken / revokeAgentGrant /
24
+ * getGrantUsage), so a gateway drives both products with one code path.
17
25
  *
18
26
  * A token request never inherits the operator's roles: `@requires: 'Admin'` on the
19
- * two actions, on PauseWorker / ResumeWorker / pauseCrawler / resumeCrawler and on
27
+ * four actions, on PauseWorker / ResumeWorker / pauseCrawler / resumeCrawler and on
20
28
  * every other Admin surface therefore refuses it by construction. The allow list,
21
29
  * wallet pinning and daily budget are enforced by a before('*') hook on all six
22
30
  * ODATANO services (srv/utils/agent-grants.ts). The `x-agent-token` header only
@@ -27,6 +35,9 @@ export default class {
27
35
  static readonly GetGrantStatus: typeof GetGrantStatus;
28
36
  static readonly CreateAgentGrant: typeof CreateAgentGrant;
29
37
  static readonly RevokeAgentGrant: typeof RevokeAgentGrant;
38
+ static readonly RotateAgentGrantToken: typeof RotateAgentGrantToken;
39
+ static readonly UpdateAgentGrant: typeof UpdateAgentGrant;
40
+ static readonly GetGrantUsage: typeof GetGrantUsage;
30
41
  }
31
42
 
32
43
  // entity 'AgentGrant'
@@ -119,6 +130,69 @@ export declare function _IssuedGrantAspect<TBase extends new (...args: any[]) =>
119
130
  export class IssuedGrant extends _IssuedGrantAspect(__.Entity) {
120
131
  }
121
132
 
133
+ // entity 'RotatedGrant'
134
+ export declare function _RotatedGrantAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
135
+ new (...args: any[]): {
136
+ grantId?: string | null
137
+ token?: string | null
138
+ } & InstanceType<TBase>
139
+ readonly kind: 'type';
140
+ readonly keys: __.KeysOf<RotatedGrant>;
141
+ readonly elements: __.ElementsOf<RotatedGrant>;
142
+ readonly actions: globalThis.Record<never, never>;
143
+ };
144
+ export class RotatedGrant extends _RotatedGrantAspect(__.Entity) {
145
+ }
146
+
147
+ // entity 'UpdatedGrant'
148
+ export declare function _UpdatedGrantAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
149
+ new (...args: any[]): {
150
+ grantId?: string | null
151
+ updated?: Array<string>
152
+ } & InstanceType<TBase>
153
+ readonly kind: 'type';
154
+ readonly keys: __.KeysOf<UpdatedGrant>;
155
+ readonly elements: __.ElementsOf<UpdatedGrant>;
156
+ readonly actions: globalThis.Record<never, never>;
157
+ };
158
+ export class UpdatedGrant extends _UpdatedGrantAspect(__.Entity) {
159
+ }
160
+
161
+ // entity 'GrantUsageCall'
162
+ export declare function _GrantUsageCallAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
163
+ new (...args: any[]): {
164
+ service?: string | null
165
+ action?: string | null
166
+ count?: number | null
167
+ refunded?: number | null
168
+ } & InstanceType<TBase>
169
+ readonly kind: 'type';
170
+ readonly keys: __.KeysOf<GrantUsageCall>;
171
+ readonly elements: __.ElementsOf<GrantUsageCall>;
172
+ readonly actions: globalThis.Record<never, never>;
173
+ };
174
+ export class GrantUsageCall extends _GrantUsageCallAspect(__.Entity) {
175
+ }
176
+
177
+ // entity 'GrantUsage'
178
+ export declare function _GrantUsageAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
179
+ new (...args: any[]): {
180
+ grantId?: string | null
181
+ since?: __.CdsTimestamp | null
182
+ until?: __.CdsTimestamp | null
183
+ calls?: Array<GrantUsageCall>
184
+ total?: number | null
185
+ jobsUsedToday?: number | null
186
+ maxJobsPerDay?: number | null
187
+ } & InstanceType<TBase>
188
+ readonly kind: 'type';
189
+ readonly keys: __.KeysOf<GrantUsage>;
190
+ readonly elements: __.ElementsOf<GrantUsage>;
191
+ readonly actions: globalThis.Record<never, never>;
192
+ };
193
+ export class GrantUsage extends _GrantUsageAspect(__.Entity) {
194
+ }
195
+
122
196
 
123
197
  export declare const GetGrantStatus: {
124
198
  // positional
@@ -148,4 +222,34 @@ export declare const RevokeAgentGrant: {
148
222
  // metadata (do not use)
149
223
  __parameters: {grantId?: string | null}, __returns: globalThis.Promise<boolean | null> | boolean | null, __self: never
150
224
  kind: 'action'
225
+ }
226
+
227
+ export declare const RotateAgentGrantToken: {
228
+ // positional
229
+ (grantId: string | null): globalThis.Promise<RotatedGrant | null> | RotatedGrant | null
230
+ // named
231
+ ({grantId}: {grantId?: string | null}): globalThis.Promise<RotatedGrant | null> | RotatedGrant | null
232
+ // metadata (do not use)
233
+ __parameters: {grantId?: string | null}, __returns: globalThis.Promise<RotatedGrant | null> | RotatedGrant | null, __self: never
234
+ kind: 'action'
235
+ }
236
+
237
+ export declare const UpdateAgentGrant: {
238
+ // positional
239
+ (grantId: string | null, agentLabel: string | null, allowedActions: Array<string>, allowedJobKinds: Array<string>, maxJobsPerDay: number | null, validUntil: __.CdsTimestamp | null): globalThis.Promise<UpdatedGrant | null> | UpdatedGrant | null
240
+ // named
241
+ ({grantId, agentLabel, allowedActions, allowedJobKinds, maxJobsPerDay, validUntil}: {grantId?: string | null, agentLabel?: string | null, allowedActions?: Array<string>, allowedJobKinds?: Array<string>, maxJobsPerDay?: number | null, validUntil?: __.CdsTimestamp | null}): globalThis.Promise<UpdatedGrant | null> | UpdatedGrant | null
242
+ // metadata (do not use)
243
+ __parameters: {grantId?: string | null, agentLabel?: string | null, allowedActions?: Array<string>, allowedJobKinds?: Array<string>, maxJobsPerDay?: number | null, validUntil?: __.CdsTimestamp | null}, __returns: globalThis.Promise<UpdatedGrant | null> | UpdatedGrant | null, __self: never
244
+ kind: 'action'
245
+ }
246
+
247
+ export declare const GetGrantUsage: {
248
+ // positional
249
+ (grantId: string | null, since: __.CdsTimestamp | null, until: __.CdsTimestamp | null): globalThis.Promise<GrantUsage | null> | GrantUsage | null
250
+ // named
251
+ ({grantId, since, until}: {grantId?: string | null, since?: __.CdsTimestamp | null, until?: __.CdsTimestamp | null}): globalThis.Promise<GrantUsage | null> | GrantUsage | null
252
+ // metadata (do not use)
253
+ __parameters: {grantId?: string | null, since?: __.CdsTimestamp | null, until?: __.CdsTimestamp | null}, __returns: globalThis.Promise<GrantUsage | null> | GrantUsage | null, __self: never
254
+ kind: 'function'
151
255
  }
@@ -13,9 +13,24 @@ module.exports.__Array_GrantStatus_ = createEntityProxy(['CardanoAgentService',
13
13
  // IssuedGrant
14
14
  module.exports.IssuedGrant = createEntityProxy(['CardanoAgentService', 'IssuedGrant'], { target: { is_singular: true } })
15
15
  module.exports.__Array_IssuedGrant_ = createEntityProxy(['CardanoAgentService', 'IssuedGrant'], { target: { is_singular: false }})
16
+ // RotatedGrant
17
+ module.exports.RotatedGrant = createEntityProxy(['CardanoAgentService', 'RotatedGrant'], { target: { is_singular: true } })
18
+ module.exports.__Array_RotatedGrant_ = createEntityProxy(['CardanoAgentService', 'RotatedGrant'], { target: { is_singular: false }})
19
+ // UpdatedGrant
20
+ module.exports.UpdatedGrant = createEntityProxy(['CardanoAgentService', 'UpdatedGrant'], { target: { is_singular: true } })
21
+ module.exports.__Array_UpdatedGrant_ = createEntityProxy(['CardanoAgentService', 'UpdatedGrant'], { target: { is_singular: false }})
22
+ // GrantUsageCall
23
+ module.exports.GrantUsageCall = createEntityProxy(['CardanoAgentService', 'GrantUsageCall'], { target: { is_singular: true } })
24
+ module.exports.__Array_GrantUsageCall_ = createEntityProxy(['CardanoAgentService', 'GrantUsageCall'], { target: { is_singular: false }})
25
+ // GrantUsage
26
+ module.exports.GrantUsage = createEntityProxy(['CardanoAgentService', 'GrantUsage'], { target: { is_singular: true } })
27
+ module.exports.__Array_GrantUsage_ = createEntityProxy(['CardanoAgentService', 'GrantUsage'], { target: { is_singular: false }})
16
28
  // events
17
29
  // actions
18
30
  module.exports.GetGrantStatus = 'GetGrantStatus'
19
31
  module.exports.CreateAgentGrant = 'CreateAgentGrant'
20
32
  module.exports.RevokeAgentGrant = 'RevokeAgentGrant'
33
+ module.exports.RotateAgentGrantToken = 'RotateAgentGrantToken'
34
+ module.exports.UpdateAgentGrant = 'UpdateAgentGrant'
35
+ module.exports.GetGrantUsage = 'GetGrantUsage'
21
36
  // enums
@@ -10,11 +10,19 @@ import * as __ from './../_';
10
10
  * - status function + pause/resume actions delegating to the crawler singleton
11
11
  *
12
12
  * Security note: see CardanoODataService (cardano-service.cds) for the rationale on
13
- * service-level auth. pause/resume are operational actions — gate behind a dedicated
14
- * Admin scope. Read-only status and audit data remain available to authenticated users.
13
+ * auth. pause/resume are operational actions — gate behind a dedicated Admin scope.
14
+ * Read-only status and audit data remain available to authenticated users.
15
+ *
16
+ * Deliberately NO service-level @requires: CAP checks a service-level requirement
17
+ * on every request BEFORE the operation's own annotation, so an operation-level
18
+ * `@requires: 'any'` can never open a single function on an otherwise
19
+ * authenticated service (anonymous callers get the 401 challenge first). The
20
+ * requirement therefore sits on each element, and getLiveness() alone is 'any' —
21
+ * the same layout as NIGHTGATE's indexer service.
15
22
  */
16
23
  export default class {
17
24
  static readonly getStatus: typeof getStatus;
25
+ static readonly getLiveness: typeof getLiveness;
18
26
  static readonly pauseCrawler: typeof pauseCrawler;
19
27
  static readonly resumeCrawler: typeof resumeCrawler;
20
28
  }
@@ -93,6 +101,23 @@ export declare function _CrawlerStatusAspect<TBase extends new (...args: any[])
93
101
  export class CrawlerStatus extends _CrawlerStatusAspect(__.Entity) {
94
102
  }
95
103
 
104
+ // entity 'Liveness'
105
+ export declare function _LivenessAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
106
+ new (...args: any[]): {
107
+ status?: string | null
108
+ timestamp?: __.CdsTimestamp | null
109
+ uptime?: number | null
110
+ version?: string | null
111
+ network?: string | null
112
+ } & InstanceType<TBase>
113
+ readonly kind: 'type';
114
+ readonly keys: __.KeysOf<Liveness>;
115
+ readonly elements: __.ElementsOf<Liveness>;
116
+ readonly actions: globalThis.Record<never, never>;
117
+ };
118
+ export class Liveness extends _LivenessAspect(__.Entity) {
119
+ }
120
+
96
121
  // event
97
122
  export declare class blockIndexed {
98
123
  readonly kind: 'event';
@@ -121,6 +146,16 @@ export declare const getStatus: {
121
146
  kind: 'function'
122
147
  }
123
148
 
149
+ export declare const getLiveness: {
150
+ // positional
151
+ (): globalThis.Promise<Liveness | null> | Liveness | null
152
+ // named
153
+ ({}: globalThis.Record<never, never>): globalThis.Promise<Liveness | null> | Liveness | null
154
+ // metadata (do not use)
155
+ __parameters: globalThis.Record<never, never>, __returns: globalThis.Promise<Liveness | null> | Liveness | null, __self: never
156
+ kind: 'function'
157
+ }
158
+
124
159
  export declare const pauseCrawler: {
125
160
  // positional
126
161
  (): globalThis.Promise<boolean | null> | boolean | null
@@ -13,11 +13,15 @@ module.exports.ReorgLog_ = createEntityProxy(['CardanoIndexerService', 'ReorgLog
13
13
  // CrawlerStatus
14
14
  module.exports.CrawlerStatus = createEntityProxy(['CardanoIndexerService', 'CrawlerStatus'], { target: { is_singular: true } })
15
15
  module.exports.__Array_CrawlerStatus_ = createEntityProxy(['CardanoIndexerService', 'CrawlerStatus'], { target: { is_singular: false }})
16
+ // Liveness
17
+ module.exports.Liveness = createEntityProxy(['CardanoIndexerService', 'Liveness'], { target: { is_singular: true } })
18
+ module.exports.__Array_Liveness_ = createEntityProxy(['CardanoIndexerService', 'Liveness'], { target: { is_singular: false }})
16
19
  // events
17
20
  module.exports.blockIndexed = 'CardanoIndexerService.blockIndexed'
18
21
  module.exports.reorg = 'CardanoIndexerService.reorg'
19
22
  // actions
20
23
  module.exports.getStatus = 'getStatus'
24
+ module.exports.getLiveness = 'getLiveness'
21
25
  module.exports.pauseCrawler = 'pauseCrawler'
22
26
  module.exports.resumeCrawler = 'resumeCrawler'
23
27
  // enums
@@ -12,8 +12,11 @@ import * as _odatano_cardano from './../odatano/cardano';
12
12
  * - Submitting verified transactions to the blockchain and tracking submission status
13
13
  * - Providing actions for signing with a Hardware Security Module (HSM) and retrieving HSM status
14
14
  *
15
- * Security note: see CardanoODataService (cardano-service.cds) for the rationale
16
- * on service-level auth without per-resource ownership enforcement.
15
+ * Security note: see CardanoODataService (cardano-service.cds) for the rationale on auth
16
+ * without per-resource ownership enforcement. Deliberately NO service-level @requires:
17
+ * CAP checks it on every request BEFORE the operation annotation, which silenced the
18
+ * `any` on VerifyDataSignature (anonymous callers got the 401 challenge first). The
19
+ * requirement therefore sits on each element; VerifyDataSignature alone is public.
17
20
  */
18
21
  export default class {
19
22
  static readonly VerifySignature: typeof VerifySignature;
@@ -1008,3 +1008,39 @@ export class CardanoAgentGrant extends _CardanoAgentGrantAspect(__.Entity) {
1008
1008
  export class CardanoAgentGrants extends Array<CardanoAgentGrant> {
1009
1009
  $count?: number
1010
1010
  }
1011
+
1012
+ // entity 'CardanoAgentGrantUsage'
1013
+ export declare function _CardanoAgentGrantUsageAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
1014
+ new (...args: any[]): {
1015
+ grant?: __.Key<__.Association.to<CardanoAgentGrant>>
1016
+ grant_ID?: __.Key<string>
1017
+ day?: __.Key<string>
1018
+ service?: __.Key<string>
1019
+ action?: __.Key<string>
1020
+ calls?: number | null
1021
+ refunded?: number | null
1022
+ } & InstanceType<TBase>
1023
+ readonly kind: 'entity';
1024
+ readonly keys: __.KeysOf<CardanoAgentGrantUsage>;
1025
+ readonly elements: __.ElementsOf<CardanoAgentGrantUsage>;
1026
+ readonly actions: globalThis.Record<never, never>;
1027
+ };
1028
+ /**
1029
+ * Daily per-action counters of admitted calls under a grant (feeds
1030
+ * CardanoAgentService.GetGrantUsage). Written by the enforcement hook next to
1031
+ * the daily budget: `calls + 1` when a call is admitted, `refunded + 1` when the
1032
+ * handler then refuses its input. Not exposed as an entity — the function is
1033
+ * the contract. A few dozen rows per grant and day at most; no retention job yet.
1034
+ */
1035
+ export class CardanoAgentGrantUsage extends _CardanoAgentGrantUsageAspect(__.Entity) {
1036
+ }
1037
+ /**
1038
+ * Daily per-action counters of admitted calls under a grant (feeds
1039
+ * CardanoAgentService.GetGrantUsage). Written by the enforcement hook next to
1040
+ * the daily budget: `calls + 1` when a call is admitted, `refunded + 1` when the
1041
+ * handler then refuses its input. Not exposed as an entity — the function is
1042
+ * the contract. A few dozen rows per grant and day at most; no retention job yet.
1043
+ */
1044
+ export class CardanoAgentGrantUsage_ extends Array<CardanoAgentGrantUsage> {
1045
+ $count?: number
1046
+ }
@@ -108,6 +108,9 @@ module.exports.CardanoWalletJobs = createEntityProxy(['odatano.cardano', 'Cardan
108
108
  // CardanoAgentGrants
109
109
  module.exports.CardanoAgentGrant = createEntityProxy(['odatano.cardano', 'CardanoAgentGrants'], { target: { is_singular: true } })
110
110
  module.exports.CardanoAgentGrants = createEntityProxy(['odatano.cardano', 'CardanoAgentGrants'], { target: { is_singular: false }})
111
+ // CardanoAgentGrantUsage
112
+ module.exports.CardanoAgentGrantUsage = createEntityProxy(['odatano.cardano', 'CardanoAgentGrantUsage'], { target: { is_singular: true } })
113
+ module.exports.CardanoAgentGrantUsage_ = createEntityProxy(['odatano.cardano', 'CardanoAgentGrantUsage'], { target: { is_singular: false }})
111
114
  // events
112
115
  // actions
113
116
  // enums