@tearleads/client-sdk 0.1.93 → 0.1.95
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/client/root/index.d.ts +12 -2
- package/client/root/index.js +10 -1
- package/client/root/index.js.map +1 -1
- package/client/session/index.js +7 -4
- package/client/session/index.js.map +1 -1
- package/client/session/sessionLoginRefusal.js +17 -0
- package/client/session/sessionLoginRefusal.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/internal/api-client/ApiClient.d.ts +6 -1
- package/internal/api-client/ApiClient.js +17 -3
- package/internal/api-client/ApiClient.js.map +1 -1
- package/internal/api-client/accountSuspension.d.ts +12 -0
- package/internal/api-client/accountSuspension.js +23 -0
- package/internal/api-client/accountSuspension.js.map +1 -0
- package/internal/api-client/index.d.ts +1 -0
- package/internal/api-client/index.js +1 -0
- package/internal/api-client/index.js.map +1 -1
- package/internal/validators/operation/auth.d.ts +104 -2
- package/internal/validators/operation/auth.js +2 -1
- package/internal/validators/operation/auth.js.map +1 -1
- package/internal/validators/operation/index.d.ts +2 -0
- package/internal/validators/operation/index.js +2 -0
- package/internal/validators/operation/index.js.map +1 -1
- package/internal/validators/operation/registry.d.ts +5 -0
- package/internal/validators/operation/registry.js +5 -0
- package/internal/validators/operation/registry.js.map +1 -1
- package/internal/validators/operation/root.d.ts +8 -0
- package/internal/validators/operation/rootAudit.d.ts +4 -4
- package/internal/validators/operation/rootOpsHealth.d.ts +287 -0
- package/internal/validators/operation/rootOpsHealth.js +18 -0
- package/internal/validators/operation/rootOpsHealth.js.map +1 -0
- package/internal/validators/operation/rootOrganizations.d.ts +4 -0
- package/internal/validators/operation/rootSuspension.d.ts +352 -0
- package/internal/validators/operation/rootSuspension.js +45 -0
- package/internal/validators/operation/rootSuspension.js.map +1 -0
- package/internal/validators/response/auth/index.d.ts +1 -1
- package/internal/validators/response/auth/index.js +1 -1
- package/internal/validators/response/auth/index.js.map +1 -1
- package/internal/validators/response/auth/verify.d.ts +15 -0
- package/internal/validators/response/auth/verify.js +9 -0
- package/internal/validators/response/auth/verify.js.map +1 -1
- package/internal/validators/response/index.d.ts +3 -2
- package/internal/validators/response/index.js +3 -2
- package/internal/validators/response/index.js.map +1 -1
- package/internal/validators/response/root.d.ts +60 -0
- package/internal/validators/response/root.js +9 -0
- package/internal/validators/response/root.js.map +1 -1
- package/internal/validators/response/rootAudit.d.ts +11 -10
- package/internal/validators/response/rootAudit.js +16 -1
- package/internal/validators/response/rootAudit.js.map +1 -1
- package/internal/validators/response/rootOpsHealth.d.ts +224 -0
- package/internal/validators/response/rootOpsHealth.js +79 -0
- package/internal/validators/response/rootOpsHealth.js.map +1 -0
- package/internal/validators/response/rootOrganizations.d.ts +8 -0
- package/package.json +1 -1
- package/workflows/root/audit.d.ts +11 -4
- package/workflows/root/audit.js.map +1 -1
- package/workflows/root/index.d.ts +2 -0
- package/workflows/root/index.js +2 -0
- package/workflows/root/index.js.map +1 -1
- package/workflows/root/opsHealth.d.ts +9 -0
- package/workflows/root/opsHealth.js +5 -0
- package/workflows/root/opsHealth.js.map +1 -0
- package/workflows/root/suspension.d.ts +13 -0
- package/workflows/root/suspension.js +17 -0
- package/workflows/root/suspension.js.map +1 -0
|
@@ -3,12 +3,13 @@ import { z } from "zod";
|
|
|
3
3
|
* Every action the root audit trail records: one per `/root` operation, plus
|
|
4
4
|
* the API CLI's root grant and revoke.
|
|
5
5
|
*/
|
|
6
|
-
export declare const ROOT_AUDIT_ACTIONS: readonly ["root.access.grant", "root.access.revoke", "root.auditEvents.list", "root.identities.get", "root.identities.list", "root.identities.organizations.list", "root.organizations.dataUsage.get", "root.organizations.get", "root.organizations.identities.list", "root.organizations.list", "root.reports.dataUsage.list"];
|
|
7
|
-
|
|
6
|
+
export declare const ROOT_AUDIT_ACTIONS: readonly ["root.access.grant", "root.access.revoke", "root.auditEvents.list", "root.identities.get", "root.identities.list", "root.identities.organizations.list", "root.identities.suspension.delete", "root.identities.suspension.put", "root.organizations.dataUsage.get", "root.organizations.get", "root.organizations.identities.list", "root.organizations.list", "root.reports.dataUsage.list", "root.reports.opsHealth.get"];
|
|
7
|
+
/** The server's own vocabulary: exactly the actions it records. */
|
|
8
|
+
export declare const RootAuditActionSchema: z.ZodLiteral<"root.access.grant" | "root.access.revoke" | "root.auditEvents.list" | "root.identities.get" | "root.identities.list" | "root.identities.organizations.list" | "root.identities.suspension.delete" | "root.identities.suspension.put" | "root.organizations.dataUsage.get" | "root.organizations.get" | "root.organizations.identities.list" | "root.organizations.list" | "root.reports.dataUsage.list" | "root.reports.opsHealth.get">;
|
|
8
9
|
export type RootAuditAction = z.infer<typeof RootAuditActionSchema>;
|
|
9
10
|
/** One recorded operator action, from `GET /root/audit-events`. */
|
|
10
11
|
export declare const RootAuditEventResponseSchema: z.ZodType<{
|
|
11
|
-
action:
|
|
12
|
+
action: string;
|
|
12
13
|
actorSigningKeyFingerprint: string | null;
|
|
13
14
|
actorUserId: string | null;
|
|
14
15
|
filter: string | null;
|
|
@@ -18,7 +19,7 @@ export declare const RootAuditEventResponseSchema: z.ZodType<{
|
|
|
18
19
|
targetOrganizationId: string | null;
|
|
19
20
|
targetUserId: string | null;
|
|
20
21
|
}, {
|
|
21
|
-
action:
|
|
22
|
+
action: string;
|
|
22
23
|
actorSigningKeyFingerprint: string | null;
|
|
23
24
|
actorUserId: string | null;
|
|
24
25
|
filter: string | null;
|
|
@@ -28,7 +29,7 @@ export declare const RootAuditEventResponseSchema: z.ZodType<{
|
|
|
28
29
|
targetOrganizationId: string | null;
|
|
29
30
|
targetUserId: string | null;
|
|
30
31
|
}, z.core.$ZodTypeInternals<{
|
|
31
|
-
action:
|
|
32
|
+
action: string;
|
|
32
33
|
actorSigningKeyFingerprint: string | null;
|
|
33
34
|
actorUserId: string | null;
|
|
34
35
|
filter: string | null;
|
|
@@ -38,7 +39,7 @@ export declare const RootAuditEventResponseSchema: z.ZodType<{
|
|
|
38
39
|
targetOrganizationId: string | null;
|
|
39
40
|
targetUserId: string | null;
|
|
40
41
|
}, {
|
|
41
|
-
action:
|
|
42
|
+
action: string;
|
|
42
43
|
actorSigningKeyFingerprint: string | null;
|
|
43
44
|
actorUserId: string | null;
|
|
44
45
|
filter: string | null;
|
|
@@ -51,7 +52,7 @@ export declare const RootAuditEventResponseSchema: z.ZodType<{
|
|
|
51
52
|
export type RootAuditEventResponse = z.infer<typeof RootAuditEventResponseSchema>;
|
|
52
53
|
export declare const RootAuditEventsResponseSchema: z.ZodType<{
|
|
53
54
|
events: {
|
|
54
|
-
action:
|
|
55
|
+
action: string;
|
|
55
56
|
actorSigningKeyFingerprint: string | null;
|
|
56
57
|
actorUserId: string | null;
|
|
57
58
|
filter: string | null;
|
|
@@ -64,7 +65,7 @@ export declare const RootAuditEventsResponseSchema: z.ZodType<{
|
|
|
64
65
|
nextCursor: string | null;
|
|
65
66
|
}, {
|
|
66
67
|
events: {
|
|
67
|
-
action:
|
|
68
|
+
action: string;
|
|
68
69
|
actorSigningKeyFingerprint: string | null;
|
|
69
70
|
actorUserId: string | null;
|
|
70
71
|
filter: string | null;
|
|
@@ -77,7 +78,7 @@ export declare const RootAuditEventsResponseSchema: z.ZodType<{
|
|
|
77
78
|
nextCursor: string | null;
|
|
78
79
|
}, z.core.$ZodTypeInternals<{
|
|
79
80
|
events: {
|
|
80
|
-
action:
|
|
81
|
+
action: string;
|
|
81
82
|
actorSigningKeyFingerprint: string | null;
|
|
82
83
|
actorUserId: string | null;
|
|
83
84
|
filter: string | null;
|
|
@@ -90,7 +91,7 @@ export declare const RootAuditEventsResponseSchema: z.ZodType<{
|
|
|
90
91
|
nextCursor: string | null;
|
|
91
92
|
}, {
|
|
92
93
|
events: {
|
|
93
|
-
action:
|
|
94
|
+
action: string;
|
|
94
95
|
actorSigningKeyFingerprint: string | null;
|
|
95
96
|
actorUserId: string | null;
|
|
96
97
|
filter: string | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { registerJsonSchemaFragment } from "../jsonSchema.js";
|
|
2
3
|
import { arraySchema, loosePlainObject, nonEmptyStringSchema, sha256HexStringSchema, } from "../schema.js";
|
|
3
4
|
/**
|
|
4
5
|
* Every action the root audit trail records: one per `/root` operation, plus
|
|
@@ -11,16 +12,30 @@ export const ROOT_AUDIT_ACTIONS = [
|
|
|
11
12
|
"root.identities.get",
|
|
12
13
|
"root.identities.list",
|
|
13
14
|
"root.identities.organizations.list",
|
|
15
|
+
"root.identities.suspension.delete",
|
|
16
|
+
"root.identities.suspension.put",
|
|
14
17
|
"root.organizations.dataUsage.get",
|
|
15
18
|
"root.organizations.get",
|
|
16
19
|
"root.organizations.identities.list",
|
|
17
20
|
"root.organizations.list",
|
|
18
21
|
"root.reports.dataUsage.list",
|
|
22
|
+
"root.reports.opsHealth.get",
|
|
19
23
|
];
|
|
24
|
+
/** The server's own vocabulary: exactly the actions it records. */
|
|
20
25
|
export const RootAuditActionSchema = z.literal(ROOT_AUDIT_ACTIONS);
|
|
26
|
+
/**
|
|
27
|
+
* An action as the audit listing reports it. Every new root operation adds an
|
|
28
|
+
* action, so clients accept any operation id rather than a closed list that a
|
|
29
|
+
* newer server would outgrow; the known ones are listed as extensible.
|
|
30
|
+
*/
|
|
31
|
+
const RootAuditEventActionSchema = registerJsonSchemaFragment(z.string().min(1), {
|
|
32
|
+
type: "string",
|
|
33
|
+
minLength: 1,
|
|
34
|
+
"x-extensible-enum": [...ROOT_AUDIT_ACTIONS],
|
|
35
|
+
});
|
|
21
36
|
/** One recorded operator action, from `GET /root/audit-events`. */
|
|
22
37
|
export const RootAuditEventResponseSchema = loosePlainObject({
|
|
23
|
-
action:
|
|
38
|
+
action: RootAuditEventActionSchema,
|
|
24
39
|
/** The acting root identity's signing key; null when the API CLI acted. */
|
|
25
40
|
actorSigningKeyFingerprint: sha256HexStringSchema.nullable(),
|
|
26
41
|
actorUserId: nonEmptyStringSchema.nullable(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootAudit.js","sourceRoot":"","sources":["rootAudit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAEnB;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,mBAAmB;IACnB,oBAAoB;IACpB,uBAAuB;IACvB,qBAAqB;IACrB,sBAAsB;IACtB,oCAAoC;IACpC,kCAAkC;IAClC,wBAAwB;IACxB,oCAAoC;IACpC,yBAAyB;IACzB,6BAA6B;
|
|
1
|
+
{"version":3,"file":"rootAudit.js","sourceRoot":"","sources":["rootAudit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAEnB;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,mBAAmB;IACnB,oBAAoB;IACpB,uBAAuB;IACvB,qBAAqB;IACrB,sBAAsB;IACtB,oCAAoC;IACpC,mCAAmC;IACnC,gCAAgC;IAChC,kCAAkC;IAClC,wBAAwB;IACxB,oCAAoC;IACpC,yBAAyB;IACzB,6BAA6B;IAC7B,4BAA4B;CACpB,CAAC;AAEX,mEAAmE;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAInE;;;;GAIG;AACH,MAAM,0BAA0B,GAAG,0BAA0B,CAC3D,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EACjB;IACE,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,CAAC;IACZ,mBAAmB,EAAE,CAAC,GAAG,kBAAkB,CAAC;CAC7C,CACF,CAAC;AAEF,mEAAmE;AACnE,MAAM,CAAC,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;IAC3D,MAAM,EAAE,0BAA0B;IAClC,2EAA2E;IAC3E,0BAA0B,EAAE,qBAAqB,CAAC,QAAQ,EAAE;IAC5D,WAAW,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAC5C,wEAAwE;IACxE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,EAAE,EAAE,oBAAoB;IACxB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACtC,oBAAoB,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IACrD,YAAY,EAAE,oBAAoB,CAAC,QAAQ,EAAE;CAC9C,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,6BAA6B,GAAG,gBAAgB,CAAC;IAC5D,MAAM,EAAE,WAAW,CAAC,4BAA4B,CAAC;IACjD,2EAA2E;IAC3E,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { registerJsonSchemaFragment } from \"../jsonSchema\";\nimport {\n arraySchema,\n loosePlainObject,\n nonEmptyStringSchema,\n sha256HexStringSchema,\n} from \"../schema\";\n\n/**\n * Every action the root audit trail records: one per `/root` operation, plus\n * the API CLI's root grant and revoke.\n */\nexport const ROOT_AUDIT_ACTIONS = [\n \"root.access.grant\",\n \"root.access.revoke\",\n \"root.auditEvents.list\",\n \"root.identities.get\",\n \"root.identities.list\",\n \"root.identities.organizations.list\",\n \"root.identities.suspension.delete\",\n \"root.identities.suspension.put\",\n \"root.organizations.dataUsage.get\",\n \"root.organizations.get\",\n \"root.organizations.identities.list\",\n \"root.organizations.list\",\n \"root.reports.dataUsage.list\",\n \"root.reports.opsHealth.get\",\n] as const;\n\n/** The server's own vocabulary: exactly the actions it records. */\nexport const RootAuditActionSchema = z.literal(ROOT_AUDIT_ACTIONS);\n\nexport type RootAuditAction = z.infer<typeof RootAuditActionSchema>;\n\n/**\n * An action as the audit listing reports it. Every new root operation adds an\n * action, so clients accept any operation id rather than a closed list that a\n * newer server would outgrow; the known ones are listed as extensible.\n */\nconst RootAuditEventActionSchema = registerJsonSchemaFragment(\n z.string().min(1),\n {\n type: \"string\",\n minLength: 1,\n \"x-extensible-enum\": [...ROOT_AUDIT_ACTIONS],\n },\n);\n\n/** One recorded operator action, from `GET /root/audit-events`. */\nexport const RootAuditEventResponseSchema = loosePlainObject({\n action: RootAuditEventActionSchema,\n /** The acting root identity's signing key; null when the API CLI acted. */\n actorSigningKeyFingerprint: sha256HexStringSchema.nullable(),\n actorUserId: nonEmptyStringSchema.nullable(),\n /** Listing filters as a sorted query string; null when none applied. */\n filter: z.string().nullable(),\n id: nonEmptyStringSchema,\n occurredAt: z.string(),\n sourceIpAddress: z.string().nullable(),\n targetOrganizationId: nonEmptyStringSchema.nullable(),\n targetUserId: nonEmptyStringSchema.nullable(),\n});\n\nexport type RootAuditEventResponse = z.infer<\n typeof RootAuditEventResponseSchema\n>;\n\nexport const RootAuditEventsResponseSchema = loosePlainObject({\n events: arraySchema(RootAuditEventResponseSchema),\n /** Opaque cursor for the next page; null when the listing is exhausted. */\n nextCursor: z.string().nullable(),\n});\n\nexport type RootAuditEventsResponse = z.infer<\n typeof RootAuditEventsResponseSchema\n>;\n"]}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Rows each ops-health section returns at most; `truncated` marks more. */
|
|
3
|
+
export declare const ROOT_OPS_HEALTH_SECTION_LIMIT = 50;
|
|
4
|
+
/**
|
|
5
|
+
* Billing maintenance runs every minute, so work still due this long after it
|
|
6
|
+
* fell due means the job is not keeping up rather than about to reach it.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ROOT_OPS_HEALTH_OVERDUE_MINUTES = 15;
|
|
9
|
+
/** How far ahead the report looks for trials ending and purges coming due. */
|
|
10
|
+
export declare const ROOT_OPS_HEALTH_UPCOMING_DAYS = 7;
|
|
11
|
+
export declare const ROOT_SEAT_SYNC_CONDITIONS: readonly ["failing", "stalled", "leaseExpired"];
|
|
12
|
+
/**
|
|
13
|
+
* Why a Stripe seat-sync row is listed: its last attempt failed, a pending
|
|
14
|
+
* change has waited well past its retry time, or a claim's lease expired
|
|
15
|
+
* without the claim completing or failing.
|
|
16
|
+
*/
|
|
17
|
+
export declare const RootSeatSyncConditionSchema: z.ZodLiteral<"failing" | "stalled" | "leaseExpired">;
|
|
18
|
+
/** Cross-organization billing maintenance health, from `GET /root/reports/ops-health`. */
|
|
19
|
+
export declare const RootOpsHealthReportResponseSchema: z.ZodType<{
|
|
20
|
+
generatedAt: string;
|
|
21
|
+
seatSync: {
|
|
22
|
+
rows: {
|
|
23
|
+
organizationId: string;
|
|
24
|
+
conditions: ("failing" | "stalled" | "leaseExpired")[];
|
|
25
|
+
attemptCount: number;
|
|
26
|
+
appliedRevision: number;
|
|
27
|
+
desiredRevision: number;
|
|
28
|
+
lastError: string | null;
|
|
29
|
+
lastSyncedAt: string | null;
|
|
30
|
+
leaseExpiresAt: string | null;
|
|
31
|
+
nextAttemptAt: string | null;
|
|
32
|
+
}[];
|
|
33
|
+
truncated: boolean;
|
|
34
|
+
};
|
|
35
|
+
trialExpiry: {
|
|
36
|
+
rows: {
|
|
37
|
+
organizationId: string;
|
|
38
|
+
trialEndsAt: string;
|
|
39
|
+
attemptCount: number;
|
|
40
|
+
lastError: string | null;
|
|
41
|
+
nextAttemptAt: string | null;
|
|
42
|
+
requiresAttention: boolean;
|
|
43
|
+
}[];
|
|
44
|
+
truncated: boolean;
|
|
45
|
+
};
|
|
46
|
+
purges: {
|
|
47
|
+
rows: {
|
|
48
|
+
organizationId: string;
|
|
49
|
+
status: "disabled" | "deleting";
|
|
50
|
+
purgeAfter: string | null;
|
|
51
|
+
purgeStartedAt: string | null;
|
|
52
|
+
}[];
|
|
53
|
+
truncated: boolean;
|
|
54
|
+
};
|
|
55
|
+
trialsEnding: {
|
|
56
|
+
rows: {
|
|
57
|
+
organizationId: string;
|
|
58
|
+
trialEndsAt: string;
|
|
59
|
+
}[];
|
|
60
|
+
truncated: boolean;
|
|
61
|
+
};
|
|
62
|
+
purgesDue: {
|
|
63
|
+
rows: {
|
|
64
|
+
organizationId: string;
|
|
65
|
+
disabledAt: string | null;
|
|
66
|
+
purgeAfter: string;
|
|
67
|
+
}[];
|
|
68
|
+
truncated: boolean;
|
|
69
|
+
};
|
|
70
|
+
}, {
|
|
71
|
+
generatedAt: string;
|
|
72
|
+
seatSync: {
|
|
73
|
+
rows: {
|
|
74
|
+
organizationId: string;
|
|
75
|
+
conditions: ("failing" | "stalled" | "leaseExpired")[];
|
|
76
|
+
attemptCount: number;
|
|
77
|
+
appliedRevision: number;
|
|
78
|
+
desiredRevision: number;
|
|
79
|
+
lastError: string | null;
|
|
80
|
+
lastSyncedAt: string | null;
|
|
81
|
+
leaseExpiresAt: string | null;
|
|
82
|
+
nextAttemptAt: string | null;
|
|
83
|
+
}[];
|
|
84
|
+
truncated: boolean;
|
|
85
|
+
};
|
|
86
|
+
trialExpiry: {
|
|
87
|
+
rows: {
|
|
88
|
+
organizationId: string;
|
|
89
|
+
trialEndsAt: string;
|
|
90
|
+
attemptCount: number;
|
|
91
|
+
lastError: string | null;
|
|
92
|
+
nextAttemptAt: string | null;
|
|
93
|
+
requiresAttention: boolean;
|
|
94
|
+
}[];
|
|
95
|
+
truncated: boolean;
|
|
96
|
+
};
|
|
97
|
+
purges: {
|
|
98
|
+
rows: {
|
|
99
|
+
organizationId: string;
|
|
100
|
+
status: "disabled" | "deleting";
|
|
101
|
+
purgeAfter: string | null;
|
|
102
|
+
purgeStartedAt: string | null;
|
|
103
|
+
}[];
|
|
104
|
+
truncated: boolean;
|
|
105
|
+
};
|
|
106
|
+
trialsEnding: {
|
|
107
|
+
rows: {
|
|
108
|
+
organizationId: string;
|
|
109
|
+
trialEndsAt: string;
|
|
110
|
+
}[];
|
|
111
|
+
truncated: boolean;
|
|
112
|
+
};
|
|
113
|
+
purgesDue: {
|
|
114
|
+
rows: {
|
|
115
|
+
organizationId: string;
|
|
116
|
+
disabledAt: string | null;
|
|
117
|
+
purgeAfter: string;
|
|
118
|
+
}[];
|
|
119
|
+
truncated: boolean;
|
|
120
|
+
};
|
|
121
|
+
}, z.core.$ZodTypeInternals<{
|
|
122
|
+
generatedAt: string;
|
|
123
|
+
seatSync: {
|
|
124
|
+
rows: {
|
|
125
|
+
organizationId: string;
|
|
126
|
+
conditions: ("failing" | "stalled" | "leaseExpired")[];
|
|
127
|
+
attemptCount: number;
|
|
128
|
+
appliedRevision: number;
|
|
129
|
+
desiredRevision: number;
|
|
130
|
+
lastError: string | null;
|
|
131
|
+
lastSyncedAt: string | null;
|
|
132
|
+
leaseExpiresAt: string | null;
|
|
133
|
+
nextAttemptAt: string | null;
|
|
134
|
+
}[];
|
|
135
|
+
truncated: boolean;
|
|
136
|
+
};
|
|
137
|
+
trialExpiry: {
|
|
138
|
+
rows: {
|
|
139
|
+
organizationId: string;
|
|
140
|
+
trialEndsAt: string;
|
|
141
|
+
attemptCount: number;
|
|
142
|
+
lastError: string | null;
|
|
143
|
+
nextAttemptAt: string | null;
|
|
144
|
+
requiresAttention: boolean;
|
|
145
|
+
}[];
|
|
146
|
+
truncated: boolean;
|
|
147
|
+
};
|
|
148
|
+
purges: {
|
|
149
|
+
rows: {
|
|
150
|
+
organizationId: string;
|
|
151
|
+
status: "disabled" | "deleting";
|
|
152
|
+
purgeAfter: string | null;
|
|
153
|
+
purgeStartedAt: string | null;
|
|
154
|
+
}[];
|
|
155
|
+
truncated: boolean;
|
|
156
|
+
};
|
|
157
|
+
trialsEnding: {
|
|
158
|
+
rows: {
|
|
159
|
+
organizationId: string;
|
|
160
|
+
trialEndsAt: string;
|
|
161
|
+
}[];
|
|
162
|
+
truncated: boolean;
|
|
163
|
+
};
|
|
164
|
+
purgesDue: {
|
|
165
|
+
rows: {
|
|
166
|
+
organizationId: string;
|
|
167
|
+
disabledAt: string | null;
|
|
168
|
+
purgeAfter: string;
|
|
169
|
+
}[];
|
|
170
|
+
truncated: boolean;
|
|
171
|
+
};
|
|
172
|
+
}, {
|
|
173
|
+
generatedAt: string;
|
|
174
|
+
seatSync: {
|
|
175
|
+
rows: {
|
|
176
|
+
organizationId: string;
|
|
177
|
+
conditions: ("failing" | "stalled" | "leaseExpired")[];
|
|
178
|
+
attemptCount: number;
|
|
179
|
+
appliedRevision: number;
|
|
180
|
+
desiredRevision: number;
|
|
181
|
+
lastError: string | null;
|
|
182
|
+
lastSyncedAt: string | null;
|
|
183
|
+
leaseExpiresAt: string | null;
|
|
184
|
+
nextAttemptAt: string | null;
|
|
185
|
+
}[];
|
|
186
|
+
truncated: boolean;
|
|
187
|
+
};
|
|
188
|
+
trialExpiry: {
|
|
189
|
+
rows: {
|
|
190
|
+
organizationId: string;
|
|
191
|
+
trialEndsAt: string;
|
|
192
|
+
attemptCount: number;
|
|
193
|
+
lastError: string | null;
|
|
194
|
+
nextAttemptAt: string | null;
|
|
195
|
+
requiresAttention: boolean;
|
|
196
|
+
}[];
|
|
197
|
+
truncated: boolean;
|
|
198
|
+
};
|
|
199
|
+
purges: {
|
|
200
|
+
rows: {
|
|
201
|
+
organizationId: string;
|
|
202
|
+
status: "disabled" | "deleting";
|
|
203
|
+
purgeAfter: string | null;
|
|
204
|
+
purgeStartedAt: string | null;
|
|
205
|
+
}[];
|
|
206
|
+
truncated: boolean;
|
|
207
|
+
};
|
|
208
|
+
trialsEnding: {
|
|
209
|
+
rows: {
|
|
210
|
+
organizationId: string;
|
|
211
|
+
trialEndsAt: string;
|
|
212
|
+
}[];
|
|
213
|
+
truncated: boolean;
|
|
214
|
+
};
|
|
215
|
+
purgesDue: {
|
|
216
|
+
rows: {
|
|
217
|
+
organizationId: string;
|
|
218
|
+
disabledAt: string | null;
|
|
219
|
+
purgeAfter: string;
|
|
220
|
+
}[];
|
|
221
|
+
truncated: boolean;
|
|
222
|
+
};
|
|
223
|
+
}>>;
|
|
224
|
+
export type RootOpsHealthReportResponse = z.infer<typeof RootOpsHealthReportResponseSchema>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { arraySchema, loosePlainObject, nonEmptyStringSchema, nonNegativeIntegerSchema, } from "../schema.js";
|
|
3
|
+
/** Rows each ops-health section returns at most; `truncated` marks more. */
|
|
4
|
+
export const ROOT_OPS_HEALTH_SECTION_LIMIT = 50;
|
|
5
|
+
/**
|
|
6
|
+
* Billing maintenance runs every minute, so work still due this long after it
|
|
7
|
+
* fell due means the job is not keeping up rather than about to reach it.
|
|
8
|
+
*/
|
|
9
|
+
export const ROOT_OPS_HEALTH_OVERDUE_MINUTES = 15;
|
|
10
|
+
/** How far ahead the report looks for trials ending and purges coming due. */
|
|
11
|
+
export const ROOT_OPS_HEALTH_UPCOMING_DAYS = 7;
|
|
12
|
+
function sectionSchema(rowSchema) {
|
|
13
|
+
return loosePlainObject({
|
|
14
|
+
rows: arraySchema(rowSchema, ROOT_OPS_HEALTH_SECTION_LIMIT),
|
|
15
|
+
/** More rows matched than the section returns. */
|
|
16
|
+
truncated: z.boolean(),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export const ROOT_SEAT_SYNC_CONDITIONS = [
|
|
20
|
+
"failing",
|
|
21
|
+
"stalled",
|
|
22
|
+
"leaseExpired",
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Why a Stripe seat-sync row is listed: its last attempt failed, a pending
|
|
26
|
+
* change has waited well past its retry time, or a claim's lease expired
|
|
27
|
+
* without the claim completing or failing.
|
|
28
|
+
*/
|
|
29
|
+
export const RootSeatSyncConditionSchema = z.literal(ROOT_SEAT_SYNC_CONDITIONS);
|
|
30
|
+
const RootSeatSyncIssueSchema = loosePlainObject({
|
|
31
|
+
organizationId: nonEmptyStringSchema,
|
|
32
|
+
conditions: arraySchema(RootSeatSyncConditionSchema, ROOT_SEAT_SYNC_CONDITIONS.length),
|
|
33
|
+
attemptCount: nonNegativeIntegerSchema,
|
|
34
|
+
appliedRevision: nonNegativeIntegerSchema,
|
|
35
|
+
desiredRevision: nonNegativeIntegerSchema,
|
|
36
|
+
lastError: z.string().nullable(),
|
|
37
|
+
lastSyncedAt: z.string().nullable(),
|
|
38
|
+
leaseExpiresAt: z.string().nullable(),
|
|
39
|
+
nextAttemptAt: z.string().nullable(),
|
|
40
|
+
});
|
|
41
|
+
const RootTrialExpiryIssueSchema = loosePlainObject({
|
|
42
|
+
organizationId: nonEmptyStringSchema,
|
|
43
|
+
trialEndsAt: z.string(),
|
|
44
|
+
attemptCount: nonNegativeIntegerSchema,
|
|
45
|
+
lastError: z.string().nullable(),
|
|
46
|
+
nextAttemptAt: z.string().nullable(),
|
|
47
|
+
/** The sweep has failed often enough to report the organization. */
|
|
48
|
+
requiresAttention: z.boolean(),
|
|
49
|
+
});
|
|
50
|
+
const RootPurgeIssueSchema = loosePlainObject({
|
|
51
|
+
organizationId: nonEmptyStringSchema,
|
|
52
|
+
status: z.literal(["disabled", "deleting"]),
|
|
53
|
+
purgeAfter: z.string().nullable(),
|
|
54
|
+
purgeStartedAt: z.string().nullable(),
|
|
55
|
+
});
|
|
56
|
+
const RootTrialEndingSchema = loosePlainObject({
|
|
57
|
+
organizationId: nonEmptyStringSchema,
|
|
58
|
+
trialEndsAt: z.string(),
|
|
59
|
+
});
|
|
60
|
+
const RootPurgeDueSchema = loosePlainObject({
|
|
61
|
+
organizationId: nonEmptyStringSchema,
|
|
62
|
+
disabledAt: z.string().nullable(),
|
|
63
|
+
purgeAfter: z.string(),
|
|
64
|
+
});
|
|
65
|
+
/** Cross-organization billing maintenance health, from `GET /root/reports/ops-health`. */
|
|
66
|
+
export const RootOpsHealthReportResponseSchema = loosePlainObject({
|
|
67
|
+
generatedAt: z.string(),
|
|
68
|
+
/** Stripe seat-sync rows the worker would claim, in retry order. */
|
|
69
|
+
seatSync: sectionSchema(RootSeatSyncIssueSchema),
|
|
70
|
+
/** Ended trials the expiry sweep failed on or has not reached in time. */
|
|
71
|
+
trialExpiry: sectionSchema(RootTrialExpiryIssueSchema),
|
|
72
|
+
/** Purges past due to start, or started with a lapsed lease. */
|
|
73
|
+
purges: sectionSchema(RootPurgeIssueSchema),
|
|
74
|
+
/** Trials ending within the upcoming window, soonest first. */
|
|
75
|
+
trialsEnding: sectionSchema(RootTrialEndingSchema),
|
|
76
|
+
/** Disabled organizations whose purge falls due within the window. */
|
|
77
|
+
purgesDue: sectionSchema(RootPurgeDueSchema),
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=rootOpsHealth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rootOpsHealth.js","sourceRoot":"","sources":["rootOpsHealth.ts"],"names":[],"mappings":"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","sourcesContent":["import { z } from \"zod\";\nimport {\n arraySchema,\n loosePlainObject,\n nonEmptyStringSchema,\n nonNegativeIntegerSchema,\n} from \"../schema\";\n\n/** Rows each ops-health section returns at most; `truncated` marks more. */\nexport const ROOT_OPS_HEALTH_SECTION_LIMIT = 50;\n\n/**\n * Billing maintenance runs every minute, so work still due this long after it\n * fell due means the job is not keeping up rather than about to reach it.\n */\nexport const ROOT_OPS_HEALTH_OVERDUE_MINUTES = 15;\n\n/** How far ahead the report looks for trials ending and purges coming due. */\nexport const ROOT_OPS_HEALTH_UPCOMING_DAYS = 7;\n\nfunction sectionSchema<RowSchema extends z.ZodType>(rowSchema: RowSchema) {\n return loosePlainObject({\n rows: arraySchema(rowSchema, ROOT_OPS_HEALTH_SECTION_LIMIT),\n /** More rows matched than the section returns. */\n truncated: z.boolean(),\n });\n}\n\nexport const ROOT_SEAT_SYNC_CONDITIONS = [\n \"failing\",\n \"stalled\",\n \"leaseExpired\",\n] as const;\n\n/**\n * Why a Stripe seat-sync row is listed: its last attempt failed, a pending\n * change has waited well past its retry time, or a claim's lease expired\n * without the claim completing or failing.\n */\nexport const RootSeatSyncConditionSchema = z.literal(ROOT_SEAT_SYNC_CONDITIONS);\n\nconst RootSeatSyncIssueSchema = loosePlainObject({\n organizationId: nonEmptyStringSchema,\n conditions: arraySchema(\n RootSeatSyncConditionSchema,\n ROOT_SEAT_SYNC_CONDITIONS.length,\n ),\n attemptCount: nonNegativeIntegerSchema,\n appliedRevision: nonNegativeIntegerSchema,\n desiredRevision: nonNegativeIntegerSchema,\n lastError: z.string().nullable(),\n lastSyncedAt: z.string().nullable(),\n leaseExpiresAt: z.string().nullable(),\n nextAttemptAt: z.string().nullable(),\n});\n\nconst RootTrialExpiryIssueSchema = loosePlainObject({\n organizationId: nonEmptyStringSchema,\n trialEndsAt: z.string(),\n attemptCount: nonNegativeIntegerSchema,\n lastError: z.string().nullable(),\n nextAttemptAt: z.string().nullable(),\n /** The sweep has failed often enough to report the organization. */\n requiresAttention: z.boolean(),\n});\n\nconst RootPurgeIssueSchema = loosePlainObject({\n organizationId: nonEmptyStringSchema,\n status: z.literal([\"disabled\", \"deleting\"]),\n purgeAfter: z.string().nullable(),\n purgeStartedAt: z.string().nullable(),\n});\n\nconst RootTrialEndingSchema = loosePlainObject({\n organizationId: nonEmptyStringSchema,\n trialEndsAt: z.string(),\n});\n\nconst RootPurgeDueSchema = loosePlainObject({\n organizationId: nonEmptyStringSchema,\n disabledAt: z.string().nullable(),\n purgeAfter: z.string(),\n});\n\n/** Cross-organization billing maintenance health, from `GET /root/reports/ops-health`. */\nexport const RootOpsHealthReportResponseSchema = loosePlainObject({\n generatedAt: z.string(),\n /** Stripe seat-sync rows the worker would claim, in retry order. */\n seatSync: sectionSchema(RootSeatSyncIssueSchema),\n /** Ended trials the expiry sweep failed on or has not reached in time. */\n trialExpiry: sectionSchema(RootTrialExpiryIssueSchema),\n /** Purges past due to start, or started with a lapsed lease. */\n purges: sectionSchema(RootPurgeIssueSchema),\n /** Trials ending within the upcoming window, soonest first. */\n trialsEnding: sectionSchema(RootTrialEndingSchema),\n /** Disabled organizations whose purge falls due within the window. */\n purgesDue: sectionSchema(RootPurgeDueSchema),\n});\n\nexport type RootOpsHealthReportResponse = z.infer<\n typeof RootOpsHealthReportResponseSchema\n>;\n"]}
|
|
@@ -353,6 +353,7 @@ export declare const RootOrganizationIdentityResponseSchema: z.ZodType<{
|
|
|
353
353
|
lastActiveAt: string | null;
|
|
354
354
|
registrationSourceIpAddress: string | null;
|
|
355
355
|
signingKeyFingerprint: string;
|
|
356
|
+
suspendedAt: string | null;
|
|
356
357
|
userId: string;
|
|
357
358
|
};
|
|
358
359
|
roster: {
|
|
@@ -370,6 +371,7 @@ export declare const RootOrganizationIdentityResponseSchema: z.ZodType<{
|
|
|
370
371
|
lastActiveAt: string | null;
|
|
371
372
|
registrationSourceIpAddress: string | null;
|
|
372
373
|
signingKeyFingerprint: string;
|
|
374
|
+
suspendedAt: string | null;
|
|
373
375
|
userId: string;
|
|
374
376
|
};
|
|
375
377
|
roster: {
|
|
@@ -387,6 +389,7 @@ export declare const RootOrganizationIdentityResponseSchema: z.ZodType<{
|
|
|
387
389
|
lastActiveAt: string | null;
|
|
388
390
|
registrationSourceIpAddress: string | null;
|
|
389
391
|
signingKeyFingerprint: string;
|
|
392
|
+
suspendedAt: string | null;
|
|
390
393
|
userId: string;
|
|
391
394
|
};
|
|
392
395
|
roster: {
|
|
@@ -404,6 +407,7 @@ export declare const RootOrganizationIdentityResponseSchema: z.ZodType<{
|
|
|
404
407
|
lastActiveAt: string | null;
|
|
405
408
|
registrationSourceIpAddress: string | null;
|
|
406
409
|
signingKeyFingerprint: string;
|
|
410
|
+
suspendedAt: string | null;
|
|
407
411
|
userId: string;
|
|
408
412
|
};
|
|
409
413
|
roster: {
|
|
@@ -424,6 +428,7 @@ export declare const RootOrganizationIdentitiesResponseSchema: z.ZodType<{
|
|
|
424
428
|
lastActiveAt: string | null;
|
|
425
429
|
registrationSourceIpAddress: string | null;
|
|
426
430
|
signingKeyFingerprint: string;
|
|
431
|
+
suspendedAt: string | null;
|
|
427
432
|
userId: string;
|
|
428
433
|
};
|
|
429
434
|
roster: {
|
|
@@ -444,6 +449,7 @@ export declare const RootOrganizationIdentitiesResponseSchema: z.ZodType<{
|
|
|
444
449
|
lastActiveAt: string | null;
|
|
445
450
|
registrationSourceIpAddress: string | null;
|
|
446
451
|
signingKeyFingerprint: string;
|
|
452
|
+
suspendedAt: string | null;
|
|
447
453
|
userId: string;
|
|
448
454
|
};
|
|
449
455
|
roster: {
|
|
@@ -464,6 +470,7 @@ export declare const RootOrganizationIdentitiesResponseSchema: z.ZodType<{
|
|
|
464
470
|
lastActiveAt: string | null;
|
|
465
471
|
registrationSourceIpAddress: string | null;
|
|
466
472
|
signingKeyFingerprint: string;
|
|
473
|
+
suspendedAt: string | null;
|
|
467
474
|
userId: string;
|
|
468
475
|
};
|
|
469
476
|
roster: {
|
|
@@ -484,6 +491,7 @@ export declare const RootOrganizationIdentitiesResponseSchema: z.ZodType<{
|
|
|
484
491
|
lastActiveAt: string | null;
|
|
485
492
|
registrationSourceIpAddress: string | null;
|
|
486
493
|
signingKeyFingerprint: string;
|
|
494
|
+
suspendedAt: string | null;
|
|
487
495
|
userId: string;
|
|
488
496
|
};
|
|
489
497
|
roster: {
|
package/package.json
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { RequestResult } from "../../internal/api-client/index.js";
|
|
2
2
|
import type { RootAuditEventsQuery } from "../../internal/validators/operation/index.js";
|
|
3
|
-
import type { RootAuditEventResponse, RootAuditEventsResponse } from "../../internal/validators/response/index.js";
|
|
3
|
+
import type { RootAuditAction, RootAuditEventResponse, RootAuditEventsResponse } from "../../internal/validators/response/index.js";
|
|
4
4
|
import { type RootRequestOutcome } from "./identities.js";
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* One recorded operator action (wire shape); a null actor is the API CLI. The
|
|
7
|
+
* action is an operation id, which may be one this SDK predates.
|
|
8
|
+
*/
|
|
9
|
+
export type RootAuditEvent = RootAuditEventResponse & {
|
|
10
|
+
readonly action: RootAuditAction | (string & {});
|
|
11
|
+
};
|
|
7
12
|
/** A page of audit events, newest first, plus the next page's cursor. */
|
|
8
|
-
export type RootAuditEventsPage = RootAuditEventsResponse
|
|
13
|
+
export type RootAuditEventsPage = RootAuditEventsResponse & {
|
|
14
|
+
readonly events: RootAuditEvent[];
|
|
15
|
+
};
|
|
9
16
|
/** Paging and the optional identity or organization the events involve. */
|
|
10
17
|
export type RootAuditEventsQueryInput = RootAuditEventsQuery;
|
|
11
18
|
export interface RootAuditApi {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["audit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["audit.ts"],"names":[],"mappings":"AAOA,OAAO,EAA2B,SAAS,EAAE,MAAM,cAAc,CAAC;AAwBlE,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,GAAiB,EACjB,QAAmC,EAAE;IAErC,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["import type { RequestResult } from \"@tearleads/api-client\";\nimport type { RootAuditEventsQuery } from \"@tearleads/validators/operation\";\nimport type {\n RootAuditAction,\n RootAuditEventResponse,\n RootAuditEventsResponse,\n} from \"@tearleads/validators/response\";\nimport { type RootRequestOutcome, toOutcome } from \"./identities\";\n\n/**\n * One recorded operator action (wire shape); a null actor is the API CLI. The\n * action is an operation id, which may be one this SDK predates.\n */\nexport type RootAuditEvent = RootAuditEventResponse & {\n readonly action: RootAuditAction | (string & {});\n};\n\n/** A page of audit events, newest first, plus the next page's cursor. */\nexport type RootAuditEventsPage = RootAuditEventsResponse & {\n readonly events: RootAuditEvent[];\n};\n\n/** Paging and the optional identity or organization the events involve. */\nexport type RootAuditEventsQueryInput = RootAuditEventsQuery;\n\nexport interface RootAuditApi {\n listRootAuditEventsResult(\n query?: RootAuditEventsQuery,\n ): Promise<RequestResult<RootAuditEventsResponse>>;\n}\n\nexport async function listRootAuditEvents(\n api: RootAuditApi,\n query: RootAuditEventsQueryInput = {},\n): Promise<RootRequestOutcome<RootAuditEventsPage>> {\n return toOutcome(await api.listRootAuditEventsResult(query));\n}\n"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { listRootAuditEvents, type RootAuditApi, type RootAuditEvent, type RootAuditEventsPage, type RootAuditEventsQueryInput, } from "./audit.js";
|
|
2
2
|
export { listRootDataUsageReport, loadRootOrganizationDataUsage, type RootDataUsageApi, type RootDataUsageReportPage, } from "./dataUsage.js";
|
|
3
3
|
export { listRootIdentities, listRootIdentityOrganizations, loadRootIdentity, type RootIdentitiesApi, type RootIdentitiesPage, type RootIdentitiesQueryInput, type RootIdentity, type RootIdentityDetail, type RootIdentityOrganization, type RootIdentitySession, type RootRequestOutcome, } from "./identities.js";
|
|
4
|
+
export { loadRootOpsHealthReport, type RootOpsHealthApi, type RootOpsHealthReport, } from "./opsHealth.js";
|
|
4
5
|
export { listRootOrganizationIdentities, listRootOrganizations, loadRootOrganization, type RootOrganization, type RootOrganizationDetail, type RootOrganizationIdentitiesPage, type RootOrganizationIdentity, type RootOrganizationPageQueryInput, type RootOrganizationsApi, type RootOrganizationsPage, type RootOrganizationsQueryInput, } from "./organizations.js";
|
|
6
|
+
export { liftRootIdentitySuspension, type RootSuspensionApi, suspendRootIdentity, } from "./suspension.js";
|
package/workflows/root/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { listRootAuditEvents, } from "./audit.js";
|
|
2
2
|
export { listRootDataUsageReport, loadRootOrganizationDataUsage, } from "./dataUsage.js";
|
|
3
3
|
export { listRootIdentities, listRootIdentityOrganizations, loadRootIdentity, } from "./identities.js";
|
|
4
|
+
export { loadRootOpsHealthReport, } from "./opsHealth.js";
|
|
4
5
|
export { listRootOrganizationIdentities, listRootOrganizations, loadRootOrganization, } from "./organizations.js";
|
|
6
|
+
export { liftRootIdentitySuspension, suspendRootIdentity, } from "./suspension.js";
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAKpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,uBAAuB,EACvB,6BAA6B,GAG9B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,gBAAgB,GASjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,EACrB,oBAAoB,GASrB,MAAM,iBAAiB,CAAC","sourcesContent":["export {\n listRootAuditEvents,\n type RootAuditApi,\n type RootAuditEvent,\n type RootAuditEventsPage,\n type RootAuditEventsQueryInput,\n} from \"./audit\";\nexport {\n listRootDataUsageReport,\n loadRootOrganizationDataUsage,\n type RootDataUsageApi,\n type RootDataUsageReportPage,\n} from \"./dataUsage\";\nexport {\n listRootIdentities,\n listRootIdentityOrganizations,\n loadRootIdentity,\n type RootIdentitiesApi,\n type RootIdentitiesPage,\n type RootIdentitiesQueryInput,\n type RootIdentity,\n type RootIdentityDetail,\n type RootIdentityOrganization,\n type RootIdentitySession,\n type RootRequestOutcome,\n} from \"./identities\";\nexport {\n listRootOrganizationIdentities,\n listRootOrganizations,\n loadRootOrganization,\n type RootOrganization,\n type RootOrganizationDetail,\n type RootOrganizationIdentitiesPage,\n type RootOrganizationIdentity,\n type RootOrganizationPageQueryInput,\n type RootOrganizationsApi,\n type RootOrganizationsPage,\n type RootOrganizationsQueryInput,\n} from \"./organizations\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAKpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,uBAAuB,EACvB,6BAA6B,GAG9B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,gBAAgB,GASjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,uBAAuB,GAGxB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,EACrB,oBAAoB,GASrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0BAA0B,EAE1B,mBAAmB,GACpB,MAAM,cAAc,CAAC","sourcesContent":["export {\n listRootAuditEvents,\n type RootAuditApi,\n type RootAuditEvent,\n type RootAuditEventsPage,\n type RootAuditEventsQueryInput,\n} from \"./audit\";\nexport {\n listRootDataUsageReport,\n loadRootOrganizationDataUsage,\n type RootDataUsageApi,\n type RootDataUsageReportPage,\n} from \"./dataUsage\";\nexport {\n listRootIdentities,\n listRootIdentityOrganizations,\n loadRootIdentity,\n type RootIdentitiesApi,\n type RootIdentitiesPage,\n type RootIdentitiesQueryInput,\n type RootIdentity,\n type RootIdentityDetail,\n type RootIdentityOrganization,\n type RootIdentitySession,\n type RootRequestOutcome,\n} from \"./identities\";\nexport {\n loadRootOpsHealthReport,\n type RootOpsHealthApi,\n type RootOpsHealthReport,\n} from \"./opsHealth\";\nexport {\n listRootOrganizationIdentities,\n listRootOrganizations,\n loadRootOrganization,\n type RootOrganization,\n type RootOrganizationDetail,\n type RootOrganizationIdentitiesPage,\n type RootOrganizationIdentity,\n type RootOrganizationPageQueryInput,\n type RootOrganizationsApi,\n type RootOrganizationsPage,\n type RootOrganizationsQueryInput,\n} from \"./organizations\";\nexport {\n liftRootIdentitySuspension,\n type RootSuspensionApi,\n suspendRootIdentity,\n} from \"./suspension\";\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RequestResult } from "../../internal/api-client/index.js";
|
|
2
|
+
import type { RootOpsHealthReportResponse } from "../../internal/validators/response/index.js";
|
|
3
|
+
import { type RootRequestOutcome } from "./identities.js";
|
|
4
|
+
/** Cross-organization billing maintenance health (wire shape). */
|
|
5
|
+
export type RootOpsHealthReport = RootOpsHealthReportResponse;
|
|
6
|
+
export interface RootOpsHealthApi {
|
|
7
|
+
getRootOpsHealthReportResult(): Promise<RequestResult<RootOpsHealthReportResponse>>;
|
|
8
|
+
}
|
|
9
|
+
export declare function loadRootOpsHealthReport(api: RootOpsHealthApi): Promise<RootRequestOutcome<RootOpsHealthReport>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opsHealth.js","sourceRoot":"","sources":["opsHealth.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,SAAS,EAAE,MAAM,cAAc,CAAC;AAWlE,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,GAAqB;IAErB,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,4BAA4B,EAAE,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import type { RequestResult } from \"@tearleads/api-client\";\nimport type { RootOpsHealthReportResponse } from \"@tearleads/validators/response\";\nimport { type RootRequestOutcome, toOutcome } from \"./identities\";\n\n/** Cross-organization billing maintenance health (wire shape). */\nexport type RootOpsHealthReport = RootOpsHealthReportResponse;\n\nexport interface RootOpsHealthApi {\n getRootOpsHealthReportResult(): Promise<\n RequestResult<RootOpsHealthReportResponse>\n >;\n}\n\nexport async function loadRootOpsHealthReport(\n api: RootOpsHealthApi,\n): Promise<RootRequestOutcome<RootOpsHealthReport>> {\n return toOutcome(await api.getRootOpsHealthReportResult());\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RequestResult } from "../../internal/api-client/index.js";
|
|
2
|
+
import type { RootIdentitySuspensionResponse } from "../../internal/validators/response/index.js";
|
|
3
|
+
import { type RootIdentity, type RootRequestOutcome } from "./identities.js";
|
|
4
|
+
export interface RootSuspensionApi {
|
|
5
|
+
liftRootIdentitySuspensionResult(userId: string): Promise<RequestResult<RootIdentitySuspensionResponse>>;
|
|
6
|
+
suspendRootIdentityResult(userId: string): Promise<RequestResult<RootIdentitySuspensionResponse>>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Signs the identity out of every device and refuses its sign-in until the
|
|
10
|
+
* suspension is lifted. Root identities are refused with status 409.
|
|
11
|
+
*/
|
|
12
|
+
export declare function suspendRootIdentity(api: RootSuspensionApi, userId: string): Promise<RootRequestOutcome<RootIdentity>>;
|
|
13
|
+
export declare function liftRootIdentitySuspension(api: RootSuspensionApi, userId: string): Promise<RootRequestOutcome<RootIdentity>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { toOutcome, } from "./identities.js";
|
|
2
|
+
function identityOutcome(result) {
|
|
3
|
+
return result.ok
|
|
4
|
+
? { data: result.data.identity, ok: true }
|
|
5
|
+
: toOutcome(result);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Signs the identity out of every device and refuses its sign-in until the
|
|
9
|
+
* suspension is lifted. Root identities are refused with status 409.
|
|
10
|
+
*/
|
|
11
|
+
export async function suspendRootIdentity(api, userId) {
|
|
12
|
+
return identityOutcome(await api.suspendRootIdentityResult(userId));
|
|
13
|
+
}
|
|
14
|
+
export async function liftRootIdentitySuspension(api, userId) {
|
|
15
|
+
return identityOutcome(await api.liftRootIdentitySuspensionResult(userId));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=suspension.js.map
|