@atlasauth/backend 0.24.0 → 0.26.0
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/CHANGELOG.md +39 -1
- package/dist/client/abac.d.ts +521 -0
- package/dist/client/abac.js +146 -0
- package/dist/client/abac.js.map +1 -0
- package/dist/client/access-policies.d.ts +100 -0
- package/dist/client/access-policies.js +29 -0
- package/dist/client/access-policies.js.map +1 -0
- package/dist/client/action-gallery.d.ts +1 -1
- package/dist/client/action-gallery.js.map +1 -1
- package/dist/client/actions.d.ts +129 -6
- package/dist/client/actions.js +4 -0
- package/dist/client/actions.js.map +1 -1
- package/dist/client/analytics-reports.d.ts +215 -0
- package/dist/client/analytics-reports.js +56 -0
- package/dist/client/analytics-reports.js.map +1 -0
- package/dist/client/app-catalog.d.ts +74 -0
- package/dist/client/app-catalog.js +30 -0
- package/dist/client/app-catalog.js.map +1 -0
- package/dist/client/attack-protection.d.ts +10 -0
- package/dist/client/attack-protection.js +8 -0
- package/dist/client/attack-protection.js.map +1 -1
- package/dist/client/audit-events.d.ts +71 -0
- package/dist/client/audit-events.js +28 -0
- package/dist/client/audit-events.js.map +1 -1
- package/dist/client/authz-decisions.d.ts +108 -0
- package/dist/client/authz-decisions.js +40 -0
- package/dist/client/authz-decisions.js.map +1 -0
- package/dist/client/connections.d.ts +507 -0
- package/dist/client/connections.js +164 -0
- package/dist/client/connections.js.map +1 -0
- package/dist/client/credentials.d.ts +8 -0
- package/dist/client/credentials.js.map +1 -1
- package/dist/client/custom-oauth-providers.d.ts +15 -0
- package/dist/client/custom-oauth-providers.js.map +1 -1
- package/dist/client/delegated-ui-proxy.d.ts +25 -0
- package/dist/client/delegated-ui-proxy.js +46 -0
- package/dist/client/delegated-ui-proxy.js.map +1 -0
- package/dist/client/desktop-mfa.d.ts +104 -0
- package/dist/client/desktop-mfa.js +44 -0
- package/dist/client/desktop-mfa.js.map +1 -0
- package/dist/client/devices.d.ts +44 -0
- package/dist/client/devices.js +26 -0
- package/dist/client/devices.js.map +1 -0
- package/dist/client/email-templates.d.ts +1 -1
- package/dist/client/email-templates.js.map +1 -1
- package/dist/client/fga.d.ts +125 -4
- package/dist/client/fga.js +40 -0
- package/dist/client/fga.js.map +1 -1
- package/dist/client/flags.d.ts +101 -0
- package/dist/client/flags.js +104 -0
- package/dist/client/flags.js.map +1 -0
- package/dist/client/groups.d.ts +146 -0
- package/dist/client/groups.js +67 -0
- package/dist/client/groups.js.map +1 -0
- package/dist/client/identity-verification.d.ts +62 -0
- package/dist/client/identity-verification.js +39 -0
- package/dist/client/identity-verification.js.map +1 -0
- package/dist/client/iga.d.ts +436 -0
- package/dist/client/iga.js +82 -0
- package/dist/client/iga.js.map +1 -0
- package/dist/client/index.d.ts +1433 -4
- package/dist/client/index.js +96 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/journeys.d.ts +108 -0
- package/dist/client/journeys.js +35 -0
- package/dist/client/journeys.js.map +1 -0
- package/dist/client/least-privilege.d.ts +95 -0
- package/dist/client/least-privilege.js +28 -0
- package/dist/client/least-privilege.js.map +1 -0
- package/dist/client/log-streams.d.ts +1 -1
- package/dist/client/managed-grants.d.ts +52 -0
- package/dist/client/managed-grants.js +28 -0
- package/dist/client/managed-grants.js.map +1 -0
- package/dist/client/marketing.d.ts +67 -0
- package/dist/client/marketing.js +26 -0
- package/dist/client/marketing.js.map +1 -0
- package/dist/client/mcp-gateways.d.ts +126 -0
- package/dist/client/mcp-gateways.js +47 -0
- package/dist/client/mcp-gateways.js.map +1 -0
- package/dist/client/messaging.d.ts +14 -3
- package/dist/client/messaging.js.map +1 -1
- package/dist/client/mfa-factors.d.ts +120 -0
- package/dist/client/mfa-factors.js +73 -0
- package/dist/client/mfa-factors.js.map +1 -0
- package/dist/client/migrations.d.ts +1 -1
- package/dist/client/migrations.js.map +1 -1
- package/dist/client/network-acls.d.ts +6 -1
- package/dist/client/network-acls.js.map +1 -1
- package/dist/client/network-zones.d.ts +56 -0
- package/dist/client/network-zones.js +29 -0
- package/dist/client/network-zones.js.map +1 -0
- package/dist/client/notifications.d.ts +1 -1
- package/dist/client/notifications.js.map +1 -1
- package/dist/client/oauth-clients.d.ts +187 -3
- package/dist/client/oauth-clients.js +64 -0
- package/dist/client/oauth-clients.js.map +1 -1
- package/dist/client/openfga.d.ts +90 -3
- package/dist/client/openfga.js +27 -1
- package/dist/client/openfga.js.map +1 -1
- package/dist/client/org-role-grants.d.ts +57 -0
- package/dist/client/org-role-grants.js +40 -0
- package/dist/client/org-role-grants.js.map +1 -0
- package/dist/client/organizations.d.ts +52 -0
- package/dist/client/organizations.js +44 -0
- package/dist/client/organizations.js.map +1 -1
- package/dist/client/page-templates.d.ts +78 -0
- package/dist/client/page-templates.js +31 -0
- package/dist/client/page-templates.js.map +1 -0
- package/dist/client/passkey-api.d.ts +73 -0
- package/dist/client/passkey-api.js +34 -0
- package/dist/client/passkey-api.js.map +1 -0
- package/dist/client/policy-bundles.d.ts +105 -0
- package/dist/client/policy-bundles.js +38 -0
- package/dist/client/policy-bundles.js.map +1 -0
- package/dist/client/resources.d.ts +150 -0
- package/dist/client/resources.js +73 -0
- package/dist/client/resources.js.map +1 -0
- package/dist/client/risk-based-mfa.d.ts +147 -0
- package/dist/client/risk-based-mfa.js +30 -0
- package/dist/client/risk-based-mfa.js.map +1 -1
- package/dist/client/roles.d.ts +4 -0
- package/dist/client/roles.js.map +1 -1
- package/dist/client/service-connectors.d.ts +83 -0
- package/dist/client/service-connectors.js +33 -0
- package/dist/client/service-connectors.js.map +1 -0
- package/dist/client/ssf.d.ts +112 -0
- package/dist/client/ssf.js +49 -0
- package/dist/client/ssf.js.map +1 -0
- package/dist/client/sso-onboarding.d.ts +6 -0
- package/dist/client/sso-onboarding.js.map +1 -1
- package/dist/client/users.d.ts +302 -0
- package/dist/client/users.js +125 -0
- package/dist/client/users.js.map +1 -1
- package/dist/client/vault.d.ts +85 -0
- package/dist/client/vault.js +50 -0
- package/dist/client/vault.js.map +1 -0
- package/dist/client/vc.d.ts +136 -0
- package/dist/client/vc.js +43 -0
- package/dist/client/vc.js.map +1 -0
- package/dist/client/webhooks.d.ts +31 -2
- package/dist/client/webhooks.js.map +1 -1
- package/dist/client/workflows.d.ts +131 -0
- package/dist/client/workflows.js +36 -0
- package/dist/client/workflows.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/magic-did.d.ts +5 -0
- package/dist/magic-did.js +49 -0
- package/dist/magic-did.js.map +1 -0
- package/dist/migration-bridge.d.ts +9 -0
- package/dist/migration-bridge.js +28 -2
- package/dist/migration-bridge.js.map +1 -1
- package/dist/migration-presets-g3.d.ts +2 -0
- package/dist/migration-presets-g3.js +254 -0
- package/dist/migration-presets-g3.js.map +1 -0
- package/dist/migration-presets-g4/authentik.d.ts +14 -0
- package/dist/migration-presets-g4/authentik.js +37 -0
- package/dist/migration-presets-g4/authentik.js.map +1 -0
- package/dist/migration-presets-g4/fusionauth.d.ts +2 -0
- package/dist/migration-presets-g4/fusionauth.js +52 -0
- package/dist/migration-presets-g4/fusionauth.js.map +1 -0
- package/dist/migration-presets-g4/hanko.d.ts +12 -0
- package/dist/migration-presets-g4/hanko.js +46 -0
- package/dist/migration-presets-g4/hanko.js.map +1 -0
- package/dist/migration-presets-g4/keycloak.d.ts +16 -0
- package/dist/migration-presets-g4/keycloak.js +37 -0
- package/dist/migration-presets-g4/keycloak.js.map +1 -0
- package/dist/migration-presets-g4/logto.d.ts +12 -0
- package/dist/migration-presets-g4/logto.js +35 -0
- package/dist/migration-presets-g4/logto.js.map +1 -0
- package/dist/migration-presets-g4/ory.d.ts +2 -0
- package/dist/migration-presets-g4/ory.js +67 -0
- package/dist/migration-presets-g4/ory.js.map +1 -0
- package/dist/migration-presets-g4/supertokens.d.ts +13 -0
- package/dist/migration-presets-g4/supertokens.js +35 -0
- package/dist/migration-presets-g4/supertokens.js.map +1 -0
- package/dist/migration-presets-g4/zitadel.d.ts +2 -0
- package/dist/migration-presets-g4/zitadel.js +36 -0
- package/dist/migration-presets-g4/zitadel.js.map +1 -0
- package/dist/migration-presets-g4.d.ts +10 -0
- package/dist/migration-presets-g4.js +30 -0
- package/dist/migration-presets-g4.js.map +1 -0
- package/dist/migration-presets.d.ts +6 -0
- package/dist/migration-presets.js +102 -6
- package/dist/migration-presets.js.map +1 -1
- package/dist/policy-bundle.d.ts +110 -0
- package/dist/policy-bundle.js +289 -0
- package/dist/policy-bundle.js.map +1 -0
- package/dist/request-auth.d.ts +32 -0
- package/dist/request-auth.js +72 -0
- package/dist/request-auth.js.map +1 -0
- package/dist/uma.d.ts +77 -0
- package/dist/uma.js +95 -0
- package/dist/uma.js.map +1 -0
- package/dist/verify.d.ts +2 -0
- package/dist/verify.js.map +1 -1
- package/dist/workos-session.d.ts +30 -0
- package/dist/workos-session.js +123 -0
- package/dist/workos-session.js.map +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
# @atlasauth/backend changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.26.0 — 2026-10-27
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `iga` client resource: identity governance (access catalog, access requests and approvals, grants, delegations, separation-of-duties rules, joiner/mover/leaver lifecycle, certification campaigns).
|
|
8
|
+
- `desktopMfa` client resource: the desktop login MFA policy, enrolment codes and enrolled devices (`getPolicy`, `updatePolicy`, `createEnrolmentCode`, `listDevices`, `getDevice`, `revokeDevice`, `revokeOfflineCache`, `deleteDevice`).
|
|
9
|
+
- `managedGrants` client resource (`list`, `get`, `narrow`, `revoke`): the OpenID Grant Management grants each OAuth client holds for each user.
|
|
10
|
+
- `leastPrivilege` client resource (`report`, `get`, `exportCsv`, and applying the narrower grants with a `dryRun` preview): what each secret key, OAuth client, MCP gateway and agent holds against what it used.
|
|
11
|
+
- `mcpGateways` gains `abac` (policy checks on every tool call) and `budgets` (`list`, `create`, `get`, `update`, `delete`, `usage`).
|
|
12
|
+
- `fga.settings.get` / `fga.settings.update`: the instance's FGA result-cache lifetime, default consistency mode and tuple change-log retention.
|
|
13
|
+
|
|
14
|
+
- `connections.token` now caches per client until shortly before `expires_at` and takes `minTtlSeconds`; new `connections.refreshToken` (force-refresh after a provider 401, with `staleAccessToken`), `connections.tokens` (batch read of up to 100), `connections.importConnections` and `connections.exportConnections` (sealed to your public key); `connections.delete(id, { revoke: true })`. `Connection` gains `refresh_failures`, `next_refresh_at` and a typed `last_error` with the provider's code and HTTP status.
|
|
15
|
+
- `connections.revoke` returns `provider_revoked`, `provider_status`, `provider_error` and `local_cleared`.
|
|
16
|
+
- Webhook event types `connection.refresh_failed`, `connection.reauthorization_required`, `connection.revoked`, `connection.scopes_changed`, `connection.recovered`.
|
|
17
|
+
- Connections: `setCredentials`, `rotateCredentials`, `secretVersions`, `secret` (scope `connections:secret_read`), `oauth1Sign`, `webhooks.verify` and `webhooks.*Endpoint`; `token()` takes `subject` for delegated tokens; `Connection` reports `secret_expires_at`, `previous_valid_until` and `allowed_methods`.
|
|
18
|
+
- `connections` client resource: `create`, `list`, `get`, `update` (including `owner` to transfer), `delete`, `connect`, `revoke`, `token` (needs the `connections:token` scope) and `oauthClients` (`set`, `list`, `get`, `delete`), with `host_params`, `environment` and the captured token fields typed.
|
|
19
|
+
- ABAC data filtering: `abac.partialEvaluate` (the policies as a filter over an unknown resource or principal, with relationship conditions resolved and optional SQL or Prisma output) and `abac.accessibleResources` (the resources a principal may act on, paged). The filter helpers `evalFilter`, `filterToSql`, `filterToPrisma` and `filterToDrizzle` are exported.
|
|
20
|
+
- AuthZEN 1.0 search: `abac.authzenSearchSubject`, `authzenSearchResource` and `authzenSearchAction`.
|
|
21
|
+
- ABAC authoring: `abac.templates`, `abac.links`, `abac.schema` (`get`, `set`, `delete`, `validate`), `abac.diff` and `abac.diffSources`; `abac.test` results carry `coverage`.
|
|
22
|
+
- `fga.listObjects` and the resource-role `accessible` call take `limit` and `starting_after`; `listObjects` returns `has_more` and `next_cursor`.
|
|
23
|
+
- `authzDecisions` client resource (`list`, `iterate`, `get`, `stats`, `settings.get/update`): the authorization decision log and its capture settings.
|
|
24
|
+
- `policyBundles` client resource (`export`, `list`, `current`, `get`, `verify`, `import` with `dry_run` / `prune`) and `verifyPolicyBundle`, which verifies a signed policy bundle offline against your instance JWKS and returns its policies and FGA models.
|
|
25
|
+
- `fga.listUsers` / `fga.listAllUsers` and `openfga.listUsers` / `openfga.listAllUsers`: who has a relation on an object (users, usersets, the `type:*` wildcard with `excluded_users`), paged.
|
|
26
|
+
- `fga.readChanges` and `openfga.readChanges`: the tuple change log, resumable with `continuation_token`.
|
|
27
|
+
- Tuple conditions: `condition` on tuple keys and `context` on `check`, `batchCheck` items, `listObjects` and `listUsers`.
|
|
28
|
+
- `consistency` / `consistency_token` on queries; writes and queries return a `consistency_token`.
|
|
29
|
+
- Desktop login MFA passkeys: `DesktopPasskey` and the policy fields `passkey_scope`, `passkey_rp_id` and `passkey_require_uv`.
|
|
30
|
+
- Connections: `token_family` on connections and `split_tenants` on connect, so one grant covering several accounts (Xero organisations) becomes one connection per account sharing one token set.
|
|
31
|
+
- Custom OAuth providers: `revocation_endpoint`, `host_params_schema` and `data_only` (connect-time host templates for data-only providers).
|
|
32
|
+
- OAuth clients: `claims_redirect_uris` for UMA 2.0 claims gathering.
|
|
33
|
+
- Shared Signals receivers: the `sync_posture` action records device posture without touching sessions.
|
|
34
|
+
- Verifiable credentials: mdoc issuer revocation checks (`revocation_policy`: off, best_effort or required).
|
|
35
|
+
|
|
36
|
+
## 0.25.0 — 2026-10-26
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- `mfaFactors` client resource for the additional authentication factors: `setYubicoSecret` / `removeYubicoSecret`, `setDuoSecret` / `removeDuoSecret` / `duoHealthCheck`, `setSmartCardSecret` / `removeSmartCardSecret` (all write-only), `yubikeys` (`list`, `register`, `remove`), `smartCardMappings` (`list`, `add`, `remove`) and `resetSecurityQuestions`.
|
|
41
|
+
- `users.create({ mfa })` is typed (`ImportedMfa`): an authenticator (`totp`: SHA-1/256/512, 6 or 8 digits, 30 or 60 seconds) or a counter-based token (`hotp`), plus recovery codes.
|
|
4
42
|
|
|
5
43
|
## 0.24.0 — 2026-10-25
|
|
6
44
|
|
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
import { type RequestFn } from './request';
|
|
2
|
+
import type { ListPage } from './types';
|
|
3
|
+
import type { Filter, SqlColumn, SqlDialect } from '@atlasauth/authz';
|
|
4
|
+
export interface AbacPolicyTestCase {
|
|
5
|
+
name: string;
|
|
6
|
+
/** principal, action, resource, context and optional entities. */
|
|
7
|
+
request: Record<string, unknown>;
|
|
8
|
+
expect: 'allow' | 'deny';
|
|
9
|
+
}
|
|
10
|
+
/** An ABAC policy: named, versioned source in the Cedar-subset policy language. */
|
|
11
|
+
export interface AbacPolicy {
|
|
12
|
+
object: 'abac_policy';
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string | null;
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
current_version: number;
|
|
18
|
+
/** The FGA store `fga.check(...)` in the source consults. */
|
|
19
|
+
fga_store_id: string | null;
|
|
20
|
+
source: string;
|
|
21
|
+
tests: AbacPolicyTestCase[];
|
|
22
|
+
created_at: number;
|
|
23
|
+
updated_at: number;
|
|
24
|
+
}
|
|
25
|
+
export interface AbacPolicyVersion {
|
|
26
|
+
object: 'abac_policy_version';
|
|
27
|
+
policy_id: string;
|
|
28
|
+
version: number;
|
|
29
|
+
source: string;
|
|
30
|
+
tests: AbacPolicyTestCase[];
|
|
31
|
+
current: boolean;
|
|
32
|
+
created_at: number;
|
|
33
|
+
}
|
|
34
|
+
export interface CreateAbacPolicyBody {
|
|
35
|
+
name: string;
|
|
36
|
+
description?: string | null;
|
|
37
|
+
enabled?: boolean;
|
|
38
|
+
fga_store_id?: string | null;
|
|
39
|
+
source: string;
|
|
40
|
+
tests?: AbacPolicyTestCase[];
|
|
41
|
+
}
|
|
42
|
+
/** Sending `source` appends a new version; `current_version` (without source) rolls back. */
|
|
43
|
+
export type UpdateAbacPolicyBody = Partial<CreateAbacPolicyBody> & {
|
|
44
|
+
current_version?: number;
|
|
45
|
+
};
|
|
46
|
+
export interface AbacEntity {
|
|
47
|
+
type: string;
|
|
48
|
+
id: string;
|
|
49
|
+
attributes?: Record<string, unknown>;
|
|
50
|
+
/** `Type::id` uids this entity is a member of (for `in`). */
|
|
51
|
+
parents?: string[];
|
|
52
|
+
}
|
|
53
|
+
export interface AbacEvaluateBody {
|
|
54
|
+
principal: AbacEntity;
|
|
55
|
+
action: string;
|
|
56
|
+
resource: AbacEntity;
|
|
57
|
+
context?: Record<string, unknown>;
|
|
58
|
+
entities?: AbacEntity[];
|
|
59
|
+
/** Evaluate only these policies (default: every enabled one). */
|
|
60
|
+
policy_ids?: string[];
|
|
61
|
+
}
|
|
62
|
+
export interface AbacDecision {
|
|
63
|
+
object: 'abac_decision';
|
|
64
|
+
decision: 'allow' | 'deny';
|
|
65
|
+
reasons: string[];
|
|
66
|
+
errors: string[];
|
|
67
|
+
}
|
|
68
|
+
export interface AbacCoverageClause {
|
|
69
|
+
kind: 'when' | 'unless';
|
|
70
|
+
index: number;
|
|
71
|
+
line: number | null;
|
|
72
|
+
true: number;
|
|
73
|
+
false: number;
|
|
74
|
+
error: number;
|
|
75
|
+
}
|
|
76
|
+
/** Which rules and `when`/`unless` clauses the test cases exercised. */
|
|
77
|
+
export interface AbacCoverage {
|
|
78
|
+
object: 'abac_coverage';
|
|
79
|
+
tests: number;
|
|
80
|
+
rules: Array<{
|
|
81
|
+
rule: number;
|
|
82
|
+
effect: 'permit' | 'forbid';
|
|
83
|
+
line: number | null;
|
|
84
|
+
in_scope: number;
|
|
85
|
+
matched: number;
|
|
86
|
+
status: 'covered' | 'partial' | 'untouched';
|
|
87
|
+
clauses: AbacCoverageClause[];
|
|
88
|
+
}>;
|
|
89
|
+
summary: {
|
|
90
|
+
rules: number;
|
|
91
|
+
reached: number;
|
|
92
|
+
matched: number;
|
|
93
|
+
clauses: number;
|
|
94
|
+
clauses_both_ways: number;
|
|
95
|
+
percent: number;
|
|
96
|
+
};
|
|
97
|
+
/** What to add a test for, one sentence each. */
|
|
98
|
+
gaps: string[];
|
|
99
|
+
}
|
|
100
|
+
export interface AbacTestRun {
|
|
101
|
+
object: 'abac_policy_test_run';
|
|
102
|
+
passed: boolean;
|
|
103
|
+
results: Array<{
|
|
104
|
+
name: string;
|
|
105
|
+
expect: 'allow' | 'deny';
|
|
106
|
+
actual: 'allow' | 'deny';
|
|
107
|
+
passed: boolean;
|
|
108
|
+
}>;
|
|
109
|
+
coverage: AbacCoverage;
|
|
110
|
+
}
|
|
111
|
+
export interface AbacEntityRef {
|
|
112
|
+
type: string;
|
|
113
|
+
id: string;
|
|
114
|
+
}
|
|
115
|
+
/** A policy template: source with `?principal` / `?resource` slots, filled by links. */
|
|
116
|
+
export interface AbacPolicyTemplate {
|
|
117
|
+
object: 'abac_policy_template';
|
|
118
|
+
id: string;
|
|
119
|
+
name: string;
|
|
120
|
+
description: string | null;
|
|
121
|
+
source: string;
|
|
122
|
+
version: number;
|
|
123
|
+
slots: Array<'?principal' | '?resource'>;
|
|
124
|
+
fga_store_id: string | null;
|
|
125
|
+
link_count: number;
|
|
126
|
+
/** On an update that changed `source`: the links that now evaluate the new source. */
|
|
127
|
+
links_updated?: number;
|
|
128
|
+
created_at: number;
|
|
129
|
+
updated_at: number;
|
|
130
|
+
}
|
|
131
|
+
export interface CreateAbacTemplateBody {
|
|
132
|
+
name: string;
|
|
133
|
+
source: string;
|
|
134
|
+
description?: string | null;
|
|
135
|
+
fga_store_id?: string | null;
|
|
136
|
+
}
|
|
137
|
+
export interface AbacPolicyLink {
|
|
138
|
+
object: 'abac_policy_link';
|
|
139
|
+
id: string;
|
|
140
|
+
name: string;
|
|
141
|
+
template_id: string;
|
|
142
|
+
template_name: string | null;
|
|
143
|
+
/** The template version the link follows (always the latest). */
|
|
144
|
+
template_version: number | null;
|
|
145
|
+
principal: AbacEntityRef | null;
|
|
146
|
+
resource: AbacEntityRef | null;
|
|
147
|
+
enabled: boolean;
|
|
148
|
+
/** The policy source the link evaluates: the template with its slots filled. */
|
|
149
|
+
source: string;
|
|
150
|
+
created_at: number;
|
|
151
|
+
updated_at: number;
|
|
152
|
+
}
|
|
153
|
+
export interface CreateAbacLinkBody {
|
|
154
|
+
template_id: string;
|
|
155
|
+
name: string;
|
|
156
|
+
principal?: AbacEntityRef | null;
|
|
157
|
+
resource?: AbacEntityRef | null;
|
|
158
|
+
enabled?: boolean;
|
|
159
|
+
}
|
|
160
|
+
export type AbacSchemaType = {
|
|
161
|
+
type: 'boolean' | 'long' | 'string';
|
|
162
|
+
} | {
|
|
163
|
+
type: 'set';
|
|
164
|
+
element: AbacSchemaType;
|
|
165
|
+
} | {
|
|
166
|
+
type: 'entity';
|
|
167
|
+
name: string;
|
|
168
|
+
} | {
|
|
169
|
+
type: 'record';
|
|
170
|
+
attributes: Record<string, AbacSchemaType & {
|
|
171
|
+
required?: boolean;
|
|
172
|
+
}>;
|
|
173
|
+
};
|
|
174
|
+
/** The entity schema policies are type-checked against when saved. */
|
|
175
|
+
export interface AbacSchemaDocument {
|
|
176
|
+
entity_types: Record<string, {
|
|
177
|
+
attributes?: Record<string, AbacSchemaType & {
|
|
178
|
+
required?: boolean;
|
|
179
|
+
}>;
|
|
180
|
+
member_of?: string[];
|
|
181
|
+
}>;
|
|
182
|
+
actions?: Record<string, {
|
|
183
|
+
applies_to?: {
|
|
184
|
+
principal_types: string[];
|
|
185
|
+
resource_types: string[];
|
|
186
|
+
context?: Record<string, AbacSchemaType & {
|
|
187
|
+
required?: boolean;
|
|
188
|
+
}>;
|
|
189
|
+
};
|
|
190
|
+
member_of?: string[];
|
|
191
|
+
}>;
|
|
192
|
+
}
|
|
193
|
+
export interface AbacPolicyIssue {
|
|
194
|
+
severity: 'error' | 'warning';
|
|
195
|
+
/** 1-based position of the policy in the source (0 for a syntax error). */
|
|
196
|
+
policy: number;
|
|
197
|
+
rule: 'permit' | 'forbid';
|
|
198
|
+
clause?: {
|
|
199
|
+
kind: 'when' | 'unless';
|
|
200
|
+
index: number;
|
|
201
|
+
};
|
|
202
|
+
message: string;
|
|
203
|
+
offset?: number;
|
|
204
|
+
line?: number;
|
|
205
|
+
column?: number;
|
|
206
|
+
source_name?: string;
|
|
207
|
+
}
|
|
208
|
+
export interface AbacSchemaState {
|
|
209
|
+
object: 'abac_schema';
|
|
210
|
+
schema: AbacSchemaDocument | null;
|
|
211
|
+
version: number;
|
|
212
|
+
updated_at: number | null;
|
|
213
|
+
/** On a save: the errors the schema would give the policies and links already stored. */
|
|
214
|
+
policy_issues?: AbacPolicyIssue[];
|
|
215
|
+
}
|
|
216
|
+
export interface AbacValidation {
|
|
217
|
+
object: 'abac_validation';
|
|
218
|
+
valid: boolean;
|
|
219
|
+
schema_checked: boolean;
|
|
220
|
+
issues: AbacPolicyIssue[];
|
|
221
|
+
}
|
|
222
|
+
export interface AbacDiffChange {
|
|
223
|
+
request: Record<string, unknown>;
|
|
224
|
+
before: 'allow' | 'deny';
|
|
225
|
+
after: 'allow' | 'deny';
|
|
226
|
+
/** Present when a version uses `fga.check`: the assumption the change holds under. */
|
|
227
|
+
assuming?: {
|
|
228
|
+
fga_check: boolean;
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
export interface AbacPolicyDiff {
|
|
232
|
+
object: 'abac_policy_diff';
|
|
233
|
+
policy_id?: string;
|
|
234
|
+
from?: number;
|
|
235
|
+
to?: number;
|
|
236
|
+
text: {
|
|
237
|
+
identical: boolean;
|
|
238
|
+
added: number;
|
|
239
|
+
removed: number;
|
|
240
|
+
lines: Array<{
|
|
241
|
+
type: 'context' | 'add' | 'remove';
|
|
242
|
+
text: string;
|
|
243
|
+
before_line?: number;
|
|
244
|
+
after_line?: number;
|
|
245
|
+
}>;
|
|
246
|
+
};
|
|
247
|
+
/** The requests whose decision changes; null when `semantic` was false. */
|
|
248
|
+
semantic: {
|
|
249
|
+
enumerated: number;
|
|
250
|
+
space: number;
|
|
251
|
+
exhaustive: boolean;
|
|
252
|
+
changed: number;
|
|
253
|
+
newly_allowed: number;
|
|
254
|
+
newly_denied: number;
|
|
255
|
+
by_action: Record<string, {
|
|
256
|
+
newly_allowed: number;
|
|
257
|
+
newly_denied: number;
|
|
258
|
+
}>;
|
|
259
|
+
changes: AbacDiffChange[];
|
|
260
|
+
truncated: boolean;
|
|
261
|
+
} | null;
|
|
262
|
+
}
|
|
263
|
+
export interface AbacDiffOptions {
|
|
264
|
+
from?: number;
|
|
265
|
+
to?: number;
|
|
266
|
+
/** false returns only the text diff. */
|
|
267
|
+
semantic?: boolean;
|
|
268
|
+
/** Requests to compare; the space is sampled beyond this. Default 5000. */
|
|
269
|
+
max_requests?: number;
|
|
270
|
+
/** Changed requests to list. Default 50. */
|
|
271
|
+
max_changes?: number;
|
|
272
|
+
}
|
|
273
|
+
export interface AuthzenEvaluation {
|
|
274
|
+
subject?: {
|
|
275
|
+
type: string;
|
|
276
|
+
id: string;
|
|
277
|
+
properties?: Record<string, unknown>;
|
|
278
|
+
};
|
|
279
|
+
resource?: {
|
|
280
|
+
type: string;
|
|
281
|
+
id: string;
|
|
282
|
+
properties?: Record<string, unknown>;
|
|
283
|
+
};
|
|
284
|
+
action?: {
|
|
285
|
+
name: string;
|
|
286
|
+
properties?: Record<string, unknown>;
|
|
287
|
+
};
|
|
288
|
+
context?: Record<string, unknown>;
|
|
289
|
+
}
|
|
290
|
+
/** An entity for partial evaluation: an unknown one needs only its `type`. */
|
|
291
|
+
export interface AbacPartialEntity {
|
|
292
|
+
type: string;
|
|
293
|
+
id?: string;
|
|
294
|
+
attributes?: Record<string, unknown>;
|
|
295
|
+
parents?: string[];
|
|
296
|
+
}
|
|
297
|
+
export interface AbacPartialBody {
|
|
298
|
+
principal: AbacPartialEntity;
|
|
299
|
+
action: string;
|
|
300
|
+
resource: AbacPartialEntity;
|
|
301
|
+
context?: Record<string, unknown>;
|
|
302
|
+
entities?: AbacEntity[];
|
|
303
|
+
policy_ids?: string[];
|
|
304
|
+
/** Which entity's attributes are unknown. Default `['resource']`. */
|
|
305
|
+
unknowns?: Array<'principal' | 'resource'>;
|
|
306
|
+
/** Replace relationship (`fga.check`) conditions with the ids the FGA store returns. Default true. */
|
|
307
|
+
resolve_relations?: boolean;
|
|
308
|
+
/** Ask for a ready-made query: parameterised SQL (field-to-column map) and/or a Prisma where object. */
|
|
309
|
+
output?: {
|
|
310
|
+
sql?: {
|
|
311
|
+
columns: Record<string, SqlColumn>;
|
|
312
|
+
dialect?: SqlDialect;
|
|
313
|
+
param_offset?: number;
|
|
314
|
+
};
|
|
315
|
+
prisma?: {
|
|
316
|
+
fields: Record<string, string>;
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
export interface AbacResidual {
|
|
321
|
+
object: 'abac_residual';
|
|
322
|
+
/** `allow` / `deny` when the filter is constant, else `conditional`. */
|
|
323
|
+
decision: 'allow' | 'deny' | 'conditional';
|
|
324
|
+
/** The condition on the unknown entity under which the request is allowed. */
|
|
325
|
+
filter: Filter;
|
|
326
|
+
permit: Filter;
|
|
327
|
+
forbid: Filter;
|
|
328
|
+
unknowns: Array<'principal' | 'resource'>;
|
|
329
|
+
relations_resolved: boolean;
|
|
330
|
+
sql?: {
|
|
331
|
+
text: string;
|
|
332
|
+
params: unknown[];
|
|
333
|
+
};
|
|
334
|
+
prisma?: Record<string, unknown>;
|
|
335
|
+
}
|
|
336
|
+
export interface AbacAccessibleBody {
|
|
337
|
+
principal: AbacPartialEntity;
|
|
338
|
+
action: string;
|
|
339
|
+
/** The Atlas resource type key; policies see its PascalCase form. */
|
|
340
|
+
resource_type: string;
|
|
341
|
+
context?: Record<string, unknown>;
|
|
342
|
+
entities?: AbacEntity[];
|
|
343
|
+
/** Resources to filter instead of the Atlas ones. */
|
|
344
|
+
candidates?: Array<{
|
|
345
|
+
id: string;
|
|
346
|
+
attributes?: Record<string, unknown>;
|
|
347
|
+
parents?: string[];
|
|
348
|
+
}>;
|
|
349
|
+
policy_ids?: string[];
|
|
350
|
+
limit?: number;
|
|
351
|
+
starting_after?: string;
|
|
352
|
+
}
|
|
353
|
+
export interface AbacAccessibleList {
|
|
354
|
+
object: 'list';
|
|
355
|
+
data: Array<{
|
|
356
|
+
object: 'abac_resource';
|
|
357
|
+
type: string;
|
|
358
|
+
id: string;
|
|
359
|
+
}>;
|
|
360
|
+
has_more: boolean;
|
|
361
|
+
next_cursor: string | null;
|
|
362
|
+
total: number;
|
|
363
|
+
evaluated: number;
|
|
364
|
+
/** `residual` when one filter was applied to every candidate; `per_resource` when each had to be evaluated. */
|
|
365
|
+
method: 'residual' | 'per_resource';
|
|
366
|
+
}
|
|
367
|
+
/** AuthZEN 1.0 search request: leave the `id` out of the entity you are looking for. */
|
|
368
|
+
export interface AuthzenSearchRequest {
|
|
369
|
+
subject?: {
|
|
370
|
+
type: string;
|
|
371
|
+
id?: string;
|
|
372
|
+
properties?: Record<string, unknown>;
|
|
373
|
+
};
|
|
374
|
+
resource?: {
|
|
375
|
+
type: string;
|
|
376
|
+
id?: string;
|
|
377
|
+
properties?: Record<string, unknown>;
|
|
378
|
+
};
|
|
379
|
+
action?: {
|
|
380
|
+
name: string;
|
|
381
|
+
properties?: Record<string, unknown>;
|
|
382
|
+
};
|
|
383
|
+
context?: Record<string, unknown>;
|
|
384
|
+
page?: {
|
|
385
|
+
limit?: number;
|
|
386
|
+
token?: string;
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
export interface AuthzenSearchPage {
|
|
390
|
+
/** Empty on the last page. */
|
|
391
|
+
next_token: string;
|
|
392
|
+
count: number;
|
|
393
|
+
total: number;
|
|
394
|
+
}
|
|
395
|
+
/** ABAC policies and the policy decision point (including the AuthZEN endpoints). */
|
|
396
|
+
export declare function abacResource(request: RequestFn): {
|
|
397
|
+
list(): Promise<ListPage<AbacPolicy>>;
|
|
398
|
+
get(id: string): Promise<AbacPolicy>;
|
|
399
|
+
create(body: CreateAbacPolicyBody, idempotencyKey?: string): Promise<AbacPolicy>;
|
|
400
|
+
update(id: string, body: UpdateAbacPolicyBody): Promise<AbacPolicy>;
|
|
401
|
+
delete(id: string): Promise<{
|
|
402
|
+
object: "abac_policy";
|
|
403
|
+
id: string;
|
|
404
|
+
deleted: true;
|
|
405
|
+
}>;
|
|
406
|
+
versions(id: string): Promise<ListPage<AbacPolicyVersion>>;
|
|
407
|
+
/** Run a version's tests (default: current), or a draft `source` and `tests`, without saving. */
|
|
408
|
+
test(id: string, body?: {
|
|
409
|
+
version?: number;
|
|
410
|
+
source?: string;
|
|
411
|
+
tests?: AbacPolicyTestCase[];
|
|
412
|
+
}): Promise<AbacTestRun>;
|
|
413
|
+
/** May `principal` perform `action` on `resource`? */
|
|
414
|
+
evaluate(body: AbacEvaluateBody): Promise<AbacDecision>;
|
|
415
|
+
/**
|
|
416
|
+
* Partial evaluation (data filtering): the condition under which the request is allowed when
|
|
417
|
+
* an entity is unknown, as a filter AST and, on request, parameterised SQL or a Prisma object.
|
|
418
|
+
*/
|
|
419
|
+
partialEvaluate(body: AbacPartialBody): Promise<AbacResidual>;
|
|
420
|
+
/** The resources of a type a principal may perform an action on, one page at a time. */
|
|
421
|
+
accessibleResources(body: AbacAccessibleBody): Promise<AbacAccessibleList>;
|
|
422
|
+
/** Policy templates: policy source with `?principal` / `?resource` slots that links fill with entities. */
|
|
423
|
+
templates: {
|
|
424
|
+
list(): Promise<ListPage<AbacPolicyTemplate>>;
|
|
425
|
+
get(id: string): Promise<AbacPolicyTemplate>;
|
|
426
|
+
create(body: CreateAbacTemplateBody, idempotencyKey?: string): Promise<AbacPolicyTemplate>;
|
|
427
|
+
/** A new `source` reaches every link at once; it is refused if a link could no longer be filled in or would fail the schema. */
|
|
428
|
+
update(id: string, body: Partial<CreateAbacTemplateBody>): Promise<AbacPolicyTemplate>;
|
|
429
|
+
/** A template with links is refused unless `force` (which deletes the links too). */
|
|
430
|
+
delete(id: string, opts?: {
|
|
431
|
+
force?: boolean;
|
|
432
|
+
}): Promise<{
|
|
433
|
+
object: "abac_policy_template";
|
|
434
|
+
id: string;
|
|
435
|
+
deleted: true;
|
|
436
|
+
links_deleted: number;
|
|
437
|
+
}>;
|
|
438
|
+
};
|
|
439
|
+
/** Links: a template with its slots filled by entities. A link is evaluated from the template's current source. */
|
|
440
|
+
links: {
|
|
441
|
+
list(query?: {
|
|
442
|
+
template_id?: string;
|
|
443
|
+
}): Promise<ListPage<AbacPolicyLink>>;
|
|
444
|
+
get(id: string): Promise<AbacPolicyLink>;
|
|
445
|
+
create(body: CreateAbacLinkBody, idempotencyKey?: string): Promise<AbacPolicyLink>;
|
|
446
|
+
update(id: string, body: Partial<Omit<CreateAbacLinkBody, "template_id">>): Promise<AbacPolicyLink>;
|
|
447
|
+
delete(id: string): Promise<{
|
|
448
|
+
object: "abac_policy_link";
|
|
449
|
+
id: string;
|
|
450
|
+
deleted: true;
|
|
451
|
+
}>;
|
|
452
|
+
};
|
|
453
|
+
/** The entity schema: once set, policies and templates are type-checked when saved. */
|
|
454
|
+
schema: {
|
|
455
|
+
get(): Promise<AbacSchemaState>;
|
|
456
|
+
/** Saves the schema and reports the errors it would give the policies already stored (`policy_issues`). */
|
|
457
|
+
set(schema: AbacSchemaDocument): Promise<AbacSchemaState>;
|
|
458
|
+
delete(): Promise<{
|
|
459
|
+
object: "abac_schema";
|
|
460
|
+
deleted: true;
|
|
461
|
+
}>;
|
|
462
|
+
/** Type-check draft source against the saved schema (or `schema`) without saving anything. */
|
|
463
|
+
validate(body: {
|
|
464
|
+
source: string;
|
|
465
|
+
schema?: AbacSchemaDocument;
|
|
466
|
+
template?: boolean;
|
|
467
|
+
}): Promise<AbacValidation>;
|
|
468
|
+
};
|
|
469
|
+
/** Compare two versions of a policy: the text, and the requests whose decision changes. */
|
|
470
|
+
diff(id: string, opts?: AbacDiffOptions): Promise<AbacPolicyDiff>;
|
|
471
|
+
/** The same comparison for two sources you send, without saving. */
|
|
472
|
+
diffSources(body: {
|
|
473
|
+
before: string;
|
|
474
|
+
after: string;
|
|
475
|
+
semantic?: boolean;
|
|
476
|
+
max_requests?: number;
|
|
477
|
+
max_changes?: number;
|
|
478
|
+
}): Promise<AbacPolicyDiff>;
|
|
479
|
+
/** AuthZEN 1.0 Subject Search: the subjects of a type that may perform the action on the resource. */
|
|
480
|
+
authzenSearchSubject(body: AuthzenSearchRequest): Promise<{
|
|
481
|
+
results: Array<{
|
|
482
|
+
type: string;
|
|
483
|
+
id: string;
|
|
484
|
+
}>;
|
|
485
|
+
page: AuthzenSearchPage;
|
|
486
|
+
}>;
|
|
487
|
+
/** AuthZEN 1.0 Resource Search: the resources of a type the subject may perform the action on. */
|
|
488
|
+
authzenSearchResource(body: AuthzenSearchRequest): Promise<{
|
|
489
|
+
results: Array<{
|
|
490
|
+
type: string;
|
|
491
|
+
id: string;
|
|
492
|
+
}>;
|
|
493
|
+
page: AuthzenSearchPage;
|
|
494
|
+
}>;
|
|
495
|
+
/** AuthZEN 1.0 Action Search: the actions the subject may perform on the resource. */
|
|
496
|
+
authzenSearchAction(body: AuthzenSearchRequest): Promise<{
|
|
497
|
+
results: Array<{
|
|
498
|
+
name: string;
|
|
499
|
+
}>;
|
|
500
|
+
page: AuthzenSearchPage;
|
|
501
|
+
}>;
|
|
502
|
+
/** Convenience: the boolean answer to {@link evaluate}. */
|
|
503
|
+
isAllowed(body: AbacEvaluateBody): Promise<boolean>;
|
|
504
|
+
/** AuthZEN 1.0 Access Evaluation. */
|
|
505
|
+
authzenEvaluation(body: AuthzenEvaluation): Promise<{
|
|
506
|
+
decision: boolean;
|
|
507
|
+
context?: Record<string, unknown>;
|
|
508
|
+
}>;
|
|
509
|
+
/** AuthZEN 1.0 Access Evaluations (batch). */
|
|
510
|
+
authzenEvaluations(body: AuthzenEvaluation & {
|
|
511
|
+
evaluations?: AuthzenEvaluation[];
|
|
512
|
+
options?: {
|
|
513
|
+
evaluations_semantic?: "execute_all" | "deny_on_first_deny" | "permit_on_first_permit";
|
|
514
|
+
};
|
|
515
|
+
}): Promise<{
|
|
516
|
+
evaluations: Array<{
|
|
517
|
+
decision: boolean;
|
|
518
|
+
}>;
|
|
519
|
+
}>;
|
|
520
|
+
};
|
|
521
|
+
export { FilterCompileError, evalFilter, filterToDrizzle, filterToPrisma, filterToSql, type DrizzleOps, type DrizzleOptions, type Filter, type FilterRows, type PrismaOptions, type SqlColumn, type SqlDialect, type SqlFragment, type SqlOptions, } from '@atlasauth/authz';
|