@pdfvector/instance-contract 0.0.57 → 0.0.58
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.
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const getProviderUsageRecords: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3
|
+
cursor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
4
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
records: z.ZodArray<z.ZodObject<{
|
|
7
|
+
id: z.ZodNumber;
|
|
8
|
+
apiUsageId: z.ZodNullable<z.ZodNumber>;
|
|
9
|
+
operation: z.ZodString;
|
|
10
|
+
phase: z.ZodString;
|
|
11
|
+
provider: z.ZodString;
|
|
12
|
+
service: z.ZodString;
|
|
13
|
+
providerModel: z.ZodNullable<z.ZodString>;
|
|
14
|
+
providerRegion: z.ZodNullable<z.ZodString>;
|
|
15
|
+
documentType: z.ZodNullable<z.ZodString>;
|
|
16
|
+
fileSize: z.ZodNullable<z.ZodNumber>;
|
|
17
|
+
pageCount: z.ZodNullable<z.ZodNumber>;
|
|
18
|
+
inputTokens: z.ZodNullable<z.ZodNumber>;
|
|
19
|
+
outputTokens: z.ZodNullable<z.ZodNumber>;
|
|
20
|
+
totalTokens: z.ZodNullable<z.ZodNumber>;
|
|
21
|
+
featuresJson: z.ZodNullable<z.ZodString>;
|
|
22
|
+
status: z.ZodEnum<{
|
|
23
|
+
success: "success";
|
|
24
|
+
user_error: "user_error";
|
|
25
|
+
system_error: "system_error";
|
|
26
|
+
}>;
|
|
27
|
+
error: z.ZodNullable<z.ZodString>;
|
|
28
|
+
duration: z.ZodNumber;
|
|
29
|
+
estimatedCostUsdMicro: z.ZodNullable<z.ZodNumber>;
|
|
30
|
+
pricingVersion: z.ZodNullable<z.ZodString>;
|
|
31
|
+
rawUsageJson: z.ZodNullable<z.ZodString>;
|
|
32
|
+
createdAt: z.ZodNumber;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
hasMore: z.ZodBoolean;
|
|
35
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { usageStatuses } from "@pdfvector/util";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
const providerUsageRecordSchema = z.object({
|
|
5
|
+
id: z.number(),
|
|
6
|
+
apiUsageId: z.number().nullable(),
|
|
7
|
+
operation: z.string(),
|
|
8
|
+
phase: z.string(),
|
|
9
|
+
provider: z.string(),
|
|
10
|
+
service: z.string(),
|
|
11
|
+
providerModel: z.string().nullable(),
|
|
12
|
+
providerRegion: z.string().nullable(),
|
|
13
|
+
documentType: z.string().nullable(),
|
|
14
|
+
fileSize: z.number().nullable(),
|
|
15
|
+
pageCount: z.number().nullable(),
|
|
16
|
+
inputTokens: z.number().nullable(),
|
|
17
|
+
outputTokens: z.number().nullable(),
|
|
18
|
+
totalTokens: z.number().nullable(),
|
|
19
|
+
featuresJson: z.string().nullable(),
|
|
20
|
+
status: z.enum(usageStatuses),
|
|
21
|
+
error: z.string().nullable(),
|
|
22
|
+
duration: z.number(),
|
|
23
|
+
estimatedCostUsdMicro: z.number().nullable(),
|
|
24
|
+
pricingVersion: z.string().nullable(),
|
|
25
|
+
rawUsageJson: z.string().nullable(),
|
|
26
|
+
createdAt: z.number(),
|
|
27
|
+
});
|
|
28
|
+
export const getProviderUsageRecords = oc
|
|
29
|
+
.route({
|
|
30
|
+
summary: "Get provider usage records",
|
|
31
|
+
description: "Returns provider-level usage records with id > cursor, ordered by id ascending",
|
|
32
|
+
tags: ["Admin"],
|
|
33
|
+
spec: (op) => {
|
|
34
|
+
op.security = [{ bearerAuth: [] }];
|
|
35
|
+
return op;
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
.input(z.object({
|
|
39
|
+
cursor: z.number().optional().default(0),
|
|
40
|
+
limit: z.number().optional().default(1000),
|
|
41
|
+
}))
|
|
42
|
+
.output(z.object({
|
|
43
|
+
records: z.array(providerUsageRecordSchema),
|
|
44
|
+
hasMore: z.boolean(),
|
|
45
|
+
}));
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @pdfvector/instance-contract
|
|
2
2
|
|
|
3
|
+
## 0.0.58
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#280](https://github.com/phuctm97/pdfvector/pull/280) [`8ddde1d`](https://github.com/phuctm97/pdfvector/commit/8ddde1da0473bb9b510f54d1623352898bd45b25) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Add provider-level usage metering for document processing and gateway synchronization.
|
|
9
|
+
|
|
3
10
|
## 0.0.57
|
|
4
11
|
### Patch Changes
|
|
5
12
|
|