@owlmeans/iam 0.1.18-rc.8 → 0.1.18
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 +185 -15
- package/agent-meta/manifest.json +92 -4
- package/agent-meta/skills/iam/SKILL.md +91 -177
- package/agent-meta/skills/iam/parts/clients.md +93 -0
- package/agent-meta/skills/iam/parts/permissions.md +106 -0
- package/agent-meta/skills/iam/parts/service.md +115 -0
- package/agent-meta/skills/iam/parts/tenancy.md +72 -0
- package/build/consts.d.ts +170 -1
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +221 -0
- package/build/consts.js.map +1 -1
- package/build/consts.local.d.ts +58 -0
- package/build/consts.local.d.ts.map +1 -0
- package/build/consts.local.js +21 -0
- package/build/consts.local.js.map +1 -0
- package/build/errors.d.ts +26 -0
- package/build/errors.d.ts.map +1 -1
- package/build/errors.js +38 -0
- package/build/errors.js.map +1 -1
- package/build/facet.d.ts +10 -0
- package/build/facet.d.ts.map +1 -0
- package/build/facet.js +16 -0
- package/build/facet.js.map +1 -0
- package/build/gate/consts.local.d.ts +2 -0
- package/build/gate/consts.local.d.ts.map +1 -0
- package/build/gate/consts.local.js +3 -0
- package/build/gate/consts.local.js.map +1 -0
- package/build/gate/index.d.ts +4 -0
- package/build/gate/index.d.ts.map +1 -0
- package/build/gate/index.js +4 -0
- package/build/gate/index.js.map +1 -0
- package/build/gate/param.d.ts +6 -0
- package/build/gate/param.d.ts.map +1 -0
- package/build/gate/param.js +83 -0
- package/build/gate/param.js.map +1 -0
- package/build/gate/resolve.d.ts +10 -0
- package/build/gate/resolve.d.ts.map +1 -0
- package/build/gate/resolve.js +93 -0
- package/build/gate/resolve.js.map +1 -0
- package/build/gate/types.d.ts +109 -0
- package/build/gate/types.d.ts.map +1 -0
- package/build/gate/types.js +2 -0
- package/build/gate/types.js.map +1 -0
- package/build/gate/types.local.d.ts +5 -0
- package/build/gate/types.local.d.ts.map +1 -0
- package/build/gate/types.local.js +2 -0
- package/build/gate/types.local.js.map +1 -0
- package/build/gate/validate.d.ts +4 -0
- package/build/gate/validate.d.ts.map +1 -0
- package/build/gate/validate.js +100 -0
- package/build/gate/validate.js.map +1 -0
- package/build/index.d.ts +9 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +5 -0
- package/build/index.js.map +1 -1
- package/build/permission/types.d.ts +35 -0
- package/build/permission/types.d.ts.map +1 -0
- package/build/permission/types.js +2 -0
- package/build/permission/types.js.map +1 -0
- package/build/permission.d.ts +8 -0
- package/build/permission.d.ts.map +1 -0
- package/build/permission.js +34 -0
- package/build/permission.js.map +1 -0
- package/build/runtime/types.d.ts +90 -0
- package/build/runtime/types.d.ts.map +1 -0
- package/build/runtime/types.js +2 -0
- package/build/runtime/types.js.map +1 -0
- package/build/runtime.d.ts +75 -0
- package/build/runtime.d.ts.map +1 -0
- package/build/runtime.js +75 -0
- package/build/runtime.js.map +1 -0
- package/build/schemas.d.ts +13 -0
- package/build/schemas.d.ts.map +1 -0
- package/build/schemas.js +108 -0
- package/build/schemas.js.map +1 -0
- package/build/types.d.ts +429 -30
- package/build/types.d.ts.map +1 -1
- package/build/utils/types.d.ts +12 -0
- package/build/utils/types.d.ts.map +1 -0
- package/build/utils/types.js +2 -0
- package/build/utils/types.js.map +1 -0
- package/build/utils.d.ts +7 -6
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +10 -1
- package/build/utils.js.map +1 -1
- package/package.json +12 -7
- package/src/consts.local.ts +26 -0
- package/src/consts.ts +241 -1
- package/src/errors.ts +44 -0
- package/src/facet.ts +17 -0
- package/src/gate/consts.local.ts +3 -0
- package/src/gate/index.ts +3 -0
- package/src/gate/param.ts +108 -0
- package/src/gate/resolve.ts +114 -0
- package/src/gate/types.local.ts +4 -0
- package/src/gate/types.ts +117 -0
- package/src/gate/validate.ts +123 -0
- package/src/index.ts +9 -0
- package/src/permission/types.ts +33 -0
- package/src/permission.ts +48 -0
- package/src/runtime/types.ts +107 -0
- package/src/runtime.ts +142 -0
- package/src/schemas.ts +122 -0
- package/src/types.ts +492 -31
- package/src/utils/types.ts +11 -0
- package/src/utils.ts +12 -7
- package/tests/gate-param.spec.ts +233 -0
- package/tests/runtime.spec.ts +101 -0
- package/tests/tsconfig.json +12 -0
- package/tests/utils.spec.ts +47 -1
package/build/consts.js
CHANGED
|
@@ -1,4 +1,225 @@
|
|
|
1
|
+
import { EmailSchema, ProfileIdSchema, TitleSchema } from './consts.local.js';
|
|
2
|
+
import { EntitySlugValueSchema } from '@owlmeans/auth';
|
|
1
3
|
export const DEFAULT_ALIAS = 'iam-service';
|
|
2
4
|
export const IAM_MODE_KEYCLOAK = 'keycloak';
|
|
3
5
|
export const IAM_MODE_INTEGRATED = 'integrated';
|
|
6
|
+
/**
|
|
7
|
+
* Gate-param syntax: `<permission>[@<selector>]`.
|
|
8
|
+
*
|
|
9
|
+
* The `@` belongs to the GATE and to nothing else. It says where a resource id is read from at
|
|
10
|
+
* request time; it is never part of a permission's stored NAME. A definition or a grant whose name
|
|
11
|
+
* carries one is a key nothing ever looks up, so every grant against it is a silent no-op.
|
|
12
|
+
*/
|
|
13
|
+
export const RESOURCE_PARAM_SEPARATOR = '@';
|
|
14
|
+
/**
|
|
15
|
+
* Separates an explicit source from its path: `@body:order.id`.
|
|
16
|
+
*
|
|
17
|
+
* Deliberately `:` rather than a dot. Under a dotted-only form the meaning of a selector changes the
|
|
18
|
+
* moment a route gains a param named like a source keyword — `/report/:query` with `@query.id` flips
|
|
19
|
+
* from "the route param literally named `query.id`" to "the query string's `id`", redirecting an
|
|
20
|
+
* authorization lookup from a router-matched value to attacker-supplied input, caused by an
|
|
21
|
+
* unrelated route rename. `:` is decidable in one character, and no gate-param string written before
|
|
22
|
+
* this existed can contain one.
|
|
23
|
+
*/
|
|
24
|
+
export const RESOURCE_SOURCE_SEPARATOR = ':';
|
|
25
|
+
/** Separates path segments inside a qualified selector: `@body:order.id`. */
|
|
26
|
+
export const RESOURCE_PATH_SEPARATOR = '.';
|
|
27
|
+
/** Where a qualified selector may read a resource id from. */
|
|
28
|
+
export var GateParamSource;
|
|
29
|
+
(function (GateParamSource) {
|
|
30
|
+
GateParamSource["Params"] = "params";
|
|
31
|
+
GateParamSource["Query"] = "query";
|
|
32
|
+
GateParamSource["Body"] = "body";
|
|
33
|
+
GateParamSource["Headers"] = "headers";
|
|
34
|
+
GateParamSource["Auth"] = "auth";
|
|
35
|
+
})(GateParamSource || (GateParamSource = {}));
|
|
36
|
+
/**
|
|
37
|
+
* What the bare form (`@enquiryId`) searches, in order.
|
|
38
|
+
*
|
|
39
|
+
* Params first, then query. The query fallback is legacy and deliberately kept: removing it would
|
|
40
|
+
* silently deny already-deployed applications whose selector happens to name a query key, and a
|
|
41
|
+
* silent denial inside a customer's running app is the worst available outcome.
|
|
42
|
+
*/
|
|
43
|
+
export const DEFAULT_GATE_PARAM_SOURCES = [
|
|
44
|
+
GateParamSource.Params, GateParamSource.Query
|
|
45
|
+
];
|
|
46
|
+
/** Why a gate param is structurally wrong — a misconfiguration, not a failed authorization. */
|
|
47
|
+
export var GateParamErrorCode;
|
|
48
|
+
(function (GateParamErrorCode) {
|
|
49
|
+
GateParamErrorCode["UnknownSource"] = "gate-param:unknown-source";
|
|
50
|
+
GateParamErrorCode["EmptySelector"] = "gate-param:empty-selector";
|
|
51
|
+
GateParamErrorCode["EmptySegment"] = "gate-param:empty-segment";
|
|
52
|
+
/** Named a request key the entrypoint's filter does not declare — AJV strips it before the gate. */
|
|
53
|
+
GateParamErrorCode["UnreachableKey"] = "gate-param:unreachable-key";
|
|
54
|
+
/** Named a route param the entrypoint's own path does not carry. */
|
|
55
|
+
GateParamErrorCode["UnknownRouteParam"] = "gate-param:unknown-route-param";
|
|
56
|
+
})(GateParamErrorCode || (GateParamErrorCode = {}));
|
|
57
|
+
/** Why a selector produced no resource id. */
|
|
58
|
+
export var GateResolutionFailure;
|
|
59
|
+
(function (GateResolutionFailure) {
|
|
60
|
+
/** The source exists, the path does not. */
|
|
61
|
+
GateResolutionFailure["NotProvided"] = "not-provided";
|
|
62
|
+
/** The request carries no such source at all. */
|
|
63
|
+
GateResolutionFailure["SourceMissing"] = "source-missing";
|
|
64
|
+
/** Resolved to an object or a multi-element array — refused rather than stringified. */
|
|
65
|
+
GateResolutionFailure["NotScalar"] = "not-scalar";
|
|
66
|
+
/** The selector itself did not parse. */
|
|
67
|
+
GateResolutionFailure["Malformed"] = "malformed";
|
|
68
|
+
})(GateResolutionFailure || (GateResolutionFailure = {}));
|
|
69
|
+
/**
|
|
70
|
+
* Which FORM of a grant an operation addresses.
|
|
71
|
+
*
|
|
72
|
+
* A resource-scoped permission is grantable two ways, under one name: `Blanket` (a PermissionSet
|
|
73
|
+
* carrying no `resources`, which `hasPermission` reads as covering every id) and `Resources` (an
|
|
74
|
+
* explicit id list). They are stored separately and must be revoked separately, or a UI offering
|
|
75
|
+
* both controls would have one silently wipe the other.
|
|
76
|
+
*
|
|
77
|
+
* Every subject, person or group, also has ONE blanket value of its own per binding: `true` grants,
|
|
78
|
+
* `false` RESTRICTS (it cuts what the subject would inherit from a default class, a group or a
|
|
79
|
+
* bundle), absent inherits. A `Blanket` or `All` revoke of a declared definition writes the
|
|
80
|
+
* restriction; `Inherit` takes the subject's own value back.
|
|
81
|
+
*/
|
|
82
|
+
export var IamGrantMode;
|
|
83
|
+
(function (IamGrantMode) {
|
|
84
|
+
IamGrantMode["Blanket"] = "blanket";
|
|
85
|
+
IamGrantMode["Resources"] = "resources";
|
|
86
|
+
/** Revoke-only: every form. Illegal on a grant. */
|
|
87
|
+
IamGrantMode["All"] = "all";
|
|
88
|
+
/**
|
|
89
|
+
* Revoke-only: drop the subject's OWN blanket value in the binding — a grant or a restriction —
|
|
90
|
+
* so it holds exactly what it inherits. Resource-scoped sets are untouched. Illegal on a grant.
|
|
91
|
+
*/
|
|
92
|
+
IamGrantMode["Inherit"] = "inherit";
|
|
93
|
+
})(IamGrantMode || (IamGrantMode = {}));
|
|
94
|
+
/** What to do about grants that still reference a definition being removed. */
|
|
95
|
+
export var IamRemovalPolicy;
|
|
96
|
+
(function (IamRemovalPolicy) {
|
|
97
|
+
/** Strip the permission from every subject of the entity, then drop the definition. */
|
|
98
|
+
IamRemovalPolicy["Cascade"] = "cascade";
|
|
99
|
+
/** Refuse while any subject still holds it; the holders travel in the error. */
|
|
100
|
+
IamRemovalPolicy["Refuse"] = "refuse";
|
|
101
|
+
})(IamRemovalPolicy || (IamRemovalPolicy = {}));
|
|
102
|
+
/**
|
|
103
|
+
* The grouping tiers a permission definition may be tagged with.
|
|
104
|
+
*
|
|
105
|
+
* A tag decides NOTHING at request time — `hasPermission` and every gate treat a permission name as
|
|
106
|
+
* one opaque string — and only groups the permission in an administrator's screen. `guest` is
|
|
107
|
+
* deliberately absent: a public surface declares no permissions, and adding an area later would
|
|
108
|
+
* re-classify names already tagged.
|
|
109
|
+
*/
|
|
110
|
+
export const IAM_AREAS = ['user', 'operator', 'admin'];
|
|
111
|
+
/** Separates the resource from the action in a permission name. TWO hyphens, never one. */
|
|
112
|
+
export const PERMISSION_ACTION_SEPARATOR = '--';
|
|
113
|
+
/**
|
|
114
|
+
* Who holds a permission without an explicit grant — a property of the DEFINITION, evaluated when
|
|
115
|
+
* claims are built and never written onto a profile.
|
|
116
|
+
*
|
|
117
|
+
* `User` is every signed-in subject of the client (an unbound, unmanaged `user`-area definition
|
|
118
|
+
* only); `Member` and `Owner` are every member / owner of the organization the subject acts in, so
|
|
119
|
+
* they require an `entityScoped` definition. A class default is a BLANKET set: `Owner` on a
|
|
120
|
+
* resource-scoped definition is its all-records form.
|
|
121
|
+
*/
|
|
122
|
+
export var IamDefaultClass;
|
|
123
|
+
(function (IamDefaultClass) {
|
|
124
|
+
IamDefaultClass["None"] = "none";
|
|
125
|
+
IamDefaultClass["User"] = "user";
|
|
126
|
+
IamDefaultClass["Member"] = "member";
|
|
127
|
+
IamDefaultClass["Owner"] = "owner";
|
|
128
|
+
})(IamDefaultClass || (IamDefaultClass = {}));
|
|
129
|
+
/** Why a subject holds a grant, as a listing reports it. */
|
|
130
|
+
export var IamGrantOrigin;
|
|
131
|
+
(function (IamGrantOrigin) {
|
|
132
|
+
/** Written on the subject's own row. */
|
|
133
|
+
IamGrantOrigin["Direct"] = "direct";
|
|
134
|
+
/** The definition's `defaultClass` covers the subject. */
|
|
135
|
+
IamGrantOrigin["Default"] = "default";
|
|
136
|
+
/** Held by a group the subject is a member of — `IamGrant.through` names it. */
|
|
137
|
+
IamGrantOrigin["Group"] = "group";
|
|
138
|
+
/** A group's own listing only: the names its bundles select; its own grants are `Direct`. */
|
|
139
|
+
IamGrantOrigin["Bundle"] = "bundle";
|
|
140
|
+
})(IamGrantOrigin || (IamGrantOrigin = {}));
|
|
141
|
+
/**
|
|
142
|
+
* The managed group `syncStaff` keeps in a client's owning organization: the owner's own staff,
|
|
143
|
+
* admitted to the client with the bundles the sync hands it. Its key, membership, bundles and
|
|
144
|
+
* existence are the synchronization's alone; its grants and restrictions are the operator's and
|
|
145
|
+
* survive every sync.
|
|
146
|
+
*/
|
|
147
|
+
export const IAM_MEMBERS_GROUP = 'members';
|
|
148
|
+
/**
|
|
149
|
+
* The `profileId` of a credential that proves an e-mail address and identifies nobody yet: what the
|
|
150
|
+
* end-user sign-in hands the provider's finalizer, which then resolves the account itself. It carries
|
|
151
|
+
* no `entitySlug` — a proof bound to an organization is something else.
|
|
152
|
+
*/
|
|
153
|
+
export const IAM_EMAIL_PROOF = 'proof:email';
|
|
154
|
+
/**
|
|
155
|
+
* The guard of the runtime IAM API (`makeIamRuntimeProtocols`). The serving process registers it: it
|
|
156
|
+
* admits a bearer access token the provider itself issued, and takes the client and the account from
|
|
157
|
+
* that token, never from the request.
|
|
158
|
+
*/
|
|
159
|
+
export const IAM_RUNTIME_GUARD = 'iam-runtime-guard';
|
|
160
|
+
/** Where the runtime IAM API mounts under its service unless the declaration names another path. */
|
|
161
|
+
export const IAM_RUNTIME_PATH = '/runtime';
|
|
162
|
+
/**
|
|
163
|
+
* The runtime API's leaf paths under its base. One table so the declarations and a fetch-only client
|
|
164
|
+
* (a target's server, which binds no entrypoint of the provider's tree) cannot disagree on a segment.
|
|
165
|
+
*/
|
|
166
|
+
export const IAM_RUNTIME_ROUTES = {
|
|
167
|
+
organizations: '/organizations',
|
|
168
|
+
organization: '/organizations/:entitySlug',
|
|
169
|
+
members: '/organizations/:entitySlug/members',
|
|
170
|
+
member: '/organizations/:entitySlug/members/:profileId',
|
|
171
|
+
memberRemove: '/organizations/:entitySlug/members/:profileId/remove',
|
|
172
|
+
permissions: '/organizations/:entitySlug/permissions',
|
|
173
|
+
grants: '/organizations/:entitySlug/grants',
|
|
174
|
+
grantsRevoke: '/organizations/:entitySlug/grants/revoke',
|
|
175
|
+
};
|
|
176
|
+
export const IamRuntimeOrganizationCreateSchema = {
|
|
177
|
+
type: 'object',
|
|
178
|
+
properties: { title: { ...TitleSchema, nullable: true } },
|
|
179
|
+
required: [],
|
|
180
|
+
additionalProperties: false,
|
|
181
|
+
};
|
|
182
|
+
export const IamRuntimeOrganizationUpdateSchema = {
|
|
183
|
+
type: 'object',
|
|
184
|
+
properties: { title: { ...TitleSchema } },
|
|
185
|
+
required: ['title'],
|
|
186
|
+
additionalProperties: false,
|
|
187
|
+
};
|
|
188
|
+
export const IamRuntimeOrganizationParamsSchema = {
|
|
189
|
+
type: 'object',
|
|
190
|
+
properties: { entitySlug: { ...EntitySlugValueSchema } },
|
|
191
|
+
required: ['entitySlug'],
|
|
192
|
+
additionalProperties: false,
|
|
193
|
+
};
|
|
194
|
+
export const IamRuntimeMemberInviteSchema = {
|
|
195
|
+
type: 'object',
|
|
196
|
+
properties: {
|
|
197
|
+
email: { ...EmailSchema },
|
|
198
|
+
name: { ...TitleSchema, nullable: true },
|
|
199
|
+
owner: { type: 'boolean', nullable: true },
|
|
200
|
+
},
|
|
201
|
+
required: ['email'],
|
|
202
|
+
additionalProperties: false,
|
|
203
|
+
};
|
|
204
|
+
export const IamRuntimeMemberParamsSchema = {
|
|
205
|
+
type: 'object',
|
|
206
|
+
properties: {
|
|
207
|
+
entitySlug: { ...EntitySlugValueSchema },
|
|
208
|
+
profileId: { ...ProfileIdSchema },
|
|
209
|
+
},
|
|
210
|
+
required: ['entitySlug', 'profileId'],
|
|
211
|
+
additionalProperties: false,
|
|
212
|
+
};
|
|
213
|
+
export const IamRuntimeGrantQuerySchema = {
|
|
214
|
+
type: 'object',
|
|
215
|
+
properties: { profileId: { ...ProfileIdSchema, nullable: true } },
|
|
216
|
+
required: [],
|
|
217
|
+
additionalProperties: false,
|
|
218
|
+
};
|
|
219
|
+
export const IamRuntimeAckSchema = {
|
|
220
|
+
type: 'object',
|
|
221
|
+
properties: { ok: { type: 'boolean' } },
|
|
222
|
+
required: ['ok'],
|
|
223
|
+
additionalProperties: false,
|
|
224
|
+
};
|
|
4
225
|
//# sourceMappingURL=consts.js.map
|
package/build/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAA;AAE1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAA;AAC3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAA;AAE1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAA;AAC3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAA;AAE/C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAA;AAE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AW,CAAC;IACrC,oBAAoB,EAAE,KAAK;CAC5B,CAAA;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAyC;IAC9E,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,GAAG,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;IACjE,QAAQ,EAAE,EAAE;IACZ,oBAAoB,EAAE,KAAK;CAC5B,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAkC;IAChE,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IACvC,QAAQ,EAAE,CAAC,IAAI,CAAC;IAChB,oBAAoB,EAAE,KAAK;CAC5B,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export declare const TitleSchema: {
|
|
2
|
+
readonly type: 'string';
|
|
3
|
+
readonly minLength: 0;
|
|
4
|
+
readonly maxLength: 256;
|
|
5
|
+
};
|
|
6
|
+
/** A pairwise subject: `<clientId>:<digest>`. Never a path separator, never whitespace. */
|
|
7
|
+
export declare const ProfileIdSchema: {
|
|
8
|
+
readonly type: 'string';
|
|
9
|
+
readonly minLength: 1;
|
|
10
|
+
readonly maxLength: 256;
|
|
11
|
+
readonly pattern: '^[^/\\s]+$';
|
|
12
|
+
};
|
|
13
|
+
export declare const PermissionNameSchema: {
|
|
14
|
+
readonly type: 'string';
|
|
15
|
+
readonly minLength: 1;
|
|
16
|
+
readonly maxLength: 128;
|
|
17
|
+
};
|
|
18
|
+
export declare const EmailSchema: {
|
|
19
|
+
readonly type: 'string';
|
|
20
|
+
readonly format: 'email';
|
|
21
|
+
readonly minLength: 3;
|
|
22
|
+
readonly maxLength: 254;
|
|
23
|
+
};
|
|
24
|
+
export declare const ResourcesSchema: {
|
|
25
|
+
readonly type: 'array';
|
|
26
|
+
readonly items: {
|
|
27
|
+
readonly type: 'string';
|
|
28
|
+
readonly minLength: 1;
|
|
29
|
+
readonly maxLength: 128;
|
|
30
|
+
};
|
|
31
|
+
readonly maxItems: 256;
|
|
32
|
+
readonly nullable: true;
|
|
33
|
+
};
|
|
34
|
+
export declare const aliases: {
|
|
35
|
+
readonly base: 'iam-runtime';
|
|
36
|
+
readonly organization: {
|
|
37
|
+
readonly list: 'iam-runtime:organization:list';
|
|
38
|
+
readonly create: 'iam-runtime:organization:create';
|
|
39
|
+
readonly update: 'iam-runtime:organization:update';
|
|
40
|
+
};
|
|
41
|
+
readonly member: {
|
|
42
|
+
readonly list: 'iam-runtime:member:list';
|
|
43
|
+
readonly add: 'iam-runtime:member:add';
|
|
44
|
+
readonly update: 'iam-runtime:member:update';
|
|
45
|
+
readonly remove: 'iam-runtime:member:remove';
|
|
46
|
+
};
|
|
47
|
+
readonly permission: {
|
|
48
|
+
readonly list: 'iam-runtime:permission:list';
|
|
49
|
+
};
|
|
50
|
+
readonly grant: {
|
|
51
|
+
readonly list: 'iam-runtime:grant:list';
|
|
52
|
+
readonly assign: 'iam-runtime:grant:assign';
|
|
53
|
+
readonly revoke: 'iam-runtime:grant:revoke';
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
/** Keys a facet stand-in answers `undefined` for, so it is never mistaken for a thenable or a primitive. */
|
|
57
|
+
export declare const INERT_KEYS: Set<PropertyKey>;
|
|
58
|
+
//# sourceMappingURL=consts.local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.d.ts","sourceRoot":"","sources":["../src/consts.local.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;aAAK,IAAI,EAAE,QAAQ;aAAE,SAAS,EAAE,CAAC;aAAE,SAAS,EAAE,GAAG;CAAW,CAAA;AAEpF,2FAA2F;AAC3F,eAAO,MAAM,eAAe;aAAK,IAAI,EAAE,QAAQ;aAAE,SAAS,EAAE,CAAC;aAAE,SAAS,EAAE,GAAG;aAAE,OAAO,EAAE,YAAY;CAAW,CAAA;AAE/G,eAAO,MAAM,oBAAoB;aAAK,IAAI,EAAE,QAAQ;aAAE,SAAS,EAAE,CAAC;aAAE,SAAS,EAAE,GAAG;CAAW,CAAA;AAE7F,eAAO,MAAM,WAAW;aAAK,IAAI,EAAE,QAAQ;aAAE,MAAM,EAAE,OAAO;aAAE,SAAS,EAAE,CAAC;aAAE,SAAS,EAAE,GAAG;CAAW,CAAA;AAErG,eAAO,MAAM,eAAe;aAC1B,IAAI,EAAE,OAAO;aAAE,KAAK;iBAAI,IAAI,EAAE,QAAQ;iBAAE,SAAS,EAAE,CAAC;iBAAE,SAAS,EAAE,GAAG;;aAAI,QAAQ,EAAE,GAAG;aAAE,QAAQ;CACvF,CAAA;AAEV,eAAO,MAAM,OAAO;aAClB,IAAI,EAAE,aAAa;aACnB,YAAY;iBAAI,IAAI,EAAE,+BAA+B;iBAAE,MAAM,EAAE,iCAAiC;iBAAE,MAAM,EAAE,iCAAiC;;aAC3I,MAAM;iBACJ,IAAI,EAAE,yBAAyB;iBAAE,GAAG,EAAE,wBAAwB;iBAC9D,MAAM,EAAE,2BAA2B;iBAAE,MAAM,EAAE,2BAA2B;;aAE1E,UAAU;iBAAI,IAAI,EAAE,6BAA6B;;aACjD,KAAK;iBAAI,IAAI,EAAE,wBAAwB;iBAAE,MAAM,EAAE,0BAA0B;iBAAE,MAAM,EAAE,0BAA0B;;CACvG,CAAA;AAEV,4GAA4G;AAC5G,eAAO,MAAM,UAAU,kBAA2C,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const TitleSchema = { type: 'string', minLength: 0, maxLength: 256 };
|
|
2
|
+
/** A pairwise subject: `<clientId>:<digest>`. Never a path separator, never whitespace. */
|
|
3
|
+
export const ProfileIdSchema = { type: 'string', minLength: 1, maxLength: 256, pattern: '^[^/\\s]+$' };
|
|
4
|
+
export const PermissionNameSchema = { type: 'string', minLength: 1, maxLength: 128 };
|
|
5
|
+
export const EmailSchema = { type: 'string', format: 'email', minLength: 3, maxLength: 254 };
|
|
6
|
+
export const ResourcesSchema = {
|
|
7
|
+
type: 'array', items: { type: 'string', minLength: 1, maxLength: 128 }, maxItems: 256, nullable: true,
|
|
8
|
+
};
|
|
9
|
+
export const aliases = {
|
|
10
|
+
base: 'iam-runtime',
|
|
11
|
+
organization: { list: 'iam-runtime:organization:list', create: 'iam-runtime:organization:create', update: 'iam-runtime:organization:update' },
|
|
12
|
+
member: {
|
|
13
|
+
list: 'iam-runtime:member:list', add: 'iam-runtime:member:add',
|
|
14
|
+
update: 'iam-runtime:member:update', remove: 'iam-runtime:member:remove',
|
|
15
|
+
},
|
|
16
|
+
permission: { list: 'iam-runtime:permission:list' },
|
|
17
|
+
grant: { list: 'iam-runtime:grant:list', assign: 'iam-runtime:grant:assign', revoke: 'iam-runtime:grant:revoke' },
|
|
18
|
+
};
|
|
19
|
+
/** Keys a facet stand-in answers `undefined` for, so it is never mistaken for a thenable or a primitive. */
|
|
20
|
+
export const INERT_KEYS = new Set(['then', 'toJSON']);
|
|
21
|
+
//# sourceMappingURL=consts.local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../src/consts.local.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAW,CAAA;AAEpF,2FAA2F;AAC3F,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,EAAW,CAAA;AAE/G,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAW,CAAA;AAE7F,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAW,CAAA;AAErG,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI;CAC7F,CAAA;AAEV,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE,aAAa;IACnB,YAAY,EAAE,EAAE,IAAI,EAAE,+BAA+B,EAAE,MAAM,EAAE,iCAAiC,EAAE,MAAM,EAAE,iCAAiC,EAAE;IAC7I,MAAM,EAAE;QACN,IAAI,EAAE,yBAAyB,EAAE,GAAG,EAAE,wBAAwB;QAC9D,MAAM,EAAE,2BAA2B,EAAE,MAAM,EAAE,2BAA2B;KACzE;IACD,UAAU,EAAE,EAAE,IAAI,EAAE,6BAA6B,EAAE;IACnD,KAAK,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,MAAM,EAAE,0BAA0B,EAAE,MAAM,EAAE,0BAA0B,EAAE;CACzG,CAAA;AAEV,4GAA4G;AAC5G,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA"}
|
package/build/errors.d.ts
CHANGED
|
@@ -15,6 +15,19 @@ export declare class IamGrantError extends IamError {
|
|
|
15
15
|
static typeName: string;
|
|
16
16
|
constructor(message?: string);
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* A refusal about a permission DEFINITION, as opposed to a grant.
|
|
20
|
+
*
|
|
21
|
+
* Separate from `IamGrantError`, which means a grant's subject is missing or its entity does not
|
|
22
|
+
* match — reusing it for a definition-level refusal is a category error the next reader has to unpick.
|
|
23
|
+
*
|
|
24
|
+
* Codes: `permission:held:<name>` (still granted to someone, under a policy that refuses),
|
|
25
|
+
* `permission:managed:<name>` (platform-owned, deleted only with an explicit second key).
|
|
26
|
+
*/
|
|
27
|
+
export declare class IamPermissionError extends IamError {
|
|
28
|
+
static typeName: string;
|
|
29
|
+
constructor(message?: string);
|
|
30
|
+
}
|
|
18
31
|
export declare class IamUnsupported extends IamError {
|
|
19
32
|
static typeName: string;
|
|
20
33
|
constructor(message?: string);
|
|
@@ -23,4 +36,17 @@ export declare class IamUserError extends IamError {
|
|
|
23
36
|
static typeName: string;
|
|
24
37
|
constructor(message?: string);
|
|
25
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* A refusal about an organization or a membership in it — an unknown organization, the last owner,
|
|
41
|
+
* the membership cap.
|
|
42
|
+
*/
|
|
43
|
+
export declare class IamOrganizationError extends IamError {
|
|
44
|
+
static typeName: string;
|
|
45
|
+
constructor(message?: string);
|
|
46
|
+
}
|
|
47
|
+
/** A refusal about a group: an unknown key, a managed group written by an operator, another app's group. */
|
|
48
|
+
export declare class IamGroupError extends IamError {
|
|
49
|
+
static typeName: string;
|
|
50
|
+
constructor(message?: string);
|
|
51
|
+
}
|
|
26
52
|
//# sourceMappingURL=errors.d.ts.map
|
package/build/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,qBAAa,QAAS,SAAQ,cAAc;IAC1C,OAAuB,QAAQ,SAAkC;IAEjE,YAAY,OAAO,SAAU,EAG5B;CACF;AAED,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,OAAuB,QAAQ,SAAwC;IAEvE,YAAY,OAAO,SAAU,EAG5B;CACF;AAED,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,OAAuB,QAAQ,SAA0C;IAEzE,YAAY,OAAO,SAAU,EAG5B;CACF;AAED,qBAAa,aAAc,SAAQ,QAAQ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G,qBAAa,aAAc,SAAQ,QAAQ;IACzC,OAAuB,QAAQ,SAAuC;IAEtE,YAAY,OAAO,SAAU,EAG5B;CACF"}
|
package/build/errors.js
CHANGED
|
@@ -27,6 +27,22 @@ export class IamGrantError extends IamError {
|
|
|
27
27
|
this.type = IamGrantError.typeName;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* A refusal about a permission DEFINITION, as opposed to a grant.
|
|
32
|
+
*
|
|
33
|
+
* Separate from `IamGrantError`, which means a grant's subject is missing or its entity does not
|
|
34
|
+
* match — reusing it for a definition-level refusal is a category error the next reader has to unpick.
|
|
35
|
+
*
|
|
36
|
+
* Codes: `permission:held:<name>` (still granted to someone, under a policy that refuses),
|
|
37
|
+
* `permission:managed:<name>` (platform-owned, deleted only with an explicit second key).
|
|
38
|
+
*/
|
|
39
|
+
export class IamPermissionError extends IamError {
|
|
40
|
+
static typeName = `IamPermission${ResilientError.typeName}`;
|
|
41
|
+
constructor(message = 'error') {
|
|
42
|
+
super(`permission:${message}`);
|
|
43
|
+
this.type = IamPermissionError.typeName;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
30
46
|
export class IamUnsupported extends IamError {
|
|
31
47
|
static typeName = `IamUnsupported${ResilientError.typeName}`;
|
|
32
48
|
constructor(message = 'error') {
|
|
@@ -41,10 +57,32 @@ export class IamUserError extends IamError {
|
|
|
41
57
|
this.type = IamUserError.typeName;
|
|
42
58
|
}
|
|
43
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* A refusal about an organization or a membership in it — an unknown organization, the last owner,
|
|
62
|
+
* the membership cap.
|
|
63
|
+
*/
|
|
64
|
+
export class IamOrganizationError extends IamError {
|
|
65
|
+
static typeName = `IamOrganization${ResilientError.typeName}`;
|
|
66
|
+
constructor(message = 'error') {
|
|
67
|
+
super(`organization:${message}`);
|
|
68
|
+
this.type = IamOrganizationError.typeName;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** A refusal about a group: an unknown key, a managed group written by an operator, another app's group. */
|
|
72
|
+
export class IamGroupError extends IamError {
|
|
73
|
+
static typeName = `IamGroup${ResilientError.typeName}`;
|
|
74
|
+
constructor(message = 'error') {
|
|
75
|
+
super(`group:${message}`);
|
|
76
|
+
this.type = IamGroupError.typeName;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
44
79
|
ResilientError.registerErrorClass(IamError);
|
|
45
80
|
ResilientError.registerErrorClass(IamClientError);
|
|
46
81
|
ResilientError.registerErrorClass(IamResourceError);
|
|
47
82
|
ResilientError.registerErrorClass(IamGrantError);
|
|
83
|
+
ResilientError.registerErrorClass(IamPermissionError);
|
|
48
84
|
ResilientError.registerErrorClass(IamUnsupported);
|
|
49
85
|
ResilientError.registerErrorClass(IamUserError);
|
|
86
|
+
ResilientError.registerErrorClass(IamOrganizationError);
|
|
87
|
+
ResilientError.registerErrorClass(IamGroupError);
|
|
50
88
|
//# sourceMappingURL=errors.js.map
|
package/build/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,MAAM,OAAO,QAAS,SAAQ,cAAc;IACnC,MAAM,CAAU,QAAQ,GAAG,MAAM,cAAc,CAAC,QAAQ,EAAE,CAAA;IAEjE,YAAY,OAAO,GAAG,OAAO;QAC3B,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,OAAO,EAAE,CAAC,CAAA;QAC1C,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAA;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,QAAQ;IACnC,MAAM,CAAU,QAAQ,GAAG,YAAY,cAAc,CAAC,QAAQ,EAAE,CAAA;IAEvE,YAAY,OAAO,GAAG,OAAO;QAC3B,KAAK,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;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C3C,CAAC;CACF;AAED,4GAA4G;AAC5G,MAAM,OAAO,aAAc,SAAQ,QAAQ;IAClC,MAAM,CAAU,QAAQ,GAAG,WAAW,cAAc,CAAC,QAAQ,EAAE,CAAA;IAEtE,YAAY,OAAO,GAAG,OAAO;QAC3B,KAAK,CAAC,SAAS,OAAO,EAAE,CAAC,CAAA;QACzB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAA;IACpC,CAAC;CACF;AAED,cAAc,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAA;AAC3C,cAAc,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;AACjD,cAAc,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;AACnD,cAAc,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAA;AAChD,cAAc,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;AACrD,cAAc,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;AACjD,cAAc,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAA;AAC/C,cAAc,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAA;AACvD,cAAc,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAA"}
|
package/build/facet.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A facet a backend cannot provide: every method throws `IamUnsupported(what)`.
|
|
3
|
+
*
|
|
4
|
+
* It throws SYNCHRONOUSLY, because a facet may carry synchronous methods (`subjects.identify`) and a
|
|
5
|
+
* rejected promise would hand those a value of the wrong type; an awaited call rejects the same way
|
|
6
|
+
* either way. Caller code turns the refusal into a fallback, exactly as for any other unsupported
|
|
7
|
+
* operation.
|
|
8
|
+
*/
|
|
9
|
+
export declare const unsupportedFacet: <T extends object>(what: string) => T;
|
|
10
|
+
//# sourceMappingURL=facet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facet.d.ts","sourceRoot":"","sources":["../src/facet.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,QAAQ,MAAM,KAAG,CAK9D,CAAA"}
|
package/build/facet.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IamUnsupported } from './errors.js';
|
|
2
|
+
import { INERT_KEYS } from './consts.local.js';
|
|
3
|
+
/**
|
|
4
|
+
* A facet a backend cannot provide: every method throws `IamUnsupported(what)`.
|
|
5
|
+
*
|
|
6
|
+
* It throws SYNCHRONOUSLY, because a facet may carry synchronous methods (`subjects.identify`) and a
|
|
7
|
+
* rejected promise would hand those a value of the wrong type; an awaited call rejects the same way
|
|
8
|
+
* either way. Caller code turns the refusal into a fallback, exactly as for any other unsupported
|
|
9
|
+
* operation.
|
|
10
|
+
*/
|
|
11
|
+
export const unsupportedFacet = (what) => new Proxy(Object.freeze({}), {
|
|
12
|
+
get: (_, key) => typeof key === 'symbol' || INERT_KEYS.has(key)
|
|
13
|
+
? undefined
|
|
14
|
+
: () => { throw new IamUnsupported(what); },
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=facet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facet.js","sourceRoot":"","sources":["../src/facet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAmB,IAAY,EAAK,EAAE,CACpE,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAM,EAAE;IAChC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;QAC7D,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,IAAI,cAAc,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC;CAC7C,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.d.ts","sourceRoot":"","sources":["../../src/gate/consts.local.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,EAAqC,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../../src/gate/consts.local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gate/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gate/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GateParamHelper, ParsedGateParam } from './types.js';
|
|
2
|
+
export declare const createGateParamHelper: () => GateParamHelper;
|
|
3
|
+
export declare const gateParamHelper: GateParamHelper;
|
|
4
|
+
/** @deprecated compat:factory-refactor — use `gateParamHelper.parseGateParam(…)` */
|
|
5
|
+
export declare const parseGateParam: (param: string) => ParsedGateParam;
|
|
6
|
+
//# sourceMappingURL=param.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"param.d.ts","sourceRoot":"","sources":["../../src/gate/param.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAA0C,eAAe,EAAE,MAAM,YAAY,CAAA;AAG1G,eAAO,MAAM,qBAAqB,QAAO,eA+FxC,CAAA;AAED,eAAO,MAAM,eAAe,iBAA0B,CAAA;AAEtD,oFAAoF;AACpF,eAAO,MAAM,cAAc,UAAW,MAAM,KAAG,eAAwD,CAAA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { RESOURCE_PARAM_SEPARATOR, RESOURCE_SOURCE_SEPARATOR, RESOURCE_PATH_SEPARATOR, GateParamErrorCode, DEFAULT_GATE_PARAM_SOURCES } from '../consts.js';
|
|
2
|
+
import { SOURCES } from './consts.local.js';
|
|
3
|
+
export const createGateParamHelper = () => {
|
|
4
|
+
const parseGateSelector = (selector) => {
|
|
5
|
+
if (selector === '') {
|
|
6
|
+
return { code: GateParamErrorCode.EmptySelector, detail: 'the selector after "@" is empty' };
|
|
7
|
+
}
|
|
8
|
+
const idx = selector.indexOf(RESOURCE_SOURCE_SEPARATOR);
|
|
9
|
+
if (idx < 0) {
|
|
10
|
+
return {
|
|
11
|
+
selector,
|
|
12
|
+
path: [selector],
|
|
13
|
+
sources: DEFAULT_GATE_PARAM_SOURCES
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const source = selector.slice(0, idx);
|
|
17
|
+
const rest = selector.slice(idx + 1);
|
|
18
|
+
if (!SOURCES.includes(source)) {
|
|
19
|
+
return {
|
|
20
|
+
code: GateParamErrorCode.UnknownSource,
|
|
21
|
+
detail: `"${source}" is not one of ${SOURCES.join(', ')}`
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
if (rest === '') {
|
|
25
|
+
return {
|
|
26
|
+
code: GateParamErrorCode.EmptySelector,
|
|
27
|
+
detail: `"${source}:" names no path`
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const path = rest.split(RESOURCE_PATH_SEPARATOR);
|
|
31
|
+
if (path.some(segment => segment === '')) {
|
|
32
|
+
return {
|
|
33
|
+
code: GateParamErrorCode.EmptySegment,
|
|
34
|
+
detail: `"${rest}" has an empty path segment`
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
selector,
|
|
39
|
+
source: source,
|
|
40
|
+
path,
|
|
41
|
+
sources: [source]
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const parseGateParam = (param) => {
|
|
45
|
+
const idx = param.indexOf(RESOURCE_PARAM_SEPARATOR);
|
|
46
|
+
if (idx < 0) {
|
|
47
|
+
return { permission: param };
|
|
48
|
+
}
|
|
49
|
+
const permission = param.slice(0, idx);
|
|
50
|
+
const selector = param.slice(idx + 1);
|
|
51
|
+
const parsed = parseGateSelector(selector);
|
|
52
|
+
if ('code' in parsed) {
|
|
53
|
+
return { permission, resourceParam: selector, error: parsed };
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
permission,
|
|
57
|
+
// Kept for readers written against the flat form. Only meaningful when the form IS flat.
|
|
58
|
+
...(parsed.source == null ? { resourceParam: selector } : {}),
|
|
59
|
+
resource: parsed
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const formatGateParam = (permission, selector) => {
|
|
63
|
+
if (selector == null) {
|
|
64
|
+
return permission;
|
|
65
|
+
}
|
|
66
|
+
if (typeof selector === 'string') {
|
|
67
|
+
return selector === '' ? permission : `${permission}${RESOURCE_PARAM_SEPARATOR}${selector}`;
|
|
68
|
+
}
|
|
69
|
+
if (selector.path.length < 1) {
|
|
70
|
+
return permission;
|
|
71
|
+
}
|
|
72
|
+
const path = selector.path.join(RESOURCE_PATH_SEPARATOR);
|
|
73
|
+
const tail = selector.source == null
|
|
74
|
+
? path
|
|
75
|
+
: `${selector.source}${RESOURCE_SOURCE_SEPARATOR}${path}`;
|
|
76
|
+
return `${permission}${RESOURCE_PARAM_SEPARATOR}${tail}`;
|
|
77
|
+
};
|
|
78
|
+
return { parseGateSelector, parseGateParam, formatGateParam };
|
|
79
|
+
};
|
|
80
|
+
export const gateParamHelper = createGateParamHelper();
|
|
81
|
+
/** @deprecated compat:factory-refactor — use `gateParamHelper.parseGateParam(…)` */
|
|
82
|
+
export const parseGateParam = (param) => gateParamHelper.parseGateParam(param);
|
|
83
|
+
//# sourceMappingURL=param.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"param.js","sourceRoot":"","sources":["../../src/gate/param.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAAE,yBAAyB,EAAE,uBAAuB,EAC3D,kBAAkB,EAAE,0BAA0B,EAChE,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE3C,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAoB,EAAE;IACzD,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAA2C,EAAE;QACtF,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;YACpB,OAAO,EAAE,IAAI,EAAE,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,iCAAiC,EAAE,CAAA;QAC9F,CAAC;QAED,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAA;QACvD,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;YACZ,OAAO;gBACL,QAAQ;gBACR,IAAI,EAAE,CAAC,QAAQ,CAAC;gBAChB,OAAO,EAAE,0BAA0B;aACpC,CAAA;QACH,CAAC;QAED,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;QACrC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;QAEpC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,OAAO;gBACL,IAAI,EAAE,kBAAkB,CAAC,aAAa;gBACtC,MAAM,EAAE,IAAI,MAAM,mBAAmB,OAA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
|
+
import type { GateRequestLike, GateResourceSelector, GateResourceResolution } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the resource id a selector points at.
|
|
4
|
+
*
|
|
5
|
+
* Sources are tried in the selector's own order — for the bare form, route params before the query —
|
|
6
|
+
* and the first that yields a value wins. When none does, the reason travels back so the caller can
|
|
7
|
+
* tell a MISCONFIGURED gate (the request never carried that key) from a legitimately DENIED one.
|
|
8
|
+
*/
|
|
9
|
+
export declare const resolveGateResource: (req: GateRequestLike, selector: GateResourceSelector) => GateResourceResolution;
|
|
10
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/gate/resolve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AA4E/F;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,QACzB,eAAe,YAAY,oBAAoB,KACnD,sBA2BF,CAAA"}
|