sinfactura-types 1.10.75 → 1.10.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.d.ts +45 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/invitation.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/invitation.d.ts +61 -0
- package/dist/invitation.js +1 -0
- package/dist/store.d.ts +1 -0
- package/package.json +1 -1
package/dist/auth.d.ts
CHANGED
|
@@ -53,5 +53,50 @@ declare global {
|
|
|
53
53
|
waitlistId: string;
|
|
54
54
|
submittedAt: number;
|
|
55
55
|
}
|
|
56
|
+
/** `POST /auth?mode=verifyInvite` request body — the token from the invite email. */
|
|
57
|
+
interface VerifyInviteInput {
|
|
58
|
+
token: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Why an invite token will not accept. Deliberately COARSE: `invalid`
|
|
62
|
+
* covers "no such token" and "signature mismatch" alike, so a caller
|
|
63
|
+
* cannot probe which store an unknown token belongs to.
|
|
64
|
+
*/
|
|
65
|
+
type InviteInvalidReason = 'invalid' | 'expired' | 'revoked' | 'accepted';
|
|
66
|
+
/** Unauthenticated pre-check — returns only what the accept form needs to render. */
|
|
67
|
+
interface VerifyInviteResponse {
|
|
68
|
+
valid: true;
|
|
69
|
+
email: string;
|
|
70
|
+
role: string;
|
|
71
|
+
storeName: string;
|
|
72
|
+
invitedByName: string;
|
|
73
|
+
expiresAt: number;
|
|
74
|
+
message?: string;
|
|
75
|
+
}
|
|
76
|
+
/** ⚠️ Carries NO tenant detail — an invalid token must not disclose which store it named. */
|
|
77
|
+
interface VerifyInviteInvalidResponse {
|
|
78
|
+
valid: false;
|
|
79
|
+
reason: InviteInvalidReason;
|
|
80
|
+
}
|
|
81
|
+
/** `POST /auth?mode=acceptInvite` request body. */
|
|
82
|
+
interface AcceptInviteInput {
|
|
83
|
+
token: string;
|
|
84
|
+
fullName: string;
|
|
85
|
+
password: string;
|
|
86
|
+
phone?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* `INVITE_INVALID` collapses the four `InviteInvalidReason` cases on the
|
|
90
|
+
* accept path on purpose — by then the client has already seen the precise
|
|
91
|
+
* reason from `verifyInvite`, and a second, more specific answer here would
|
|
92
|
+
* turn accept into the probe `verifyInvite` was shaped to avoid.
|
|
93
|
+
*/
|
|
94
|
+
type AcceptInviteErrorCode = 'INVITE_INVALID' | 'EMAIL_ALREADY_REGISTERED' | 'SEAT_LIMIT_REACHED' | 'WEAK_PASSWORD';
|
|
95
|
+
/** Success shape — acceptance logs the new user straight in. */
|
|
96
|
+
interface AcceptInviteResponse {
|
|
97
|
+
userId: string;
|
|
98
|
+
storeId: string;
|
|
99
|
+
accessToken: string;
|
|
100
|
+
}
|
|
56
101
|
}
|
|
57
102
|
export {};
|
package/dist/cjs/index.js
CHANGED
|
@@ -34,6 +34,7 @@ __exportStar(require("./customer.js"), exports);
|
|
|
34
34
|
__exportStar(require("./demo.js"), exports);
|
|
35
35
|
__exportStar(require("./impersonation.js"), exports);
|
|
36
36
|
__exportStar(require("./imports.js"), exports);
|
|
37
|
+
__exportStar(require("./invitation.js"), exports);
|
|
37
38
|
__exportStar(require("./invoice.js"), exports);
|
|
38
39
|
__exportStar(require("./log.js"), exports);
|
|
39
40
|
__exportStar(require("./maintenance.js"), exports);
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./customer.js";
|
|
|
13
13
|
export * from "./demo.js";
|
|
14
14
|
export * from "./impersonation.js";
|
|
15
15
|
export * from "./imports.js";
|
|
16
|
+
export * from "./invitation.js";
|
|
16
17
|
export * from "./invoice.js";
|
|
17
18
|
export * from "./log.js";
|
|
18
19
|
export * from "./maintenance.js";
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export * from "./customer.js";
|
|
|
18
18
|
export * from "./demo.js";
|
|
19
19
|
export * from "./impersonation.js";
|
|
20
20
|
export * from "./imports.js";
|
|
21
|
+
export * from "./invitation.js";
|
|
21
22
|
export * from "./invoice.js";
|
|
22
23
|
export * from "./log.js";
|
|
23
24
|
export * from "./maintenance.js";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
/**
|
|
3
|
+
* A pending invitation for a new user to join an existing store's team.
|
|
4
|
+
*
|
|
5
|
+
* Stored under `PK: INVITATION#${storeId}`. The row is the ONLY record of
|
|
6
|
+
* the invite; there is no shadow `User` row until acceptance, so an
|
|
7
|
+
* unaccepted invite consumes no seat against `maxUsers`.
|
|
8
|
+
*/
|
|
9
|
+
interface Invitation {
|
|
10
|
+
storeId: string;
|
|
11
|
+
invitationId: string;
|
|
12
|
+
/** Invitee's address. Lowercased on write — the uniqueness check is case-insensitive. */
|
|
13
|
+
email: string;
|
|
14
|
+
/** Role the invitee receives on acceptance. Never escalates past the inviter's own. */
|
|
15
|
+
role: string;
|
|
16
|
+
/** `userId` of the team member who issued the invite. */
|
|
17
|
+
invitedBy: string;
|
|
18
|
+
/**
|
|
19
|
+
* ⚠️ `'expired'` is NEVER persisted — it is derived at read time from
|
|
20
|
+
* `expiresAt` against now. A stored row only ever carries `'pending'`,
|
|
21
|
+
* `'accepted'` or `'revoked'`, so a reader that switches on the stored
|
|
22
|
+
* value must treat an elapsed `'pending'` as expired itself.
|
|
23
|
+
*/
|
|
24
|
+
status: InvitationStatus;
|
|
25
|
+
createdAt: number;
|
|
26
|
+
/** Unix ms after which the invite no longer accepts. Read-time expiry authority. */
|
|
27
|
+
expiresAt: number;
|
|
28
|
+
/**
|
|
29
|
+
* DynamoDB TTL — Unix **SECONDS**, unlike every other timestamp on this
|
|
30
|
+
* row. Set beyond `expiresAt` so an expired-but-unreaped invite still
|
|
31
|
+
* answers `verify` with a truthful reason rather than 404-ing as absent.
|
|
32
|
+
*/
|
|
33
|
+
ttl: number;
|
|
34
|
+
/** Unix ms of acceptance. Absent while `status` is `'pending'` or `'revoked'`. */
|
|
35
|
+
acceptedAt?: number;
|
|
36
|
+
/** `userId` created by acceptance. Set together with `acceptedAt`. */
|
|
37
|
+
acceptedUserId?: string;
|
|
38
|
+
/** Optional free-text note from the inviter, surfaced in the invite email. */
|
|
39
|
+
message?: string;
|
|
40
|
+
/**
|
|
41
|
+
* SHA-256 of the invite token. The plaintext token is emailed once and
|
|
42
|
+
* never stored. Named to match `response()`'s auto-strip list, so it
|
|
43
|
+
* cannot reach the wire through an unprojected read.
|
|
44
|
+
*/
|
|
45
|
+
hashedToken?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Lowercase WRITE-SIDE index for backend filtering. Internal — not part
|
|
48
|
+
* of the read contract; never consume it.
|
|
49
|
+
*/
|
|
50
|
+
search?: string;
|
|
51
|
+
}
|
|
52
|
+
/** `'expired'` is derived at read time and never persisted — see `Invitation.status`. */
|
|
53
|
+
type InvitationStatus = 'pending' | 'accepted' | 'revoked' | 'expired';
|
|
54
|
+
/** `POST /invitations` request body. */
|
|
55
|
+
interface CreateInvitationInput {
|
|
56
|
+
email: string;
|
|
57
|
+
role: string;
|
|
58
|
+
message?: string;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/store.d.ts
CHANGED