@softistx/janus-graphql 0.0.0-stage → 0.30.2
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/LICENSE +21 -0
- package/README.md +716 -2
- package/dist/api-keys/index.d.ts +11 -0
- package/dist/api-keys/index.d.ts.map +1 -0
- package/dist/api-keys/resolvers/deps.d.ts +39 -0
- package/dist/api-keys/resolvers/deps.d.ts.map +1 -0
- package/dist/api-keys/resolvers/index.d.ts +39 -0
- package/dist/api-keys/resolvers/index.d.ts.map +1 -0
- package/dist/api-keys/resolvers/list.d.ts +16 -0
- package/dist/api-keys/resolvers/list.d.ts.map +1 -0
- package/dist/api-keys/resolvers/manage.d.ts +17 -0
- package/dist/api-keys/resolvers/manage.d.ts.map +1 -0
- package/dist/api-keys/sdl.d.ts +14 -0
- package/dist/api-keys/sdl.d.ts.map +1 -0
- package/dist/api-keys/shape.d.ts +38 -0
- package/dist/api-keys/shape.d.ts.map +1 -0
- package/dist/api-keys/types.d.ts +149 -0
- package/dist/api-keys/types.d.ts.map +1 -0
- package/dist/avatar/index.d.ts +32 -0
- package/dist/avatar/index.d.ts.map +1 -0
- package/dist/avatar/resolvers.d.ts +41 -0
- package/dist/avatar/resolvers.d.ts.map +1 -0
- package/dist/avatar/sdl.d.ts +16 -0
- package/dist/avatar/sdl.d.ts.map +1 -0
- package/dist/bad-input.d.ts +17 -0
- package/dist/bad-input.d.ts.map +1 -0
- package/dist/connection/connection.d.ts +36 -0
- package/dist/connection/connection.d.ts.map +1 -0
- package/dist/connection/credential.d.ts +34 -0
- package/dist/connection/credential.d.ts.map +1 -0
- package/dist/connection/types.d.ts +61 -0
- package/dist/connection/types.d.ts.map +1 -0
- package/dist/context/create.d.ts +32 -0
- package/dist/context/create.d.ts.map +1 -0
- package/dist/context/index.d.ts +9 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/registry.d.ts +72 -0
- package/dist/context/registry.d.ts.map +1 -0
- package/dist/context/resolve.d.ts +20 -0
- package/dist/context/resolve.d.ts.map +1 -0
- package/dist/device.d.ts +28 -0
- package/dist/device.d.ts.map +1 -0
- package/dist/directives/apply.d.ts +51 -0
- package/dist/directives/apply.d.ts.map +1 -0
- package/dist/directives/guard.d.ts +22 -0
- package/dist/directives/guard.d.ts.map +1 -0
- package/dist/directives/permission/enforce.d.ts +24 -0
- package/dist/directives/permission/enforce.d.ts.map +1 -0
- package/dist/directives/permission/model.d.ts +35 -0
- package/dist/directives/permission/model.d.ts.map +1 -0
- package/dist/directives/permission/path.d.ts +31 -0
- package/dist/directives/permission/path.d.ts.map +1 -0
- package/dist/directives/permission/validate.d.ts +42 -0
- package/dist/directives/permission/validate.d.ts.map +1 -0
- package/dist/directives/read.d.ts +43 -0
- package/dist/directives/read.d.ts.map +1 -0
- package/dist/directives/validate.d.ts +39 -0
- package/dist/directives/validate.d.ts.map +1 -0
- package/dist/directives/words.d.ts +7 -0
- package/dist/directives/words.d.ts.map +1 -0
- package/dist/errors/denial.d.ts +6 -0
- package/dist/errors/denial.d.ts.map +1 -0
- package/dist/errors/index.d.ts +12 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/janus-error.d.ts +20 -0
- package/dist/errors/janus-error.d.ts.map +1 -0
- package/dist/errors/mask.d.ts +69 -0
- package/dist/errors/mask.d.ts.map +1 -0
- package/dist/fresh.d.ts +44 -0
- package/dist/fresh.d.ts.map +1 -0
- package/dist/helpers.d.ts +56 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3393 -0
- package/dist/index.js.map +75 -0
- package/dist/invitations/index.d.ts +12 -0
- package/dist/invitations/index.d.ts.map +1 -0
- package/dist/invitations/resolvers/anonymous.d.ts +11 -0
- package/dist/invitations/resolvers/anonymous.d.ts.map +1 -0
- package/dist/invitations/resolvers/deps.d.ts +38 -0
- package/dist/invitations/resolvers/deps.d.ts.map +1 -0
- package/dist/invitations/resolvers/index.d.ts +37 -0
- package/dist/invitations/resolvers/index.d.ts.map +1 -0
- package/dist/invitations/resolvers/owner.d.ts +17 -0
- package/dist/invitations/resolvers/owner.d.ts.map +1 -0
- package/dist/invitations/sdl/accept.d.ts +7 -0
- package/dist/invitations/sdl/accept.d.ts.map +1 -0
- package/dist/invitations/sdl/index.d.ts +14 -0
- package/dist/invitations/sdl/index.d.ts.map +1 -0
- package/dist/invitations/sdl/owner.d.ts +8 -0
- package/dist/invitations/sdl/owner.d.ts.map +1 -0
- package/dist/invitations/shape.d.ts +63 -0
- package/dist/invitations/shape.d.ts.map +1 -0
- package/dist/invitations/types/index.d.ts +5 -0
- package/dist/invitations/types/index.d.ts.map +1 -0
- package/dist/invitations/types/options.d.ts +104 -0
- package/dist/invitations/types/options.d.ts.map +1 -0
- package/dist/invitations/types/out.d.ts +136 -0
- package/dist/invitations/types/out.d.ts.map +1 -0
- package/dist/invitations/types/surface.d.ts +18 -0
- package/dist/invitations/types/surface.d.ts.map +1 -0
- package/dist/map-code.d.ts +10 -0
- package/dist/map-code.d.ts.map +1 -0
- package/dist/mask-error.d.ts +18 -0
- package/dist/mask-error.d.ts.map +1 -0
- package/dist/memo.d.ts +16 -0
- package/dist/memo.d.ts.map +1 -0
- package/dist/options.d.ts +17 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/passkeys/deps.d.ts +23 -0
- package/dist/passkeys/deps.d.ts.map +1 -0
- package/dist/passkeys/first-factor.types.d.ts +38 -0
- package/dist/passkeys/first-factor.types.d.ts.map +1 -0
- package/dist/passkeys/index.d.ts +14 -0
- package/dist/passkeys/index.d.ts.map +1 -0
- package/dist/passkeys/resolvers.d.ts +23 -0
- package/dist/passkeys/resolvers.d.ts.map +1 -0
- package/dist/passkeys/sdl.d.ts +14 -0
- package/dist/passkeys/sdl.d.ts.map +1 -0
- package/dist/passkeys/shape.d.ts +14 -0
- package/dist/passkeys/shape.d.ts.map +1 -0
- package/dist/passkeys/sign-in.resolvers.d.ts +19 -0
- package/dist/passkeys/sign-in.resolvers.d.ts.map +1 -0
- package/dist/passkeys/sign-in.sdl.d.ts +16 -0
- package/dist/passkeys/sign-in.sdl.d.ts.map +1 -0
- package/dist/passkeys/types.d.ts +193 -0
- package/dist/passkeys/types.d.ts.map +1 -0
- package/dist/plugin.d.ts +59 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/renewal.d.ts +51 -0
- package/dist/renewal.d.ts.map +1 -0
- package/dist/report.d.ts +29 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/sdl.d.ts +12 -0
- package/dist/sdl.d.ts.map +1 -0
- package/dist/second-factor/index.d.ts +12 -0
- package/dist/second-factor/index.d.ts.map +1 -0
- package/dist/second-factor/resolvers/deps.d.ts +39 -0
- package/dist/second-factor/resolvers/deps.d.ts.map +1 -0
- package/dist/second-factor/resolvers/index.d.ts +39 -0
- package/dist/second-factor/resolvers/index.d.ts.map +1 -0
- package/dist/second-factor/resolvers/sign-in.d.ts +10 -0
- package/dist/second-factor/resolvers/sign-in.d.ts.map +1 -0
- package/dist/second-factor/resolvers/status.d.ts +10 -0
- package/dist/second-factor/resolvers/status.d.ts.map +1 -0
- package/dist/second-factor/resolvers/step-up.d.ts +16 -0
- package/dist/second-factor/resolvers/step-up.d.ts.map +1 -0
- package/dist/second-factor/resolvers/writes.d.ts +19 -0
- package/dist/second-factor/resolvers/writes.d.ts.map +1 -0
- package/dist/second-factor/sdl.d.ts +14 -0
- package/dist/second-factor/sdl.d.ts.map +1 -0
- package/dist/second-factor/shape.d.ts +18 -0
- package/dist/second-factor/shape.d.ts.map +1 -0
- package/dist/second-factor/types/index.d.ts +5 -0
- package/dist/second-factor/types/index.d.ts.map +1 -0
- package/dist/second-factor/types/options.d.ts +61 -0
- package/dist/second-factor/types/options.d.ts.map +1 -0
- package/dist/second-factor/types/out.d.ts +84 -0
- package/dist/second-factor/types/out.d.ts.map +1 -0
- package/dist/second-factor/types/surface.d.ts +89 -0
- package/dist/second-factor/types/surface.d.ts.map +1 -0
- package/dist/social/index.d.ts +10 -0
- package/dist/social/index.d.ts.map +1 -0
- package/dist/social/resolvers.d.ts +25 -0
- package/dist/social/resolvers.d.ts.map +1 -0
- package/dist/social/sdl.d.ts +13 -0
- package/dist/social/sdl.d.ts.map +1 -0
- package/dist/social/shape.d.ts +11 -0
- package/dist/social/shape.d.ts.map +1 -0
- package/dist/social/types.d.ts +160 -0
- package/dist/social/types.d.ts.map +1 -0
- package/dist/surface/api.d.ts +16 -0
- package/dist/surface/api.d.ts.map +1 -0
- package/dist/surface/request.d.ts +10 -0
- package/dist/surface/request.d.ts.map +1 -0
- package/dist/surface/signed-in.d.ts +30 -0
- package/dist/surface/signed-in.d.ts.map +1 -0
- package/dist/types.d.ts +117 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/wiring.d.ts +56 -0
- package/dist/wiring.d.ts.map +1 -0
- package/docs/README.md +26 -0
- package/docs/guide/api-keys.md +365 -0
- package/docs/guide/avatars.md +129 -0
- package/docs/guide/context.md +371 -0
- package/docs/guide/directives.md +371 -0
- package/docs/guide/errors.md +318 -0
- package/docs/guide/federation.md +71 -0
- package/docs/guide/invitations.md +269 -0
- package/docs/guide/passkeys.md +207 -0
- package/docs/guide/second-factor.md +238 -0
- package/docs/guide/social.md +190 -0
- package/docs/guide/step-up.md +208 -0
- package/docs/guide/subscriptions.md +255 -0
- package/docs/guide/telemetry.md +45 -0
- package/docs/roadmap.md +124 -0
- package/docs/troubleshooting.md +1265 -0
- package/graphql/janus-api-keys.graphqls +237 -0
- package/graphql/janus-avatar.graphqls +19 -0
- package/graphql/janus-invitations.graphqls +280 -0
- package/graphql/janus-passkey-sign-in.graphqls +40 -0
- package/graphql/janus-passkeys.graphqls +134 -0
- package/graphql/janus-second-factor.graphqls +199 -0
- package/graphql/janus-social.graphqls +155 -0
- package/graphql/janus.graphqls +44 -0
- package/package.json +80 -5
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The invitation surface, opt-in: `janusInvitationTypeDefs` beside your own
|
|
3
|
+
* type definitions and `invitationResolvers({ auth, authorize, ... })` for its
|
|
4
|
+
* fields. The owner side (`invitations`, `issueInvitation`, `resendInvitation`,
|
|
5
|
+
* `revokeInvitation`) needs a signed-in user and your `authorize`; the
|
|
6
|
+
* invitee side (`invitationPreview`, `acceptInvitation`) is open to whoever
|
|
7
|
+
* holds the code, and a new invitee's accept sets the session cookie.
|
|
8
|
+
*/
|
|
9
|
+
export { invitationResolvers } from './resolvers';
|
|
10
|
+
export { janusInvitationTypeDefs } from './sdl';
|
|
11
|
+
export type { InvitationAction, InvitationAuth, InvitationResolvers, InvitationResolversOptions, InvitationSubject, } from './types';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/invitations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAChD,YAAY,EACX,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,0BAA0B,EAC1B,iBAAiB,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The invitee's fields, open to whoever holds the code: `invitationPreview` and `acceptInvitation`. */
|
|
2
|
+
import type { InvitationResolvers } from '../types';
|
|
3
|
+
import type { Deps } from './deps';
|
|
4
|
+
type Queries = InvitationResolvers['Query'];
|
|
5
|
+
type Mutations = InvitationResolvers['Mutation'];
|
|
6
|
+
/** `Query.invitationPreview`: what the code names, without spending it. */
|
|
7
|
+
export declare function invitationPreview(deps: Deps): Queries['invitationPreview'];
|
|
8
|
+
/** `Mutation.acceptInvitation`: accepts with the code; a new invitee is signed in. */
|
|
9
|
+
export declare function acceptInvitation(deps: Deps): Mutations['acceptInvitation'];
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=anonymous.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anonymous.d.ts","sourceRoot":"","sources":["../../../src/invitations/resolvers/anonymous.ts"],"names":[],"mappings":"AAAA,wGAAwG;AAUxG,OAAO,KAAK,EAAwB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC,KAAK,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC5C,KAAK,SAAS,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;AAEjD,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAW1E;AAsCD,sFAAsF;AACtF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC,kBAAkB,CAAC,CAiB1E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** What every field's resolver reads, resolved once by `invitationResolvers()`. */
|
|
2
|
+
import type { Invitation } from '@softistx/janus';
|
|
3
|
+
import type { DeviceCookieOptions } from '../../device';
|
|
4
|
+
import type { AnyUser, Context, InvitationAction, InvitationAuth, InvitationResolversOptions, InvitationSubject } from '../types';
|
|
5
|
+
export interface Deps {
|
|
6
|
+
readonly auth: InvitationAuth;
|
|
7
|
+
readonly invitations: InvitationAuth['invitations'];
|
|
8
|
+
readonly options: InvitationResolversOptions;
|
|
9
|
+
readonly answerCode: boolean;
|
|
10
|
+
readonly answerToken: boolean;
|
|
11
|
+
/** The device cookie's attributes, or `undefined` when devices are not tracked. */
|
|
12
|
+
readonly device: DeviceCookieOptions | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare function depsOf(options: InvitationResolversOptions): Deps;
|
|
15
|
+
/** What a call is about, beside the user and the scope. */
|
|
16
|
+
type About = Pick<InvitationSubject, 'input' | 'invitation' | 'page'>;
|
|
17
|
+
/**
|
|
18
|
+
* The stored invitation `id` names in `scope`, read with the core's
|
|
19
|
+
* `invitations.get`, or `null` when it names none (an unknown, malformed or
|
|
20
|
+
* other-scope id).
|
|
21
|
+
*/
|
|
22
|
+
export declare function stored({ invitations }: Deps, scope: string, id: string): Promise<Invitation | null>;
|
|
23
|
+
/**
|
|
24
|
+
* The inviter of an owner-side call: whatever `ctx.janus.user()` answers (an
|
|
25
|
+
* API key's owner included), of `inviterType` when given, and let through by
|
|
26
|
+
* `authorize`, which also gets `about`: what the call is about (an object, or a
|
|
27
|
+
* function that reads it once the user is known, so an unknown id answers as a
|
|
28
|
+
* refusal and never before the sign-in check). A `false` is `NOT_FOUND`.
|
|
29
|
+
*
|
|
30
|
+
* When that function answers `null` (the id names no invitation), `authorize`
|
|
31
|
+
* is still asked, with no `invitation`, and neither its answer nor an error it
|
|
32
|
+
* throws matters, except a `GraphQLError` (a step-up), which is thrown as for a
|
|
33
|
+
* known id: the call is otherwise `NOT_FOUND`. A known and an unknown id so take
|
|
34
|
+
* the same path and answer the same, whoever the caller is.
|
|
35
|
+
*/
|
|
36
|
+
export declare function owner({ options }: Deps, action: InvitationAction, scope: string, ctx: Context, about?: About | (() => Promise<About | null>)): Promise<AnyUser>;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=deps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../../src/invitations/resolvers/deps.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,KAAK,EACX,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,0BAA0B,EAC1B,iBAAiB,EACjB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,IAAI;IACpB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IACpD,QAAQ,CAAC,OAAO,EAAE,0BAA0B,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,mFAAmF;IACnF,QAAQ,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,CAAC;CACjD;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI,CAyBhE;AAED,2DAA2D;AAC3D,KAAK,KAAK,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,YAAY,GAAG,MAAM,CAAC,CAAC;AAEtE;;;;GAIG;AACH,wBAAsB,MAAM,CAC3B,EAAE,WAAW,EAAE,EAAE,IAAI,EACrB,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,GACR,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAE5B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,KAAK,CAC1B,EAAE,OAAO,EAAE,EAAE,IAAI,EACjB,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,OAAO,EACZ,KAAK,GAAE,KAAK,GAAG,CAAC,MAAM,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAM,GAC/C,OAAO,CAAC,OAAO,CAAC,CAwBlB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The resolvers of the invitation SDL: two `Query` fields, four `Mutation`
|
|
3
|
+
* fields, the page's lazy `totalCount` and the accept union's `__resolveType`. A new invitee's sign-in sets
|
|
4
|
+
* the session cookie (and the device cookie) through `useJanus()`'s
|
|
5
|
+
* `onResponse`, as a renewed session is.
|
|
6
|
+
*/
|
|
7
|
+
import type { Auth, UserOfAuth } from '../../types';
|
|
8
|
+
import type { AnyUser, InvitationAuth, InvitationResolvers, InvitationResolversOptions } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* The resolvers of the invitation SDL. A refusal of the core —
|
|
11
|
+
* `INVITATION_INVALID` (`field`), `INVITATION_LIMIT` (`maxActive`),
|
|
12
|
+
* `INVITATION_NOT_PENDING`, `INVITATION_REFUSED`, `PASSWORD_REQUIRED`… — is rethrown as its
|
|
13
|
+
* `GraphQLError`, so `janusMaskError()` answers its code and status. Needs
|
|
14
|
+
* `useJanus()` for the directives and for the cookies of an accept. Throws a
|
|
15
|
+
* `TypeError` at wiring when `auth` has no `invitations`, `authorize` is
|
|
16
|
+
* missing, or neither `sendInvitation` nor `answerCode` says where the code
|
|
17
|
+
* goes.
|
|
18
|
+
*
|
|
19
|
+
* **`authorize` is the only guard**, and `invitationPreview` and
|
|
20
|
+
* `acceptInvitation` are open to whoever holds a code: throttle them.
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* const resolvers = mergeResolvers([
|
|
24
|
+
* invitationResolvers({
|
|
25
|
+
* auth,
|
|
26
|
+
* authorize: (action, { user, scope }, ctx) => can(ctx, 'invite', { type: 'organization', id: scope }),
|
|
27
|
+
* sendInvitation: ({ invitation, code }) => mailer.sendInvitation(invitation, code),
|
|
28
|
+
* }),
|
|
29
|
+
* mine,
|
|
30
|
+
* ]);
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* `Query` and `Mutation` are keys of the map: merge it with yours rather than
|
|
34
|
+
* spreading over them.
|
|
35
|
+
*/
|
|
36
|
+
export declare function invitationResolvers<A extends InvitationAuth & Auth<AnyUser>, const T extends UserOfAuth<A>['type'] = never>(options: InvitationResolversOptions<A, T>): InvitationResolvers;
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/invitations/resolvers/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EACX,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,0BAA0B,EAC1B,MAAM,UAAU,CAAC;AAWlB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,mBAAmB,CAClC,CAAC,SAAS,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,EACxC,KAAK,CAAC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,EAC5C,OAAO,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,mBAAmB,CA2BhE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The owner-side fields: `invitations`, `issueInvitation`, `resendInvitation`, `revokeInvitation`. */
|
|
2
|
+
import type { InvitationResolvers } from '../types';
|
|
3
|
+
import { type Deps } from './deps';
|
|
4
|
+
type Queries = InvitationResolvers['Query'];
|
|
5
|
+
type Mutations = InvitationResolvers['Mutation'];
|
|
6
|
+
/** `Query.invitations`: one scope's invitations, oldest first unless `order` says otherwise. */
|
|
7
|
+
export declare function invitations(deps: Deps): Queries['invitations'];
|
|
8
|
+
/** `JanusInvitationPage.totalCount`: counted when selected, with the filters the page was listed with. */
|
|
9
|
+
export declare function totalCount(deps: Deps): InvitationResolvers['JanusInvitationPage']['totalCount'];
|
|
10
|
+
/** `Mutation.issueInvitation`: invites an address; the inviter is the request's user. */
|
|
11
|
+
export declare function issueInvitation(deps: Deps): Mutations['issueInvitation'];
|
|
12
|
+
/** `Mutation.resendInvitation`: a new code and lifetime for a pending invitation. */
|
|
13
|
+
export declare function resendInvitation(deps: Deps): Mutations['resendInvitation'];
|
|
14
|
+
/** `Mutation.revokeInvitation`: takes a pending invitation back. */
|
|
15
|
+
export declare function revokeInvitation(deps: Deps): Mutations['revokeInvitation'];
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=owner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owner.d.ts","sourceRoot":"","sources":["../../../src/invitations/resolvers/owner.ts"],"names":[],"mappings":"AAAA,uGAAuG;AAcvG,OAAO,KAAK,EAAW,mBAAmB,EAAa,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,KAAK,IAAI,EAAiB,MAAM,QAAQ,CAAC;AAElD,KAAK,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC5C,KAAK,SAAS,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;AAEjD,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,CAuB9D;AAED,0GAA0G;AAC1G,wBAAgB,UAAU,CACzB,IAAI,EAAE,IAAI,GACR,mBAAmB,CAAC,qBAAqB,CAAC,CAAC,YAAY,CAAC,CAW1D;AA2BD,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC,iBAAiB,CAAC,CA8BxE;AAED,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC,kBAAkB,CAAC,CAW1E;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC,kBAAkB,CAAC,CAW1E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The accept side of the invitation SDL: the preview and the three answers of
|
|
3
|
+
* `acceptInvitation`. Part of `janusInvitationTypeDefs`, whose text it is
|
|
4
|
+
* spliced into unchanged.
|
|
5
|
+
*/
|
|
6
|
+
export declare const acceptTypes: string;
|
|
7
|
+
//# sourceMappingURL=accept.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accept.d.ts","sourceRoot":"","sources":["../../../src/invitations/sdl/accept.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MA6FN,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The opt-in invitation SDL: put it beside your own type definitions when
|
|
3
|
+
* people are invited into a scope (an organization, a team). It `extend`s your
|
|
4
|
+
* `Query` and `Mutation`, and needs `janusTypeDefs` for its directives. The
|
|
5
|
+
* same text ships as `graphql/janus-invitations.graphqls` — `sdl.spec.ts`
|
|
6
|
+
* holds that the two are identical. Timestamps are ISO-8601 `String`s: no
|
|
7
|
+
* scalar to collide with.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* createSchema({ typeDefs: [janusTypeDefs, janusInvitationTypeDefs, typeDefs], resolvers });
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare const janusInvitationTypeDefs: string;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/invitations/sdl/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAKrC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The owner side of the invitation SDL: the invitation, its issued and page
|
|
3
|
+
* answers, the order, and the fields of `Query` and `Mutation`. Part of
|
|
4
|
+
* `janusInvitationTypeDefs`, whose text they are spliced into unchanged.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ownerTypes: string;
|
|
7
|
+
export declare const ownerOperations: string;
|
|
8
|
+
//# sourceMappingURL=owner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owner.d.ts","sourceRoot":"","sources":["../../../src/invitations/sdl/owner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAkGvB,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,MAoF5B,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The answers of the invitation resolvers: a core result as the plain object
|
|
3
|
+
* the schema's fields read, timestamps as ISO-8601 strings; and the two
|
|
4
|
+
* arguments that are checked here.
|
|
5
|
+
*/
|
|
6
|
+
import type { Invitation, InvitationPreview, InvitationStatus } from '@softistx/janus';
|
|
7
|
+
import type { InvitationOut, PageOut, PreviewOut } from './types';
|
|
8
|
+
export declare const invitationOut: (i: Invitation) => InvitationOut;
|
|
9
|
+
export declare const previewOut: (p: InvitationPreview, organization?: string | null) => PreviewOut;
|
|
10
|
+
export declare const pageOut: (page: {
|
|
11
|
+
readonly items: readonly Invitation[];
|
|
12
|
+
readonly nextCursor: string | null;
|
|
13
|
+
}, counted: PageOut['counted']) => PageOut;
|
|
14
|
+
/** The `role` and `ref` filters: each only when given, and non-empty (BAD_USER_INPUT otherwise). */
|
|
15
|
+
export declare function textFiltersOf(role: string | null | undefined, ref: string | null | undefined): {
|
|
16
|
+
role?: string;
|
|
17
|
+
ref?: string;
|
|
18
|
+
};
|
|
19
|
+
/** The `order` argument as the core's: `OLDEST` (the default) is `asc`. */
|
|
20
|
+
export declare function orderOf(order: 'OLDEST' | 'NEWEST' | null | undefined): {
|
|
21
|
+
readonly order?: never;
|
|
22
|
+
} | {
|
|
23
|
+
readonly order: "asc" | "desc";
|
|
24
|
+
};
|
|
25
|
+
/** The `lapsed` argument as the core's: `EXCLUDE` is `exclude`, `ONLY` is `only`. */
|
|
26
|
+
export declare function lapsedOf(lapsed: 'EXCLUDE' | 'ONLY' | null | undefined): {
|
|
27
|
+
readonly lapsed?: never;
|
|
28
|
+
} | {
|
|
29
|
+
readonly lapsed: "exclude" | "only";
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The longest each string argument of the invitation fields may be. The core
|
|
33
|
+
* bounds `scope`, `role`, `name`, `email`, `locale` and `ref` as `issue`
|
|
34
|
+
* keeps them, and a code is 43 characters; these are the same numbers, held
|
|
35
|
+
* here so an oversized argument is refused before `authorize`, a hash or a
|
|
36
|
+
* store is asked. They mirror `SCOPE_MAX`, `ROLE_MAX`, `NAME_MAX`,
|
|
37
|
+
* `EMAIL_MAX`, `LOCALE_MAX` and `REF_MAX` of `@softistx/janus`
|
|
38
|
+
* (`auth/invitations/input.ts`); resolvers.limits.spec.ts fails on a drift
|
|
39
|
+
* downwards. The core has no maximum on a password: 1024 is this
|
|
40
|
+
* layer's.
|
|
41
|
+
*/
|
|
42
|
+
export declare const INVITATION_LIMITS: {
|
|
43
|
+
readonly code: 43;
|
|
44
|
+
readonly password: 1024;
|
|
45
|
+
readonly scope: 512;
|
|
46
|
+
readonly role: 100;
|
|
47
|
+
readonly name: 100;
|
|
48
|
+
readonly email: 254;
|
|
49
|
+
readonly locale: 35;
|
|
50
|
+
readonly ref: 100;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Refuses (`BAD_USER_INPUT`, 400, `field`) an argument longer than its
|
|
54
|
+
* maximum. Absent arguments pass, and the message never echoes the value.
|
|
55
|
+
*/
|
|
56
|
+
export declare function boundedArgs(args: Partial<Record<keyof typeof INVITATION_LIMITS, string | null | undefined>>): void;
|
|
57
|
+
/** The `status` filter: absent, or one of the three statuses. */
|
|
58
|
+
export declare function statusOf(status: string | null | undefined): {
|
|
59
|
+
status?: never;
|
|
60
|
+
} | {
|
|
61
|
+
status: InvitationStatus;
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../src/invitations/shape.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACX,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE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-0,0 +1,5 @@
|
|
|
1
|
+
/** The types of the invitation resolvers: the surface they call, their options, and their answers. */
|
|
2
|
+
export type { Context, InvitationAction, InvitationResolversOptions, InvitationSubject, } from './options';
|
|
3
|
+
export type { AcceptedOut, InvitationOut, InvitationResolvers, IssuedOut, PageOut, PreviewOut, } from './out';
|
|
4
|
+
export type { AnyUser, InvitationAuth } from './surface';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/invitations/types/index.ts"],"names":[],"mappings":"AAAA,sGAAsG;AAEtG,YAAY,EACX,OAAO,EACP,gBAAgB,EAChB,0BAA0B,EAC1B,iBAAiB,GACjB,MAAM,WAAW,CAAC;AACnB,YAAY,EACX,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,SAAS,EACT,OAAO,EACP,UAAU,GACV,MAAM,OAAO,CAAC;AACf,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `invitationResolvers()` takes. The hooks (`authorize`, `sendInvitation`,
|
|
3
|
+
* `describeScope`) are methods so that `ctx` may be typed as the application's
|
|
4
|
+
* context (`YogaInitialContext & JanusContext<typeof auth, typeof access>`),
|
|
5
|
+
* which `can(ctx, …)` reads: the resolvers hand on the context Yoga gave them.
|
|
6
|
+
*/
|
|
7
|
+
import type { Invitation, InvitationStatus } from '@softistx/janus';
|
|
8
|
+
import type { DeviceCookieOptions } from '../../device';
|
|
9
|
+
import type { AnyUser, InvitationAuth } from './surface';
|
|
10
|
+
/** A GraphQL context as these resolvers read it. */
|
|
11
|
+
export interface Context {
|
|
12
|
+
readonly request?: Request;
|
|
13
|
+
}
|
|
14
|
+
/** The owner-side operations `authorize` is asked about. */
|
|
15
|
+
export type InvitationAction = 'issue' | 'resend' | 'revoke' | 'list';
|
|
16
|
+
/** What `authorize` is asked about, beside the user and the scope. */
|
|
17
|
+
export interface InvitationSubject {
|
|
18
|
+
readonly user: AnyUser;
|
|
19
|
+
readonly scope: string;
|
|
20
|
+
/** `issue`: what the mutation asked for (`locale` is absent when not given). */
|
|
21
|
+
readonly input?: {
|
|
22
|
+
readonly scope: string;
|
|
23
|
+
readonly email: string;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly role: string;
|
|
26
|
+
readonly locale?: string | null;
|
|
27
|
+
/** The opaque reference asked for, absent when not given. */
|
|
28
|
+
readonly ref?: string | null;
|
|
29
|
+
/** The user type asked for, absent when not given. */
|
|
30
|
+
readonly type?: string | null;
|
|
31
|
+
};
|
|
32
|
+
/** `resend` and `revoke`: the stored invitation, read before authorizing. */
|
|
33
|
+
readonly invitation?: Invitation;
|
|
34
|
+
/** `list`: the arguments the query gave (`status`, `role`, `ref`, `lapsed`, `order`, `limit`, `after`), only those present. */
|
|
35
|
+
readonly page?: {
|
|
36
|
+
readonly status?: InvitationStatus;
|
|
37
|
+
readonly role?: string;
|
|
38
|
+
readonly ref?: string;
|
|
39
|
+
readonly lapsed?: 'exclude' | 'only';
|
|
40
|
+
readonly order?: 'asc' | 'desc';
|
|
41
|
+
readonly limit?: number;
|
|
42
|
+
readonly after?: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface InvitationResolversOptions<A extends InvitationAuth = InvitationAuth, T extends string = string> {
|
|
46
|
+
/** What `janus()` answered; its instance needs `invitations`. */
|
|
47
|
+
readonly auth: A;
|
|
48
|
+
/**
|
|
49
|
+
* Whether `user` may do `action` in `scope`: **the only guard there is**,
|
|
50
|
+
* the core authorises nobody. `false` answers `NOT_FOUND`, as `@permission`
|
|
51
|
+
* does by default, so a scope's existence is not revealed; a thrown
|
|
52
|
+
* `GraphQLError` is answered as it is (`requireFresh(ctx, '10m')`).
|
|
53
|
+
* `subject` also says what the call is about: `input` for `issue`,
|
|
54
|
+
* `invitation` for `resend` and `revoke` (an id that names no invitation in
|
|
55
|
+
* the scope is `NOT_FOUND` whatever `authorize` answers: it is still asked,
|
|
56
|
+
* without `invitation`, and only a thrown `GraphQLError` gets through),
|
|
57
|
+
* `page` for `list` (a malformed `status` or `limit` is `BAD_USER_INPUT`,
|
|
58
|
+
* with the argument in `extensions.field`, before `authorize` is asked).
|
|
59
|
+
*/
|
|
60
|
+
authorize(action: InvitationAction, subject: InvitationSubject, ctx: Context): boolean | Promise<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* Delivers the invitation's code, after `issue` and `resend` (the e-mail's
|
|
63
|
+
* link). If it throws, the error goes up and the invitation stays pending:
|
|
64
|
+
* `resendInvitation` sends it again.
|
|
65
|
+
*/
|
|
66
|
+
sendInvitation?(sent: {
|
|
67
|
+
readonly action: 'issue' | 'resend';
|
|
68
|
+
readonly invitation: Invitation;
|
|
69
|
+
readonly code: string;
|
|
70
|
+
}, ctx: Context): void | Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Answer the code in `JanusIssuedInvitation.code` too, for an application
|
|
73
|
+
* whose inviter copies the link. Off by default: `code` is null. The
|
|
74
|
+
* response is `no-store` either way.
|
|
75
|
+
*/
|
|
76
|
+
readonly answerCode?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Answer the session token in `InvitationSignedIn.token` instead of setting
|
|
79
|
+
* the session cookie, for a backend-for-frontend. Off by default.
|
|
80
|
+
*/
|
|
81
|
+
readonly answerToken?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Track the device of the accept's sign-in: `true`, or the device cookie's
|
|
84
|
+
* attributes. Needs `janus({ devices })`.
|
|
85
|
+
*/
|
|
86
|
+
readonly device?: DeviceCookieOptions | true;
|
|
87
|
+
/**
|
|
88
|
+
* Names the organization (school, clinic, workspace) a scope stands for,
|
|
89
|
+
* so the accept page can say which one the invitee joins:
|
|
90
|
+
* `JanusInvitationPreview.organization` answers its `name`, or `null` when
|
|
91
|
+
* it answers `null` or is not given. A throw or rejection fails the preview
|
|
92
|
+
* (it propagates): return `null` to leave the name out. Called by `invitationPreview` with the
|
|
93
|
+
* invitation's scope, for whoever holds the code, so answer a display name
|
|
94
|
+
* only. Your data stays yours: nothing is stored.
|
|
95
|
+
*/
|
|
96
|
+
describeScope?(scope: string, ctx: Context): {
|
|
97
|
+
readonly name: string;
|
|
98
|
+
} | null | Promise<{
|
|
99
|
+
readonly name: string;
|
|
100
|
+
} | null>;
|
|
101
|
+
/** Only a user of this type may issue, resend, revoke and list. */
|
|
102
|
+
readonly inviterType?: T;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/invitations/types/options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD,oDAAoD;AACpD,MAAM,WAAW,OAAO;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,4DAA4D;AAC5D,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEtE,sEAAsE;AACtE,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gFAAgF;IAChF,QAAQ,CAAC,KAAK,CAAC,EAAE;QAChB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,C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E,MAAM,CAAC;KACtB,EACD,GAAG,EAAE,OAAO,GACV,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC7C;;;;;;;;OAQG;IACH,aAAa,CAAC,CACb,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,OAAO,GAEV;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GACzB,IAAI,GACJ,OAAO,CAAC;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAC7C,mEAAmE;IACnE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;CACzB"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/** The resolver map these resolvers return, and the plain objects the schema's fields read. */
|
|
2
|
+
import type { InvitationStatus } from '@softistx/janus';
|
|
3
|
+
import type { AnyUser, Context } from './index';
|
|
4
|
+
type Resolver<Args, Out> = (parent: unknown, args: Args, ctx: Context) => Promise<Out>;
|
|
5
|
+
export interface InvitationOut {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly scope: string;
|
|
8
|
+
readonly email: string;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly role: string;
|
|
11
|
+
readonly locale: string | null;
|
|
12
|
+
readonly ref: string | null;
|
|
13
|
+
readonly type: string;
|
|
14
|
+
readonly status: string;
|
|
15
|
+
readonly invitedBy: string | null;
|
|
16
|
+
readonly createdAt: string;
|
|
17
|
+
readonly updatedAt: string;
|
|
18
|
+
readonly expiresAt: string;
|
|
19
|
+
readonly acceptedBy: string | null;
|
|
20
|
+
readonly acceptedAt: string | null;
|
|
21
|
+
readonly revokedAt: string | null;
|
|
22
|
+
readonly revokedBy: string | null;
|
|
23
|
+
readonly resentBy: string | null;
|
|
24
|
+
}
|
|
25
|
+
export interface IssuedOut {
|
|
26
|
+
readonly invitation: InvitationOut;
|
|
27
|
+
/** The code with `answerCode`, else null. */
|
|
28
|
+
readonly code: string | null;
|
|
29
|
+
}
|
|
30
|
+
/** The filters `invitations` and `totalCount` share: only those given. */
|
|
31
|
+
export interface InvitationFilter {
|
|
32
|
+
readonly status?: InvitationStatus;
|
|
33
|
+
readonly role?: string;
|
|
34
|
+
readonly ref?: string;
|
|
35
|
+
readonly lapsed?: 'exclude' | 'only';
|
|
36
|
+
}
|
|
37
|
+
export interface PageOut {
|
|
38
|
+
readonly items: readonly InvitationOut[];
|
|
39
|
+
readonly nextCursor: string | null;
|
|
40
|
+
/**
|
|
41
|
+
* Not in the SDL: the scope and filters `totalCount` counts with, set by
|
|
42
|
+
* `invitations` once `authorize` let the scope through.
|
|
43
|
+
*/
|
|
44
|
+
readonly counted: {
|
|
45
|
+
readonly scope: string;
|
|
46
|
+
readonly filter: InvitationFilter;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface PreviewOut {
|
|
50
|
+
readonly id: string;
|
|
51
|
+
readonly scope: string;
|
|
52
|
+
readonly email: string;
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly role: string;
|
|
55
|
+
readonly locale: string | null;
|
|
56
|
+
readonly type: string;
|
|
57
|
+
/** The scope's organization name, from `describeScope`. */
|
|
58
|
+
readonly organization: string | null;
|
|
59
|
+
readonly expiresAt: string;
|
|
60
|
+
readonly needsPassword: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** What `acceptInvitation` answers; `status` picks the union member. */
|
|
63
|
+
export type AcceptedOut = {
|
|
64
|
+
readonly status: 'signedIn';
|
|
65
|
+
/** For a `user` field of your own on `InvitationSignedIn`. */
|
|
66
|
+
readonly user: AnyUser;
|
|
67
|
+
readonly token: string | null;
|
|
68
|
+
readonly userId: string;
|
|
69
|
+
readonly expiresAt: string;
|
|
70
|
+
readonly newDevice: boolean;
|
|
71
|
+
readonly invitationId: string;
|
|
72
|
+
readonly scope: string;
|
|
73
|
+
readonly role: string;
|
|
74
|
+
} | {
|
|
75
|
+
readonly status: 'secondFactor';
|
|
76
|
+
readonly challenge: string;
|
|
77
|
+
readonly expiresAt: string;
|
|
78
|
+
readonly methods: readonly string[];
|
|
79
|
+
readonly passkeyOptions: string | null;
|
|
80
|
+
readonly invitationId: string;
|
|
81
|
+
readonly scope: string;
|
|
82
|
+
} | {
|
|
83
|
+
readonly status: 'signIn';
|
|
84
|
+
readonly invitationId: string;
|
|
85
|
+
readonly scope: string;
|
|
86
|
+
readonly email: string;
|
|
87
|
+
};
|
|
88
|
+
/** The resolver map, keyed as `createSchema` expects. */
|
|
89
|
+
export interface InvitationResolvers {
|
|
90
|
+
readonly Query: {
|
|
91
|
+
readonly invitations: Resolver<{
|
|
92
|
+
readonly scope: string;
|
|
93
|
+
readonly status?: string | null;
|
|
94
|
+
readonly role?: string | null;
|
|
95
|
+
readonly ref?: string | null;
|
|
96
|
+
readonly order?: 'OLDEST' | 'NEWEST' | null;
|
|
97
|
+
readonly lapsed?: 'EXCLUDE' | 'ONLY' | null;
|
|
98
|
+
readonly limit?: number | null;
|
|
99
|
+
readonly after?: string | null;
|
|
100
|
+
}, PageOut>;
|
|
101
|
+
readonly invitationPreview: Resolver<{
|
|
102
|
+
readonly code: string;
|
|
103
|
+
}, PreviewOut>;
|
|
104
|
+
};
|
|
105
|
+
readonly Mutation: {
|
|
106
|
+
readonly issueInvitation: Resolver<{
|
|
107
|
+
readonly scope: string;
|
|
108
|
+
readonly email: string;
|
|
109
|
+
readonly name: string;
|
|
110
|
+
readonly role: string;
|
|
111
|
+
readonly locale?: string | null;
|
|
112
|
+
readonly ref?: string | null;
|
|
113
|
+
readonly type?: string | null;
|
|
114
|
+
}, IssuedOut>;
|
|
115
|
+
readonly resendInvitation: Resolver<{
|
|
116
|
+
readonly scope: string;
|
|
117
|
+
readonly id: string;
|
|
118
|
+
}, IssuedOut>;
|
|
119
|
+
readonly revokeInvitation: Resolver<{
|
|
120
|
+
readonly scope: string;
|
|
121
|
+
readonly id: string;
|
|
122
|
+
}, InvitationOut>;
|
|
123
|
+
readonly acceptInvitation: Resolver<{
|
|
124
|
+
readonly code: string;
|
|
125
|
+
readonly password?: string | null;
|
|
126
|
+
}, AcceptedOut>;
|
|
127
|
+
};
|
|
128
|
+
readonly JanusInvitationPage: {
|
|
129
|
+
readonly totalCount: (page: PageOut) => Promise<number>;
|
|
130
|
+
};
|
|
131
|
+
readonly InvitationAcceptResult: {
|
|
132
|
+
readonly __resolveType: (result: AcceptedOut) => string;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export {};
|
|
136
|
+
//# sourceMappingURL=out.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"out.d.ts","sourceRoot":"","sources":["../../../src/invitations/types/out.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAE/F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEhD,KAAK,QAAQ,CAAC,IAAI,EAAE,GAAG,IAAI,CAC1B,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,OAAO,KACR,OAAO,CAAC,GAAG,CAAC,CAAC;AAElB,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QA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, Session } from '@softistx/janus';
|
|
3
|
+
/** The user as these resolvers read one. */
|
|
4
|
+
export type AnyUser = {
|
|
5
|
+
readonly type: string;
|
|
6
|
+
readonly id: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* What `janus()` answered, as these resolvers read it: the session `cookie`
|
|
10
|
+
* and the `invitations` surface, which exists only for an instance configured
|
|
11
|
+
* with `invitations`.
|
|
12
|
+
*/
|
|
13
|
+
export interface InvitationAuth extends InvitationsApi {
|
|
14
|
+
readonly cookie: {
|
|
15
|
+
serialize(token: string, session: Session): string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../../src/invitations/types/surface.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/D,4CAA4C;AAC5C,MAAM,MAAM,OAAO,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,cAAc;IACrD,QAAQ,CAAC,MAAM,EAAE;QAChB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;KACnD,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** `janusMaskError({ mapCode })`: an application's own code on the answer. */
|
|
2
|
+
import { GraphQLError } from 'graphql';
|
|
3
|
+
/** What `mapCode` answers: the code of your own, and optionally its message and HTTP status. */
|
|
4
|
+
export interface MappedCode {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
readonly message?: string;
|
|
7
|
+
readonly status?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function remapped(error: GraphQLError, mapCode: (code: string, error: GraphQLError) => MappedCode | undefined): GraphQLError;
|
|
10
|
+
//# sourceMappingURL=map-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-code.d.ts","sourceRoot":"","sources":["../src/map-code.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,gGAAgG;AAChG,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,QAAQ,CACvB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,KAAK,UAAU,GAAG,SAAS,GACpE,YAAY,CAsBd"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The default `fallback` of `janusMaskError()`: what graphql-yoga 5's
|
|
3
|
+
* `maskError` does, without importing it (Yoga is not a peer of this package).
|
|
4
|
+
* It keeps `extensions.unexpected: true`, which Yoga reads to answer a failure
|
|
5
|
+
* with no `data` as HTTP 500.
|
|
6
|
+
*
|
|
7
|
+
* One difference, on purpose: Yoga's `coordinate` is left out, since
|
|
8
|
+
* `getSchemaCoordinate` is not in every `@graphql-tools/utils` the peer range
|
|
9
|
+
* allows. It never reaches the response.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Yoga 5's `maskError`: a `GraphQLError` of your own is kept, anything else
|
|
13
|
+
* becomes `message` with `{ code: 'INTERNAL_SERVER_ERROR', unexpected: true }`,
|
|
14
|
+
* the position and path of the original, its `extensions.http`, and — only in
|
|
15
|
+
* development — the serialized `originalError`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function maskedError(error: unknown, message: string, isDev?: boolean): Error;
|
|
18
|
+
//# sourceMappingURL=mask-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mask-error.d.ts","sourceRoot":"","sources":["../src/mask-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA6BH;;;;;GAKG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,OAAyB,GAC9B,KAAK,CA0BP"}
|
package/dist/memo.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-request memo of permission checks: the same question asked twice
|
|
3
|
+
* in one request — by two fields, by a directive and a resolver's `can()`,
|
|
4
|
+
* or by two fields at once — is one call to `access.can`.
|
|
5
|
+
*/
|
|
6
|
+
import type { Check } from './context';
|
|
7
|
+
/**
|
|
8
|
+
* `access.can` for one request, remembered: a question asked again answers
|
|
9
|
+
* the first answer's promise, so two asked at once share one call. A
|
|
10
|
+
* failure is not remembered — an outage is no answer, and the next question
|
|
11
|
+
* asks again.
|
|
12
|
+
*/
|
|
13
|
+
export declare function memoized(access: {
|
|
14
|
+
readonly can: unknown;
|
|
15
|
+
}): Check;
|
|
16
|
+
//# sourceMappingURL=memo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memo.d.ts","sourceRoot":"","sources":["../src/memo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAkCvC;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;CAAE,GAAG,KAAK,CAejE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wiring checks `useJanus()` and `janusConnection()` share: what each
|
|
3
|
+
* refuses at start-up, with a `TypeError` naming the call that was written.
|
|
4
|
+
*/
|
|
5
|
+
/** What both calls take and check before anything runs. */
|
|
6
|
+
export interface Wiring {
|
|
7
|
+
readonly auth: unknown;
|
|
8
|
+
readonly access?: unknown;
|
|
9
|
+
readonly clock?: unknown;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Refuses an `auth` that is neither what `janus()` answered nor a function, an `access` that
|
|
13
|
+
* is not what `permissions()` answered, and a `clock` that is not a
|
|
14
|
+
* `Clock` — each a `TypeError` naming `caller`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function checkWiring(caller: string, { auth, access, clock }: Wiring): void;
|
|
17
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,2DAA2D;AAC3D,MAAM,WAAW,MAAM;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,MAAM,QA0B1E"}
|