@pdfvector/instance-contract 0.0.13 → 0.0.15
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/.tsc/lib/router/admin/get-usage-records.d.ts +23 -0
- package/.tsc/lib/router/admin/get-usage-records.js +36 -0
- package/.tsc/lib/router/admin/index.d.ts +2 -0
- package/.tsc/lib/router/admin/index.js +2 -0
- package/.tsc/lib/router/admin/set-credit-status.d.ts +6 -0
- package/.tsc/lib/router/admin/set-credit-status.js +14 -0
- package/.tsc/lib/router/admin/set-environment.js +2 -0
- package/CHANGELOG.md +14 -0
- package/package.json +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const getUsageRecords: 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
|
+
credits: z.ZodNumber;
|
|
9
|
+
model: z.ZodNullable<z.ZodString>;
|
|
10
|
+
inputSource: z.ZodString;
|
|
11
|
+
inputRef: z.ZodNullable<z.ZodString>;
|
|
12
|
+
fileSize: z.ZodNumber;
|
|
13
|
+
documentType: z.ZodString;
|
|
14
|
+
documentId: z.ZodNullable<z.ZodString>;
|
|
15
|
+
error: z.ZodNullable<z.ZodString>;
|
|
16
|
+
duration: z.ZodNumber;
|
|
17
|
+
operation: z.ZodString;
|
|
18
|
+
pageCount: z.ZodNullable<z.ZodNumber>;
|
|
19
|
+
requestedModel: z.ZodString;
|
|
20
|
+
createdAt: z.ZodNumber;
|
|
21
|
+
}, z.core.$strip>>;
|
|
22
|
+
hasMore: z.ZodBoolean;
|
|
23
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const usageRecordSchema = z.object({
|
|
4
|
+
id: z.number(),
|
|
5
|
+
credits: z.number(),
|
|
6
|
+
model: z.string().nullable(),
|
|
7
|
+
inputSource: z.string(),
|
|
8
|
+
inputRef: z.string().nullable(),
|
|
9
|
+
fileSize: z.number(),
|
|
10
|
+
documentType: z.string(),
|
|
11
|
+
documentId: z.string().nullable(),
|
|
12
|
+
error: z.string().nullable(),
|
|
13
|
+
duration: z.number(),
|
|
14
|
+
operation: z.string(),
|
|
15
|
+
pageCount: z.number().nullable(),
|
|
16
|
+
requestedModel: z.string(),
|
|
17
|
+
createdAt: z.number(),
|
|
18
|
+
});
|
|
19
|
+
export const getUsageRecords = oc
|
|
20
|
+
.route({
|
|
21
|
+
summary: "Get usage records",
|
|
22
|
+
description: "Returns usage records with id > cursor, ordered by id ascending",
|
|
23
|
+
tags: ["Admin"],
|
|
24
|
+
spec: (op) => {
|
|
25
|
+
op.security = [{ bearerAuth: [] }];
|
|
26
|
+
return op;
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
.input(z.object({
|
|
30
|
+
cursor: z.number().optional().default(0),
|
|
31
|
+
limit: z.number().optional().default(1000),
|
|
32
|
+
}))
|
|
33
|
+
.output(z.object({
|
|
34
|
+
records: z.array(usageRecordSchema),
|
|
35
|
+
hasMore: z.boolean(),
|
|
36
|
+
}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const setCreditStatus: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3
|
+
blocked: z.ZodBoolean;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
message: z.ZodString;
|
|
6
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export const setCreditStatus = oc
|
|
4
|
+
.route({
|
|
5
|
+
summary: "Set credit status",
|
|
6
|
+
description: "Set whether the instance is blocked due to credit limits",
|
|
7
|
+
tags: ["Admin"],
|
|
8
|
+
spec: (op) => {
|
|
9
|
+
op.security = [{ bearerAuth: [] }];
|
|
10
|
+
return op;
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
.input(z.object({ blocked: z.boolean() }))
|
|
14
|
+
.output(z.object({ message: z.string() }));
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @pdfvector/instance-contract
|
|
2
2
|
|
|
3
|
+
## 0.0.15
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#105](https://github.com/phuctm97/pdfvector/pull/105) [`367df86`](https://github.com/phuctm97/pdfvector/commit/367df86a7b315d79a0e8de359feacc010d2b1250) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Update credits systems
|
|
9
|
+
|
|
10
|
+
## 0.0.14
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
- [#97](https://github.com/phuctm97/pdfvector/pull/97) [`ae078b8`](https://github.com/phuctm97/pdfvector/commit/ae078b8c10bbab802726e4f05b31ad08be96fd42) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Add instance in spa and sync usage
|
|
16
|
+
|
|
3
17
|
## 0.0.13
|
|
4
18
|
### Patch Changes
|
|
5
19
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfvector/instance-contract",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": ".tsc/lib/index.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@orpc/contract": "^1.13.
|
|
7
|
+
"@orpc/contract": "^1.13.6",
|
|
8
8
|
"zod": "^4.3.6"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|