@pdfvector/util 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/.tsc/lib/contract/gateway/router/admin/billing-holds.d.ts +29 -0
  2. package/.tsc/lib/contract/gateway/router/admin/billing-holds.d.ts.map +1 -1
  3. package/.tsc/lib/contract/gateway/router/admin/billing-holds.js +27 -0
  4. package/.tsc/lib/contract/gateway/router/admin/billing.d.ts +21 -0
  5. package/.tsc/lib/contract/gateway/router/admin/billing.d.ts.map +1 -1
  6. package/.tsc/lib/contract/gateway/router/admin/billing.js +20 -0
  7. package/.tsc/lib/contract/gateway/router/admin/usage/free.d.ts +59 -1
  8. package/.tsc/lib/contract/gateway/router/admin/usage/free.d.ts.map +1 -1
  9. package/.tsc/lib/contract/gateway/router/admin/usage/free.js +35 -22
  10. package/.tsc/lib/contract/gateway/router/admin/usage/index.d.ts +1 -0
  11. package/.tsc/lib/contract/gateway/router/admin/usage/index.d.ts.map +1 -1
  12. package/.tsc/lib/contract/gateway/router/admin/usage/index.js +1 -0
  13. package/.tsc/lib/contract/gateway/router/admin/usage/overview.d.ts +24 -0
  14. package/.tsc/lib/contract/gateway/router/admin/usage/overview.d.ts.map +1 -1
  15. package/.tsc/lib/contract/gateway/router/admin/usage/overview.js +15 -8
  16. package/.tsc/lib/contract/gateway/router/admin/usage/provider-health.d.ts +44 -0
  17. package/.tsc/lib/contract/gateway/router/admin/usage/provider-health.d.ts.map +1 -0
  18. package/.tsc/lib/contract/gateway/router/admin/usage/provider-health.js +35 -0
  19. package/.tsc/lib/contract/gateway/router/admin/usage/records.d.ts +2 -0
  20. package/.tsc/lib/contract/gateway/router/admin/usage/records.d.ts.map +1 -1
  21. package/.tsc/lib/contract/gateway/router/admin/usage/records.js +2 -0
  22. package/.tsc/lib/contract/gateway/router/instance/instances.d.ts +8 -0
  23. package/.tsc/lib/contract/gateway/router/instance/instances.d.ts.map +1 -1
  24. package/.tsc/lib/contract/gateway/router/instance/instances.js +2 -0
  25. package/.tsc/lib/contract/instance/router/academic/search.d.ts.map +1 -1
  26. package/.tsc/lib/contract/instance/router/academic/search.js +6 -1
  27. package/CHANGELOG.md +23 -0
  28. package/package.json +1 -1
@@ -10,18 +10,47 @@ export declare const listBillingHolds: import("@orpc/contract").ContractProcedur
10
10
  holds: z.ZodArray<z.ZodObject<{
11
11
  workspaceId: z.ZodNumber;
12
12
  workspaceName: z.ZodString;
13
+ ownerEmail: z.ZodNullable<z.ZodString>;
14
+ stripeDashboardUrl: z.ZodNullable<z.ZodString>;
15
+ status: z.ZodEnum<{
16
+ active: "active";
17
+ exempt: "exempt";
18
+ resolved: "resolved";
19
+ }>;
13
20
  reason: z.ZodString;
14
21
  code: z.ZodString;
22
+ message: z.ZodString;
15
23
  invoiceCount: z.ZodNumber;
16
24
  amountDue: z.ZodNumber;
17
25
  currency: z.ZodString;
26
+ invoices: z.ZodArray<z.ZodObject<{
27
+ id: z.ZodString;
28
+ number: z.ZodNullable<z.ZodString>;
29
+ status: z.ZodString;
30
+ amountRemaining: z.ZodNumber;
31
+ currency: z.ZodString;
32
+ created: z.ZodDate;
33
+ dueDate: z.ZodNullable<z.ZodDate>;
34
+ hostedInvoiceUrl: z.ZodNullable<z.ZodString>;
35
+ }, z.core.$strip>>;
36
+ dispute: z.ZodNullable<z.ZodObject<{
37
+ id: z.ZodString;
38
+ status: z.ZodString;
39
+ amount: z.ZodNumber;
40
+ currency: z.ZodString;
41
+ reason: z.ZodString;
42
+ created: z.ZodDate;
43
+ }, z.core.$strip>>;
44
+ paymentMethodRequired: z.ZodBoolean;
18
45
  linkedWorkspaceId: z.ZodNullable<z.ZodNumber>;
46
+ linkedWorkspaceName: z.ZodNullable<z.ZodString>;
19
47
  matchedBy: z.ZodNullable<z.ZodString>;
20
48
  manual: z.ZodBoolean;
21
49
  since: z.ZodDate;
22
50
  resolvedAt: z.ZodNullable<z.ZodDate>;
23
51
  exemptUntil: z.ZodNullable<z.ZodDate>;
24
52
  emailsSent: z.ZodNumber;
53
+ lastEmailAt: z.ZodNullable<z.ZodDate>;
25
54
  }, z.core.$strip>>;
26
55
  registry: z.ZodArray<z.ZodObject<{
27
56
  kind: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"billing-holds.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/gateway/router/admin/billing-holds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAyB3B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;8DAQY,CAAC"}
1
+ {"version":3,"file":"billing-holds.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/gateway/router/admin/billing-holds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAsD3B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;8DAQY,CAAC"}
@@ -7,18 +7,45 @@ export const listBillingHolds = oc
7
7
  holds: z.array(z.object({
8
8
  workspaceId: z.number(),
9
9
  workspaceName: z.string(),
10
+ ownerEmail: z.string().nullable(),
11
+ stripeDashboardUrl: z.string().nullable(),
12
+ status: z.enum(["active", "exempt", "resolved"]),
10
13
  reason: z.string(),
11
14
  code: z.string(),
15
+ message: z.string(),
12
16
  invoiceCount: z.number(),
13
17
  amountDue: z.number(),
14
18
  currency: z.string(),
19
+ invoices: z.array(z.object({
20
+ id: z.string(),
21
+ number: z.string().nullable(),
22
+ status: z.string(),
23
+ amountRemaining: z.number(),
24
+ currency: z.string(),
25
+ created: z.date(),
26
+ dueDate: z.date().nullable(),
27
+ hostedInvoiceUrl: z.string().nullable(),
28
+ })),
29
+ dispute: z
30
+ .object({
31
+ id: z.string(),
32
+ status: z.string(),
33
+ amount: z.number(),
34
+ currency: z.string(),
35
+ reason: z.string(),
36
+ created: z.date(),
37
+ })
38
+ .nullable(),
39
+ paymentMethodRequired: z.boolean(),
15
40
  linkedWorkspaceId: z.number().nullable(),
41
+ linkedWorkspaceName: z.string().nullable(),
16
42
  matchedBy: z.string().nullable(),
17
43
  manual: z.boolean(),
18
44
  since: z.date(),
19
45
  resolvedAt: z.date().nullable(),
20
46
  exemptUntil: z.date().nullable(),
21
47
  emailsSent: z.number(),
48
+ lastEmailAt: z.date().nullable(),
22
49
  })),
23
50
  registry: z.array(z.object({ kind: z.string(), count: z.number() })),
24
51
  }));
@@ -4,19 +4,39 @@ export declare const listBilling: import("@orpc/contract").ContractProcedureBuil
4
4
  }, z.core.$strip>, z.ZodObject<{
5
5
  users: z.ZodArray<z.ZodObject<{
6
6
  stripeCustomerId: z.ZodString;
7
+ stripeDashboardUrl: z.ZodString;
8
+ workspaceId: z.ZodNumber;
9
+ userId: z.ZodNullable<z.ZodString>;
10
+ organizationId: z.ZodNullable<z.ZodString>;
7
11
  userName: z.ZodString;
8
12
  userEmail: z.ZodString;
9
13
  planKey: z.ZodString;
14
+ annual: z.ZodNullable<z.ZodBoolean>;
10
15
  usedCredits: z.ZodNumber;
11
16
  aggregatedCredits: z.ZodNumber;
12
17
  subscriptionStatus: z.ZodNullable<z.ZodString>;
13
18
  subscriptionId: z.ZodNullable<z.ZodString>;
14
19
  currentPeriodStart: z.ZodNullable<z.ZodDate>;
15
20
  currentPeriodEnd: z.ZodNullable<z.ZodDate>;
21
+ nextRenewalAt: z.ZodNullable<z.ZodDate>;
16
22
  cancelAtPeriodEnd: z.ZodBoolean;
23
+ currency: z.ZodString;
24
+ mrr: z.ZodNumber;
25
+ addOnCount: z.ZodNumber;
26
+ paymentMethod: z.ZodNullable<z.ZodObject<{
27
+ brand: z.ZodString;
28
+ last4: z.ZodString;
29
+ expMonth: z.ZodNumber;
30
+ expYear: z.ZodNumber;
31
+ expired: z.ZodBoolean;
32
+ }, z.core.$strip>>;
17
33
  openInvoiceCount: z.ZodNumber;
18
34
  uncollectibleInvoiceCount: z.ZodNumber;
19
35
  totalAmountDue: z.ZodNumber;
36
+ amountOwed: z.ZodArray<z.ZodObject<{
37
+ currency: z.ZodString;
38
+ amount: z.ZodNumber;
39
+ }, z.core.$strip>>;
20
40
  hasIssues: z.ZodBoolean;
21
41
  reasons: z.ZodArray<z.ZodString>;
22
42
  oldestIssueDate: z.ZodNullable<z.ZodDate>;
@@ -46,5 +66,6 @@ export declare const listBilling: import("@orpc/contract").ContractProcedureBuil
46
66
  }, z.core.$strip>>;
47
67
  }, z.core.$strip>>;
48
68
  cachedAt: z.ZodNullable<z.ZodDate>;
69
+ truncated: z.ZodBoolean;
49
70
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
50
71
  //# sourceMappingURL=billing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/gateway/router/admin/billing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AA0BzB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DA6BtB,CAAC"}
1
+ {"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/gateway/router/admin/billing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AA0BzB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAmDtB,CAAC"}
@@ -28,19 +28,38 @@ export const listBilling = oc
28
28
  .output(z.object({
29
29
  users: z.array(z.object({
30
30
  stripeCustomerId: z.string(),
31
+ stripeDashboardUrl: z.string(),
32
+ workspaceId: z.number(),
33
+ userId: z.string().nullable(),
34
+ organizationId: z.string().nullable(),
31
35
  userName: z.string(),
32
36
  userEmail: z.string(),
33
37
  planKey: z.string(),
38
+ annual: z.boolean().nullable(),
34
39
  usedCredits: z.number(),
35
40
  aggregatedCredits: z.number(),
36
41
  subscriptionStatus: z.string().nullable(),
37
42
  subscriptionId: z.string().nullable(),
38
43
  currentPeriodStart: z.date().nullable(),
39
44
  currentPeriodEnd: z.date().nullable(),
45
+ nextRenewalAt: z.date().nullable(),
40
46
  cancelAtPeriodEnd: z.boolean(),
47
+ currency: z.string(),
48
+ mrr: z.number(),
49
+ addOnCount: z.number(),
50
+ paymentMethod: z
51
+ .object({
52
+ brand: z.string(),
53
+ last4: z.string(),
54
+ expMonth: z.number(),
55
+ expYear: z.number(),
56
+ expired: z.boolean(),
57
+ })
58
+ .nullable(),
41
59
  openInvoiceCount: z.number(),
42
60
  uncollectibleInvoiceCount: z.number(),
43
61
  totalAmountDue: z.number(),
62
+ amountOwed: z.array(z.object({ currency: z.string(), amount: z.number() })),
44
63
  hasIssues: z.boolean(),
45
64
  reasons: z.array(z.string()),
46
65
  oldestIssueDate: z.date().nullable(),
@@ -48,4 +67,5 @@ export const listBilling = oc
48
67
  invoices: z.array(invoiceSchema),
49
68
  })),
50
69
  cachedAt: z.date().nullable(),
70
+ truncated: z.boolean(),
51
71
  }));
@@ -2,7 +2,21 @@ import * as z from "zod";
2
2
  export declare const syncFreeUsage: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
3
3
  success: z.ZodBoolean;
4
4
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
5
- export declare const getFreeUsageOverview: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
5
+ export declare const getFreeUsageOverview: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
6
+ period: z.ZodDefault<z.ZodEnum<{
7
+ "30d": "30d";
8
+ "7d": "7d";
9
+ "90d": "90d";
10
+ all: "all";
11
+ }>>;
12
+ }, z.core.$strip>, z.ZodObject<{
13
+ period: z.ZodEnum<{
14
+ "30d": "30d";
15
+ "7d": "7d";
16
+ "90d": "90d";
17
+ all: "all";
18
+ }>;
19
+ from: z.ZodNullable<z.ZodDate>;
6
20
  totalRequests: z.ZodNumber;
7
21
  successCount: z.ZodNumber;
8
22
  userErrorCount: z.ZodNumber;
@@ -12,6 +26,10 @@ export declare const getFreeUsageOverview: import("@orpc/contract").ContractProc
12
26
  uniqueIps: z.ZodNumber;
13
27
  avgPages: z.ZodNullable<z.ZodNumber>;
14
28
  totalFileSize: z.ZodNumber;
29
+ previous: z.ZodNullable<z.ZodObject<{
30
+ totalRequests: z.ZodNumber;
31
+ uniqueIps: z.ZodNumber;
32
+ }, z.core.$strip>>;
15
33
  daily: z.ZodArray<z.ZodObject<{
16
34
  date: z.ZodString;
17
35
  counts: z.ZodRecord<z.ZodString, z.ZodNumber>;
@@ -20,10 +38,14 @@ export declare const getFreeUsageOverview: import("@orpc/contract").ContractProc
20
38
  byOperation: z.ZodArray<z.ZodObject<{
21
39
  label: z.ZodString;
22
40
  count: z.ZodNumber;
41
+ dailyLimit: z.ZodNullable<z.ZodNumber>;
42
+ cappedIpDays: z.ZodNumber;
23
43
  }, z.core.$strip>>;
24
44
  byIp: z.ZodArray<z.ZodObject<{
25
45
  label: z.ZodString;
26
46
  count: z.ZodNumber;
47
+ lastSeenAt: z.ZodDate;
48
+ cappedDays: z.ZodNumber;
27
49
  }, z.core.$strip>>;
28
50
  byModel: z.ZodArray<z.ZodObject<{
29
51
  label: z.ZodString;
@@ -33,13 +55,31 @@ export declare const getFreeUsageOverview: import("@orpc/contract").ContractProc
33
55
  label: z.ZodString;
34
56
  count: z.ZodNumber;
35
57
  }, z.core.$strip>>;
58
+ bySource: z.ZodArray<z.ZodObject<{
59
+ label: z.ZodString;
60
+ count: z.ZodNumber;
61
+ }, z.core.$strip>>;
62
+ cappedIpDays: z.ZodNumber;
63
+ cappedRecent: z.ZodArray<z.ZodObject<{
64
+ ip: z.ZodString;
65
+ operation: z.ZodString;
66
+ date: z.ZodString;
67
+ count: z.ZodNumber;
68
+ limit: z.ZodNumber;
69
+ }, z.core.$strip>>;
36
70
  topSystemErrors: z.ZodArray<z.ZodObject<{
37
71
  message: z.ZodString;
72
+ code: z.ZodNullable<z.ZodString>;
38
73
  count: z.ZodNumber;
74
+ operations: z.ZodArray<z.ZodString>;
75
+ lastSeenAt: z.ZodDate;
39
76
  }, z.core.$strip>>;
40
77
  topUserErrors: z.ZodArray<z.ZodObject<{
41
78
  message: z.ZodString;
79
+ code: z.ZodNullable<z.ZodString>;
42
80
  count: z.ZodNumber;
81
+ operations: z.ZodArray<z.ZodString>;
82
+ lastSeenAt: z.ZodDate;
43
83
  }, z.core.$strip>>;
44
84
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
45
85
  export declare const listFreeUsage: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
@@ -61,6 +101,19 @@ export declare const listFreeUsage: import("@orpc/contract").ContractProcedureBu
61
101
  asc: "asc";
62
102
  desc: "desc";
63
103
  }>>;
104
+ operation: z.ZodOptional<z.ZodString>;
105
+ source: z.ZodOptional<z.ZodEnum<{
106
+ api: "api";
107
+ internal: "internal";
108
+ make: "make";
109
+ mcp: "mcp";
110
+ n8n: "n8n";
111
+ playground: "playground";
112
+ sdk: "sdk";
113
+ unknown: "unknown";
114
+ zapier: "zapier";
115
+ }>>;
116
+ ip: z.ZodOptional<z.ZodString>;
64
117
  }, z.core.$strip>, z.ZodObject<{
65
118
  items: z.ZodArray<z.ZodObject<{
66
119
  id: z.ZodNumber;
@@ -91,6 +144,11 @@ export declare const listFreeUsage: import("@orpc/contract").ContractProcedureBu
91
144
  system_error: "system_error";
92
145
  user_error: "user_error";
93
146
  }>;
147
+ recordedStatus: z.ZodEnum<{
148
+ success: "success";
149
+ system_error: "system_error";
150
+ user_error: "user_error";
151
+ }>;
94
152
  errorStage: z.ZodNullable<z.ZodEnum<{
95
153
  auth: "auth";
96
154
  preprocessing: "preprocessing";
@@ -1 +1 @@
1
- {"version":3,"file":"free.d.ts","sourceRoot":"","sources":["../../../../../../../lib/contract/gateway/router/admin/usage/free.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,eAAO,MAAM,aAAa;;8DAEkB,CAAC;AAE7C,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAuDhC,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DA6CxB,CAAC"}
1
+ {"version":3,"file":"free.d.ts","sourceRoot":"","sources":["../../../../../../../lib/contract/gateway/router/admin/usage/free.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,eAAO,MAAM,aAAa;;8DAEkB,CAAC;AAW7C,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAoD/B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAiDxB,CAAC"}
@@ -4,7 +4,19 @@ import * as z from "zod";
4
4
  export const syncFreeUsage = oc
5
5
  .input(z.object({}))
6
6
  .output(z.object({ success: z.boolean() }));
7
- export const getFreeUsageOverview = oc.input(z.object({})).output(z.object({
7
+ const labelCount = z.object({ label: z.string(), count: z.number() });
8
+ const topError = z.object({
9
+ message: z.string(),
10
+ code: z.string().nullable(),
11
+ count: z.number(),
12
+ operations: z.array(z.string()),
13
+ lastSeenAt: z.date(),
14
+ });
15
+ export const getFreeUsageOverview = oc
16
+ .input(z.object({ period: z.enum(["7d", "30d", "90d", "all"]).default("30d") }))
17
+ .output(z.object({
18
+ period: z.enum(["7d", "30d", "90d", "all"]),
19
+ from: z.date().nullable(),
8
20
  totalRequests: z.number(),
9
21
  successCount: z.number(),
10
22
  userErrorCount: z.number(),
@@ -14,35 +26,32 @@ export const getFreeUsageOverview = oc.input(z.object({})).output(z.object({
14
26
  uniqueIps: z.number(),
15
27
  avgPages: z.number().nullable(),
16
28
  totalFileSize: z.number(),
29
+ previous: z
30
+ .object({ totalRequests: z.number(), uniqueIps: z.number() })
31
+ .nullable(),
17
32
  daily: z.array(z.object({
18
33
  date: z.string(),
19
34
  counts: z.record(z.string(), z.number()),
20
35
  })),
21
36
  dailyOperations: z.array(z.string()),
22
- byOperation: z.array(z.object({
23
- label: z.string(),
24
- count: z.number(),
25
- })),
26
- byIp: z.array(z.object({
27
- label: z.string(),
28
- count: z.number(),
37
+ byOperation: z.array(labelCount.extend({
38
+ dailyLimit: z.number().nullable(),
39
+ cappedIpDays: z.number(),
29
40
  })),
30
- byModel: z.array(z.object({
31
- label: z.string(),
32
- count: z.number(),
33
- })),
34
- byDocumentType: z.array(z.object({
35
- label: z.string(),
36
- count: z.number(),
37
- })),
38
- topSystemErrors: z.array(z.object({
39
- message: z.string(),
40
- count: z.number(),
41
- })),
42
- topUserErrors: z.array(z.object({
43
- message: z.string(),
41
+ byIp: z.array(labelCount.extend({ lastSeenAt: z.date(), cappedDays: z.number() })),
42
+ byModel: z.array(labelCount),
43
+ byDocumentType: z.array(labelCount),
44
+ bySource: z.array(labelCount),
45
+ cappedIpDays: z.number(),
46
+ cappedRecent: z.array(z.object({
47
+ ip: z.string(),
48
+ operation: z.string(),
49
+ date: z.string(),
44
50
  count: z.number(),
51
+ limit: z.number(),
45
52
  })),
53
+ topSystemErrors: z.array(topError),
54
+ topUserErrors: z.array(topError),
46
55
  }));
47
56
  export const listFreeUsage = oc
48
57
  .input(z.object({
@@ -55,6 +64,9 @@ export const listFreeUsage = oc
55
64
  .enum(["createdAt", "operation", "ip", "duration"])
56
65
  .default("createdAt"),
57
66
  sortOrder: z.enum(["asc", "desc"]).default("desc"),
67
+ operation: z.string().max(64).optional(),
68
+ source: z.enum(apiSources).optional(),
69
+ ip: z.string().max(64).optional(),
58
70
  }))
59
71
  .output(z.object({
60
72
  items: z.array(z.object({
@@ -72,6 +84,7 @@ export const listFreeUsage = oc
72
84
  pageCount: z.number().nullable(),
73
85
  error: z.string().nullable(),
74
86
  status: z.enum(["success", "user_error", "system_error"]),
87
+ recordedStatus: z.enum(["success", "user_error", "system_error"]),
75
88
  errorStage: z
76
89
  .enum(["auth", "validation", "preprocessing", "processing"])
77
90
  .nullable(),
@@ -1,5 +1,6 @@
1
1
  export * from "./free.js";
2
2
  export * from "./overview.js";
3
3
  export * from "./provider-costs.js";
4
+ export * from "./provider-health.js";
4
5
  export * from "./records.js";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../lib/contract/gateway/router/admin/usage/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../lib/contract/gateway/router/admin/usage/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from "./free.js";
2
2
  export * from "./overview.js";
3
3
  export * from "./provider-costs.js";
4
+ export * from "./provider-health.js";
4
5
  export * from "./records.js";
@@ -90,11 +90,35 @@ export declare const getUsageOverview: import("@orpc/contract").ContractProcedur
90
90
  }, z.core.$strip>>;
91
91
  topSystemErrors: z.ZodArray<z.ZodObject<{
92
92
  message: z.ZodString;
93
+ code: z.ZodNullable<z.ZodString>;
93
94
  count: z.ZodNumber;
95
+ share: z.ZodNumber;
96
+ operations: z.ZodArray<z.ZodObject<{
97
+ operation: z.ZodString;
98
+ count: z.ZodNumber;
99
+ }, z.core.$strip>>;
100
+ workspaces: z.ZodNumber;
101
+ topModel: z.ZodNullable<z.ZodString>;
102
+ topSource: z.ZodNullable<z.ZodString>;
103
+ firstSeen: z.ZodDate;
104
+ lastSeen: z.ZodDate;
105
+ daily: z.ZodArray<z.ZodNumber>;
94
106
  }, z.core.$strip>>;
95
107
  topUserErrors: z.ZodArray<z.ZodObject<{
96
108
  message: z.ZodString;
109
+ code: z.ZodNullable<z.ZodString>;
97
110
  count: z.ZodNumber;
111
+ share: z.ZodNumber;
112
+ operations: z.ZodArray<z.ZodObject<{
113
+ operation: z.ZodString;
114
+ count: z.ZodNumber;
115
+ }, z.core.$strip>>;
116
+ workspaces: z.ZodNumber;
117
+ topModel: z.ZodNullable<z.ZodString>;
118
+ topSource: z.ZodNullable<z.ZodString>;
119
+ firstSeen: z.ZodDate;
120
+ lastSeen: z.ZodDate;
121
+ daily: z.ZodArray<z.ZodNumber>;
98
122
  }, z.core.$strip>>;
99
123
  topUsers: z.ZodArray<z.ZodObject<{
100
124
  workspaceId: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"overview.d.ts","sourceRoot":"","sources":["../../../../../../../lib/contract/gateway/router/admin/usage/overview.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAOzB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAyE3B,CAAC"}
1
+ {"version":3,"file":"overview.d.ts","sourceRoot":"","sources":["../../../../../../../lib/contract/gateway/router/admin/usage/overview.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAqBzB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DA+D3B,CAAC"}
@@ -5,6 +5,19 @@ const breakdownItemSchema = z.object({
5
5
  label: z.string(),
6
6
  count: z.number(),
7
7
  });
8
+ const topErrorSchema = z.object({
9
+ message: z.string(),
10
+ code: z.string().nullable(),
11
+ count: z.number(),
12
+ share: z.number(),
13
+ operations: z.array(z.object({ operation: z.string(), count: z.number() })),
14
+ workspaces: z.number(),
15
+ topModel: z.string().nullable(),
16
+ topSource: z.string().nullable(),
17
+ firstSeen: z.date(),
18
+ lastSeen: z.date(),
19
+ daily: z.array(z.number()),
20
+ });
8
21
  export const getUsageOverview = oc
9
22
  .input(z.object({
10
23
  period: z.enum(["7d", "30d", "90d", "all"]).default("30d"),
@@ -47,14 +60,8 @@ export const getUsageOverview = oc
47
60
  topModels: z.array(breakdownItemSchema),
48
61
  topRequestedModels: z.array(breakdownItemSchema),
49
62
  topSources: z.array(breakdownItemSchema),
50
- topSystemErrors: z.array(z.object({
51
- message: z.string(),
52
- count: z.number(),
53
- })),
54
- topUserErrors: z.array(z.object({
55
- message: z.string(),
56
- count: z.number(),
57
- })),
63
+ topSystemErrors: z.array(topErrorSchema),
64
+ topUserErrors: z.array(topErrorSchema),
58
65
  topUsers: z.array(z.object({
59
66
  workspaceId: z.number(),
60
67
  label: z.string(),
@@ -0,0 +1,44 @@
1
+ import * as z from "zod";
2
+ /** Failure and hidden-fallback rates per provider/service for the admin console. */
3
+ export declare const getProviderHealth: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodDefault<z.ZodOptional<z.ZodObject<{
4
+ instanceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
5
+ }, z.core.$strip>>>, z.ZodObject<{
6
+ generatedAt: z.ZodString;
7
+ thresholds: z.ZodObject<{
8
+ downMinCalls1h: z.ZodNumber;
9
+ degradedMinCalls24h: z.ZodNumber;
10
+ degradedFailureRate24h: z.ZodNumber;
11
+ }, z.core.$strip>;
12
+ rows: z.ZodArray<z.ZodObject<{
13
+ provider: z.ZodString;
14
+ service: z.ZodString;
15
+ status: z.ZodEnum<{
16
+ degraded: "degraded";
17
+ down: "down";
18
+ ok: "ok";
19
+ }>;
20
+ windows: z.ZodObject<{
21
+ "1h": z.ZodObject<{
22
+ calls: z.ZodNumber;
23
+ systemErrors: z.ZodNumber;
24
+ userErrors: z.ZodNumber;
25
+ fallbacks: z.ZodNumber;
26
+ }, z.core.$strip>;
27
+ "24h": z.ZodObject<{
28
+ calls: z.ZodNumber;
29
+ systemErrors: z.ZodNumber;
30
+ userErrors: z.ZodNumber;
31
+ fallbacks: z.ZodNumber;
32
+ }, z.core.$strip>;
33
+ "7d": z.ZodObject<{
34
+ calls: z.ZodNumber;
35
+ systemErrors: z.ZodNumber;
36
+ userErrors: z.ZodNumber;
37
+ fallbacks: z.ZodNumber;
38
+ }, z.core.$strip>;
39
+ }, z.core.$strip>;
40
+ lastError: z.ZodNullable<z.ZodString>;
41
+ lastErrorAt: z.ZodNullable<z.ZodString>;
42
+ }, z.core.$strip>>;
43
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
44
+ //# sourceMappingURL=provider-health.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-health.d.ts","sourceRoot":"","sources":["../../../../../../../lib/contract/gateway/router/admin/usage/provider-health.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAWzB,oFAAoF;AACpF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DA8B5B,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { oc } from "@orpc/contract";
2
+ import * as z from "zod";
3
+ const windowSchema = z.object({
4
+ calls: z.number(),
5
+ systemErrors: z.number(),
6
+ userErrors: z.number(),
7
+ fallbacks: z.number(),
8
+ });
9
+ const providerHealthStatuses = ["down", "degraded", "ok"];
10
+ /** Failure and hidden-fallback rates per provider/service for the admin console. */
11
+ export const getProviderHealth = oc
12
+ .input(z
13
+ .object({ instanceId: z.number().nullable().optional() })
14
+ .optional()
15
+ .default({}))
16
+ .output(z.object({
17
+ generatedAt: z.string(),
18
+ thresholds: z.object({
19
+ downMinCalls1h: z.number(),
20
+ degradedMinCalls24h: z.number(),
21
+ degradedFailureRate24h: z.number(),
22
+ }),
23
+ rows: z.array(z.object({
24
+ provider: z.string(),
25
+ service: z.string(),
26
+ status: z.enum(providerHealthStatuses),
27
+ windows: z.object({
28
+ "1h": windowSchema,
29
+ "24h": windowSchema,
30
+ "7d": windowSchema,
31
+ }),
32
+ lastError: z.string().nullable(),
33
+ lastErrorAt: z.string().nullable(),
34
+ })),
35
+ }));
@@ -10,6 +10,8 @@ export declare const listUsage: import("@orpc/contract").ContractProcedureBuilde
10
10
  user_error: "user_error";
11
11
  }>>;
12
12
  instanceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
13
+ error: z.ZodOptional<z.ZodString>;
14
+ errorCode: z.ZodOptional<z.ZodString>;
13
15
  sortBy: z.ZodDefault<z.ZodEnum<{
14
16
  createdAt: "createdAt";
15
17
  credits: "credits";
@@ -1 +1 @@
1
- {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../../../../../../lib/contract/gateway/router/admin/usage/records.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAyDpB,CAAC"}
1
+ {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../../../../../../lib/contract/gateway/router/admin/usage/records.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DA2DpB,CAAC"}
@@ -10,6 +10,8 @@ export const listUsage = oc
10
10
  .enum(["all", "success", "user_error", "system_error"])
11
11
  .default("all"),
12
12
  instanceId: z.number().nullable().optional(),
13
+ error: z.string().max(5000).optional(),
14
+ errorCode: z.string().max(200).optional(),
13
15
  sortBy: z
14
16
  .enum([
15
17
  "createdAt",
@@ -16,6 +16,8 @@ export declare const list: import("@orpc/contract").ContractProcedureBuilderWith
16
16
  kind: z.ZodDefault<z.ZodString>;
17
17
  managedStatus: z.ZodDefault<z.ZodString>;
18
18
  lastError: z.ZodDefault<z.ZodNullable<z.ZodString>>;
19
+ imageVersion: z.ZodDefault<z.ZodNullable<z.ZodString>>;
20
+ imageOutdated: z.ZodDefault<z.ZodBoolean>;
19
21
  id: z.ZodNumber;
20
22
  name: z.ZodString;
21
23
  description: z.ZodNullable<z.ZodString>;
@@ -43,6 +45,8 @@ export declare const get: import("@orpc/contract").ContractProcedureBuilderWithI
43
45
  kind: z.ZodDefault<z.ZodString>;
44
46
  managedStatus: z.ZodDefault<z.ZodString>;
45
47
  lastError: z.ZodDefault<z.ZodNullable<z.ZodString>>;
48
+ imageVersion: z.ZodDefault<z.ZodNullable<z.ZodString>>;
49
+ imageOutdated: z.ZodDefault<z.ZodBoolean>;
46
50
  id: z.ZodNumber;
47
51
  name: z.ZodString;
48
52
  description: z.ZodNullable<z.ZodString>;
@@ -96,6 +100,8 @@ export declare const create: import("@orpc/contract").ContractProcedureBuilderWi
96
100
  kind: z.ZodDefault<z.ZodString>;
97
101
  managedStatus: z.ZodDefault<z.ZodString>;
98
102
  lastError: z.ZodDefault<z.ZodNullable<z.ZodString>>;
103
+ imageVersion: z.ZodDefault<z.ZodNullable<z.ZodString>>;
104
+ imageOutdated: z.ZodDefault<z.ZodBoolean>;
99
105
  id: z.ZodNumber;
100
106
  name: z.ZodString;
101
107
  description: z.ZodNullable<z.ZodString>;
@@ -123,6 +129,8 @@ export declare const retry: import("@orpc/contract").ContractProcedureBuilderWit
123
129
  kind: z.ZodDefault<z.ZodString>;
124
130
  managedStatus: z.ZodDefault<z.ZodString>;
125
131
  lastError: z.ZodDefault<z.ZodNullable<z.ZodString>>;
132
+ imageVersion: z.ZodDefault<z.ZodNullable<z.ZodString>>;
133
+ imageOutdated: z.ZodDefault<z.ZodBoolean>;
126
134
  id: z.ZodNumber;
127
135
  name: z.ZodString;
128
136
  description: z.ZodNullable<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"instances.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/gateway/router/instance/instances.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AA+BzB,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;+DAAqC,CAAC;AAEvD,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAEsD,CAAC;AAEvE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAUK,CAAC;AAEzB,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;8DAEM,CAAC;AAEzB,eAAO,MAAM,MAAM;;;;8DAEyB,CAAC;AAE7C,eAAO,MAAM,UAAU;;;;;;;;;+DAarB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;+DAW1B,CAAC"}
1
+ {"version":3,"file":"instances.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/gateway/router/instance/instances.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAiCzB,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;+DAAqC,CAAC;AAEvD,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAEsD,CAAC;AAEvE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAUK,CAAC;AAEzB,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAEM,CAAC;AAEzB,eAAO,MAAM,MAAM;;;;8DAEyB,CAAC;AAE7C,eAAO,MAAM,UAAU;;;;;;;;;+DAarB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;+DAW1B,CAAC"}
@@ -18,6 +18,8 @@ const instanceSchema = z.object({
18
18
  kind: z.string().default("full"),
19
19
  managedStatus: z.string().default("ready"),
20
20
  lastError: z.string().nullable().default(null),
21
+ imageVersion: z.string().nullable().default(null),
22
+ imageOutdated: z.boolean().default(false),
21
23
  id: z.number(),
22
24
  name: z.string(),
23
25
  description: z.string().nullable(),
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/instance/router/academic/search.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2DxB,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAkHhB,CAAC"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/instance/router/academic/search.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2DxB,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAyHhB,CAAC"}
@@ -133,7 +133,12 @@ export const search = oc
133
133
  .output(z.object({
134
134
  estimatedTotalResults: z.number(),
135
135
  results: z.array(publicationSchema),
136
- errors: z.array(providerErrorSchema).nullish(),
136
+ errors: z
137
+ .array(providerErrorSchema)
138
+ .nullish()
139
+ .describe("Providers that failed for this request (for example rate limited or unavailable). " +
140
+ "When present, `results` only contain papers from the providers that succeeded, so treat the response as partial. " +
141
+ "Credits are the same either way."),
137
142
  requestId: z.number().int(),
138
143
  }))
139
144
  .route({
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @pdfvector/util
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#521](https://github.com/phuctm97/pdfvector/pull/521) [`43f714f`](https://github.com/phuctm97/pdfvector/commit/43f714f0a28af7f3d213bfd1042dd2013cb39459) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Add admin provider health: failure and hidden-fallback rates per provider/service over 1 h, 24 h and 7 d, a Provider health card on the admin usage page and a "Needs attention" item on the admin overview.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#521](https://github.com/phuctm97/pdfvector/pull/521) [`43f714f`](https://github.com/phuctm97/pdfvector/commit/43f714f0a28af7f3d213bfd1042dd2013cb39459) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Stop hiding provider failures behind fallbacks:
12
+
13
+ - Semantic Scholar: pace requests per process, retry 429s after `Retry-After` with bounded backoff instead of retrying through the proxy (S2 limits per API key), and record 429/5xx as system errors with the endpoint and response message.
14
+ - Webshare proxy usage now reflects proxy health only; the target's HTTP status is kept in `rawUsage.targetStatus`.
15
+ - Google Document AI: send `imagelessMode` so PDFs of up to 30 pages parse in one call (was 15), and let the max-tier fallback parse larger PDFs in 15-page chunks (up to 200 pages). PDFs over 30 pages skip the failing Document AI call in auto mode.
16
+ - Nano: a PDF without a usable text layer (scanned or image-only) now fails with a clear user-side error that says Nano only reads embedded text, instead of a generic system error.
17
+ - Azure image pre-check failures now record the Azure error code and message.
18
+ - API reference: document the academic search `errors` field (partial results when a provider fails).
19
+
20
+ ## 0.5.1
21
+
22
+ ### Patch Changes
23
+
24
+ - [#516](https://github.com/phuctm97/pdfvector/pull/516) [`1b5e378`](https://github.com/phuctm97/pdfvector/commit/1b5e3786741f1d34b663be68211cb2c887e239b4) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Redesign the Overview, Instances and instance Overview pages as a dashboard: KPI cards with trends against the previous period, a usage-over-time chart (requests by outcome, credits or pages) with a 7/30/90-day and all-time range, a breakdown by operation, source and model, recent requests, plan credits with low and out-of-credit states, and an instances table with search, status and type filters, sorting, column visibility, pagination, row actions, a mobile list, region, version and update badges. The Overview page opens on Usage; the API tab keeps the endpoint, API key, code examples and automations. Admin pages move into their own area with a dedicated sidebar, a new admin overview and a rebuilt billing holds page; the app sidebar shows a single Admin link. `instance.list` and `instance.get` now return the managed image `imageVersion` and whether a newer image is pending (`imageOutdated`).
25
+
3
26
  ## 0.5.0
4
27
 
5
28
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfvector/util",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "main": "./.tsc/lib/index.js",
6
6
  "exports": {