@pdfvector/util 0.0.31 → 0.1.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.
- package/.tsc/lib/api-source.d.ts +1 -1
- package/.tsc/lib/api-source.d.ts.map +1 -1
- package/.tsc/lib/api-source.js +1 -0
- package/.tsc/lib/contract/gateway/index.d.ts +7 -0
- package/.tsc/lib/contract/gateway/index.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/index.js +3 -0
- package/.tsc/lib/contract/gateway/mcp-account.d.ts +64 -0
- package/.tsc/lib/contract/gateway/mcp-account.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/mcp-account.js +38 -0
- package/.tsc/lib/contract/gateway/router/admin/billing.d.ts +50 -0
- package/.tsc/lib/contract/gateway/router/admin/billing.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/admin/billing.js +51 -0
- package/.tsc/lib/contract/gateway/router/admin/blog.d.ts +38 -0
- package/.tsc/lib/contract/gateway/router/admin/blog.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/admin/blog.js +36 -0
- package/.tsc/lib/contract/gateway/router/admin/feedback.d.ts +48 -0
- package/.tsc/lib/contract/gateway/router/admin/feedback.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/admin/feedback.js +52 -0
- package/.tsc/lib/contract/gateway/router/admin/instances.d.ts +8 -0
- package/.tsc/lib/contract/gateway/router/admin/instances.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/admin/instances.js +8 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/free.d.ts +108 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/free.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/free.js +86 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/index.d.ts +4 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/index.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/index.js +3 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/overview.d.ts +105 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/overview.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/overview.js +65 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/records.d.ts +72 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/records.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/records.js +55 -0
- package/.tsc/lib/contract/gateway/router/admin/users.d.ts +93 -0
- package/.tsc/lib/contract/gateway/router/admin/users.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/admin/users.js +101 -0
- package/.tsc/lib/contract/gateway/router/admin.d.ts +7 -0
- package/.tsc/lib/contract/gateway/router/admin.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/admin.js +6 -0
- package/.tsc/lib/contract/gateway/router/billing.d.ts +17 -0
- package/.tsc/lib/contract/gateway/router/billing.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/billing.js +20 -0
- package/.tsc/lib/contract/gateway/router/blog.d.ts +35 -0
- package/.tsc/lib/contract/gateway/router/blog.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/blog.js +29 -0
- package/.tsc/lib/contract/gateway/router/feedback.d.ts +14 -0
- package/.tsc/lib/contract/gateway/router/feedback.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/feedback.js +15 -0
- package/.tsc/lib/contract/gateway/router/free-feedback.d.ts +19 -0
- package/.tsc/lib/contract/gateway/router/free-feedback.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/free-feedback.js +10 -0
- package/.tsc/lib/contract/gateway/router/greeting.d.ts +7 -0
- package/.tsc/lib/contract/gateway/router/greeting.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/greeting.js +11 -0
- package/.tsc/lib/contract/gateway/router/health.d.ts +5 -0
- package/.tsc/lib/contract/gateway/router/health.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/health.js +6 -0
- package/.tsc/lib/contract/gateway/router/index.d.ts +10 -0
- package/.tsc/lib/contract/gateway/router/index.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/index.js +9 -0
- package/.tsc/lib/contract/gateway/router/instance/api-keys.d.ts +30 -0
- package/.tsc/lib/contract/gateway/router/instance/api-keys.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/instance/api-keys.js +20 -0
- package/.tsc/lib/contract/gateway/router/instance/instances.d.ts +40 -0
- package/.tsc/lib/contract/gateway/router/instance/instances.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/instance/instances.js +24 -0
- package/.tsc/lib/contract/gateway/router/instance/proxy.d.ts +50 -0
- package/.tsc/lib/contract/gateway/router/instance/proxy.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/instance/proxy.js +55 -0
- package/.tsc/lib/contract/gateway/router/instance/usage.d.ts +205 -0
- package/.tsc/lib/contract/gateway/router/instance/usage.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/instance/usage.js +92 -0
- package/.tsc/lib/contract/gateway/router/instance.d.ts +5 -0
- package/.tsc/lib/contract/gateway/router/instance.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/instance.js +4 -0
- package/.tsc/lib/contract/gateway/router/workspace.d.ts +31 -0
- package/.tsc/lib/contract/gateway/router/workspace.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/workspace.js +30 -0
- package/.tsc/lib/contract/instance/fetchable-url-schema.d.ts +3 -0
- package/.tsc/lib/contract/instance/fetchable-url-schema.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/fetchable-url-schema.js +5 -0
- package/.tsc/lib/contract/instance/index.d.ts +12 -0
- package/.tsc/lib/contract/instance/index.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/index.js +7 -0
- package/.tsc/lib/contract/instance/json-schema-input.d.ts +3 -0
- package/.tsc/lib/contract/instance/json-schema-input.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/json-schema-input.js +23 -0
- package/.tsc/lib/contract/instance/page-markdown-schema.d.ts +6 -0
- package/.tsc/lib/contract/instance/page-markdown-schema.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/page-markdown-schema.js +9 -0
- package/.tsc/lib/contract/instance/pdfvector-model-schema.d.ts +8 -0
- package/.tsc/lib/contract/instance/pdfvector-model-schema.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/pdfvector-model-schema.js +4 -0
- package/.tsc/lib/contract/instance/pdfvector-model.d.ts +4 -0
- package/.tsc/lib/contract/instance/pdfvector-model.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/pdfvector-model.js +0 -0
- package/.tsc/lib/contract/instance/router/academic/fetch.d.ts +69 -0
- package/.tsc/lib/contract/instance/router/academic/fetch.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/academic/fetch.js +119 -0
- package/.tsc/lib/contract/instance/router/academic/find-citations.d.ts +70 -0
- package/.tsc/lib/contract/instance/router/academic/find-citations.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/academic/find-citations.js +116 -0
- package/.tsc/lib/contract/instance/router/academic/index.d.ts +8 -0
- package/.tsc/lib/contract/instance/router/academic/index.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/academic/index.js +7 -0
- package/.tsc/lib/contract/instance/router/academic/paper-graph.d.ts +113 -0
- package/.tsc/lib/contract/instance/router/academic/paper-graph.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/academic/paper-graph.js +144 -0
- package/.tsc/lib/contract/instance/router/academic/parse.d.ts +50 -0
- package/.tsc/lib/contract/instance/router/academic/parse.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/academic/parse.js +146 -0
- package/.tsc/lib/contract/instance/router/academic/provider.d.ts +18 -0
- package/.tsc/lib/contract/instance/router/academic/provider.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/academic/provider.js +16 -0
- package/.tsc/lib/contract/instance/router/academic/search-grants.d.ts +84 -0
- package/.tsc/lib/contract/instance/router/academic/search-grants.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/academic/search-grants.js +171 -0
- package/.tsc/lib/contract/instance/router/academic/search.d.ts +83 -0
- package/.tsc/lib/contract/instance/router/academic/search.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/academic/search.js +154 -0
- package/.tsc/lib/contract/instance/router/academic/similar-papers.d.ts +89 -0
- package/.tsc/lib/contract/instance/router/academic/similar-papers.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/academic/similar-papers.js +143 -0
- package/.tsc/lib/contract/instance/router/admin/get-environment.d.ts +5 -0
- package/.tsc/lib/contract/instance/router/admin/get-environment.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/admin/get-environment.js +13 -0
- package/.tsc/lib/contract/instance/router/admin/get-free-usage-records.d.ts +44 -0
- package/.tsc/lib/contract/instance/router/admin/get-free-usage-records.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/admin/get-free-usage-records.js +39 -0
- package/.tsc/lib/contract/instance/router/admin/get-provider-usage-records.d.ts +41 -0
- package/.tsc/lib/contract/instance/router/admin/get-provider-usage-records.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/admin/get-provider-usage-records.js +50 -0
- package/.tsc/lib/contract/instance/router/admin/get-usage-records.d.ts +49 -0
- package/.tsc/lib/contract/instance/router/admin/get-usage-records.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/admin/get-usage-records.js +44 -0
- package/.tsc/lib/contract/instance/router/admin/health-check.d.ts +5 -0
- package/.tsc/lib/contract/instance/router/admin/health-check.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/admin/health-check.js +14 -0
- package/.tsc/lib/contract/instance/router/admin/index.d.ts +9 -0
- package/.tsc/lib/contract/instance/router/admin/index.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/admin/index.js +8 -0
- package/.tsc/lib/contract/instance/router/admin/set-domain.d.ts +7 -0
- package/.tsc/lib/contract/instance/router/admin/set-domain.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/admin/set-domain.js +20 -0
- package/.tsc/lib/contract/instance/router/admin/set-environment.d.ts +7 -0
- package/.tsc/lib/contract/instance/router/admin/set-environment.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/admin/set-environment.js +41 -0
- package/.tsc/lib/contract/instance/router/admin/set-version.d.ts +7 -0
- package/.tsc/lib/contract/instance/router/admin/set-version.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/admin/set-version.js +21 -0
- package/.tsc/lib/contract/instance/router/authenticate/index.d.ts +2 -0
- package/.tsc/lib/contract/instance/router/authenticate/index.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/authenticate/index.js +1 -0
- package/.tsc/lib/contract/instance/router/authenticate/validate-credential.d.ts +7 -0
- package/.tsc/lib/contract/instance/router/authenticate/validate-credential.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/authenticate/validate-credential.js +20 -0
- package/.tsc/lib/contract/instance/router/bankStatement/ask.d.ts +32 -0
- package/.tsc/lib/contract/instance/router/bankStatement/ask.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/bankStatement/ask.js +88 -0
- package/.tsc/lib/contract/instance/router/bankStatement/extract.d.ts +33 -0
- package/.tsc/lib/contract/instance/router/bankStatement/extract.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/bankStatement/extract.js +113 -0
- package/.tsc/lib/contract/instance/router/bankStatement/get-default-spec.d.ts +2 -0
- package/.tsc/lib/contract/instance/router/bankStatement/get-default-spec.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/bankStatement/get-default-spec.js +19 -0
- package/.tsc/lib/contract/instance/router/bankStatement/index.d.ts +4 -0
- package/.tsc/lib/contract/instance/router/bankStatement/index.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/bankStatement/index.js +3 -0
- package/.tsc/lib/contract/instance/router/bankStatement/parse.d.ts +28 -0
- package/.tsc/lib/contract/instance/router/bankStatement/parse.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/bankStatement/parse.js +105 -0
- package/.tsc/lib/contract/instance/router/document/ask.d.ts +32 -0
- package/.tsc/lib/contract/instance/router/document/ask.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/document/ask.js +134 -0
- package/.tsc/lib/contract/instance/router/document/extract.d.ts +33 -0
- package/.tsc/lib/contract/instance/router/document/extract.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/document/extract.js +152 -0
- package/.tsc/lib/contract/instance/router/document/get-default-spec.d.ts +2 -0
- package/.tsc/lib/contract/instance/router/document/get-default-spec.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/document/get-default-spec.js +19 -0
- package/.tsc/lib/contract/instance/router/document/index.d.ts +4 -0
- package/.tsc/lib/contract/instance/router/document/index.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/document/index.js +3 -0
- package/.tsc/lib/contract/instance/router/document/parse.d.ts +40 -0
- package/.tsc/lib/contract/instance/router/document/parse.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/document/parse.js +142 -0
- package/.tsc/lib/contract/instance/router/free/bank-statement-parse.d.ts +16 -0
- package/.tsc/lib/contract/instance/router/free/bank-statement-parse.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/free/bank-statement-parse.js +87 -0
- package/.tsc/lib/contract/instance/router/free/generate-schema.d.ts +8 -0
- package/.tsc/lib/contract/instance/router/free/generate-schema.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/free/generate-schema.js +110 -0
- package/.tsc/lib/contract/instance/router/free/index.d.ts +5 -0
- package/.tsc/lib/contract/instance/router/free/index.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/free/index.js +4 -0
- package/.tsc/lib/contract/instance/router/free/publication-pdf-url.d.ts +12 -0
- package/.tsc/lib/contract/instance/router/free/publication-pdf-url.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/free/publication-pdf-url.js +86 -0
- package/.tsc/lib/contract/instance/router/free/rate-limit-status.d.ts +19 -0
- package/.tsc/lib/contract/instance/router/free/rate-limit-status.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/free/rate-limit-status.js +36 -0
- package/.tsc/lib/contract/instance/router/identity/ask.d.ts +32 -0
- package/.tsc/lib/contract/instance/router/identity/ask.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/identity/ask.js +95 -0
- package/.tsc/lib/contract/instance/router/identity/extract.d.ts +33 -0
- package/.tsc/lib/contract/instance/router/identity/extract.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/identity/extract.js +103 -0
- package/.tsc/lib/contract/instance/router/identity/get-default-spec.d.ts +2 -0
- package/.tsc/lib/contract/instance/router/identity/get-default-spec.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/identity/get-default-spec.js +19 -0
- package/.tsc/lib/contract/instance/router/identity/index.d.ts +4 -0
- package/.tsc/lib/contract/instance/router/identity/index.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/identity/index.js +3 -0
- package/.tsc/lib/contract/instance/router/identity/parse.d.ts +29 -0
- package/.tsc/lib/contract/instance/router/identity/parse.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/identity/parse.js +109 -0
- package/.tsc/lib/contract/instance/router/index.d.ts +9 -0
- package/.tsc/lib/contract/instance/router/index.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/index.js +8 -0
- package/.tsc/lib/contract/instance/router/invoice/ask.d.ts +32 -0
- package/.tsc/lib/contract/instance/router/invoice/ask.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/invoice/ask.js +85 -0
- package/.tsc/lib/contract/instance/router/invoice/extract.d.ts +33 -0
- package/.tsc/lib/contract/instance/router/invoice/extract.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/invoice/extract.js +109 -0
- package/.tsc/lib/contract/instance/router/invoice/get-default-spec.d.ts +2 -0
- package/.tsc/lib/contract/instance/router/invoice/get-default-spec.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/invoice/get-default-spec.js +19 -0
- package/.tsc/lib/contract/instance/router/invoice/index.d.ts +4 -0
- package/.tsc/lib/contract/instance/router/invoice/index.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/invoice/index.js +3 -0
- package/.tsc/lib/contract/instance/router/invoice/parse.d.ts +28 -0
- package/.tsc/lib/contract/instance/router/invoice/parse.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/router/invoice/parse.js +100 -0
- package/.tsc/lib/contract/instance/supported-mimes.d.ts +35 -0
- package/.tsc/lib/contract/instance/supported-mimes.d.ts.map +1 -0
- package/.tsc/lib/contract/instance/supported-mimes.js +130 -0
- package/.tsc/lib/date.d.ts.map +1 -1
- package/.tsc/lib/date.js +3 -5
- package/CHANGELOG.md +18 -0
- package/package.json +14 -2
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const getFreeUsageRecords: 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
|
+
operation: z.ZodString;
|
|
9
|
+
ip: z.ZodString;
|
|
10
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
11
|
+
api: "api";
|
|
12
|
+
make: "make";
|
|
13
|
+
mcp: "mcp";
|
|
14
|
+
n8n: "n8n";
|
|
15
|
+
playground: "playground";
|
|
16
|
+
sdk: "sdk";
|
|
17
|
+
unknown: "unknown";
|
|
18
|
+
zapier: "zapier";
|
|
19
|
+
}>>;
|
|
20
|
+
model: z.ZodNullable<z.ZodString>;
|
|
21
|
+
inputSource: z.ZodNullable<z.ZodString>;
|
|
22
|
+
inputRef: z.ZodNullable<z.ZodString>;
|
|
23
|
+
fileSize: z.ZodNullable<z.ZodNumber>;
|
|
24
|
+
documentType: z.ZodNullable<z.ZodString>;
|
|
25
|
+
pageCount: z.ZodNullable<z.ZodNumber>;
|
|
26
|
+
error: z.ZodNullable<z.ZodString>;
|
|
27
|
+
status: z.ZodEnum<{
|
|
28
|
+
success: "success";
|
|
29
|
+
system_error: "system_error";
|
|
30
|
+
user_error: "user_error";
|
|
31
|
+
}>;
|
|
32
|
+
errorStage: z.ZodNullable<z.ZodEnum<{
|
|
33
|
+
auth: "auth";
|
|
34
|
+
preprocessing: "preprocessing";
|
|
35
|
+
processing: "processing";
|
|
36
|
+
validation: "validation";
|
|
37
|
+
}>>;
|
|
38
|
+
errorCode: z.ZodNullable<z.ZodString>;
|
|
39
|
+
duration: z.ZodNumber;
|
|
40
|
+
createdAt: z.ZodNumber;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
hasMore: z.ZodBoolean;
|
|
43
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
44
|
+
//# sourceMappingURL=get-free-usage-records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-free-usage-records.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/instance/router/admin/get-free-usage-records.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAsB9B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { apiSources, errorStages, usageStatuses } from "@pdfvector/util";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
const freeUsageRecordSchema = z.object({
|
|
5
|
+
id: z.number(),
|
|
6
|
+
operation: z.string(),
|
|
7
|
+
ip: z.string(),
|
|
8
|
+
source: z.enum(apiSources).default("unknown"),
|
|
9
|
+
model: z.string().nullable(),
|
|
10
|
+
inputSource: z.string().nullable(),
|
|
11
|
+
inputRef: z.string().nullable(),
|
|
12
|
+
fileSize: z.number().nullable(),
|
|
13
|
+
documentType: z.string().nullable(),
|
|
14
|
+
pageCount: z.number().nullable(),
|
|
15
|
+
error: z.string().nullable(),
|
|
16
|
+
status: z.enum(usageStatuses),
|
|
17
|
+
errorStage: z.enum(errorStages).nullable(),
|
|
18
|
+
errorCode: z.string().nullable(),
|
|
19
|
+
duration: z.number(),
|
|
20
|
+
createdAt: z.number(),
|
|
21
|
+
});
|
|
22
|
+
export const getFreeUsageRecords = oc
|
|
23
|
+
.route({
|
|
24
|
+
summary: "Get free usage records",
|
|
25
|
+
description: "Returns free usage records with id > cursor, ordered by id ascending",
|
|
26
|
+
tags: ["Admin"],
|
|
27
|
+
spec: (op) => {
|
|
28
|
+
op.security = [{ bearerAuth: [] }];
|
|
29
|
+
return op;
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
.input(z.object({
|
|
33
|
+
cursor: z.number().optional().default(0),
|
|
34
|
+
limit: z.number().optional().default(1000),
|
|
35
|
+
}))
|
|
36
|
+
.output(z.object({
|
|
37
|
+
records: z.array(freeUsageRecordSchema),
|
|
38
|
+
hasMore: z.boolean(),
|
|
39
|
+
}));
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
providerResource: z.ZodNullable<z.ZodString>;
|
|
16
|
+
documentType: z.ZodNullable<z.ZodString>;
|
|
17
|
+
fileSize: z.ZodNullable<z.ZodNumber>;
|
|
18
|
+
pageCount: z.ZodNullable<z.ZodNumber>;
|
|
19
|
+
inputTokens: z.ZodNullable<z.ZodNumber>;
|
|
20
|
+
uncachedInputTokens: z.ZodNullable<z.ZodNumber>;
|
|
21
|
+
cachedInputTokens: z.ZodNullable<z.ZodNumber>;
|
|
22
|
+
cacheWriteTokens: z.ZodNullable<z.ZodNumber>;
|
|
23
|
+
outputTokens: z.ZodNullable<z.ZodNumber>;
|
|
24
|
+
reasoningTokens: z.ZodNullable<z.ZodNumber>;
|
|
25
|
+
totalTokens: z.ZodNullable<z.ZodNumber>;
|
|
26
|
+
featuresJson: z.ZodNullable<z.ZodString>;
|
|
27
|
+
status: z.ZodEnum<{
|
|
28
|
+
success: "success";
|
|
29
|
+
system_error: "system_error";
|
|
30
|
+
user_error: "user_error";
|
|
31
|
+
}>;
|
|
32
|
+
error: z.ZodNullable<z.ZodString>;
|
|
33
|
+
duration: z.ZodNumber;
|
|
34
|
+
estimatedCostUsdMicro: z.ZodNullable<z.ZodNumber>;
|
|
35
|
+
pricingVersion: z.ZodNullable<z.ZodString>;
|
|
36
|
+
rawUsageJson: z.ZodNullable<z.ZodString>;
|
|
37
|
+
createdAt: z.ZodNumber;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
hasMore: z.ZodBoolean;
|
|
40
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
41
|
+
//# sourceMappingURL=get-provider-usage-records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-provider-usage-records.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/instance/router/admin/get-provider-usage-records.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgCxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAsBlC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
providerResource: z.string().nullable(),
|
|
14
|
+
documentType: z.string().nullable(),
|
|
15
|
+
fileSize: z.number().nullable(),
|
|
16
|
+
pageCount: z.number().nullable(),
|
|
17
|
+
inputTokens: z.number().nullable(),
|
|
18
|
+
uncachedInputTokens: z.number().nullable(),
|
|
19
|
+
cachedInputTokens: z.number().nullable(),
|
|
20
|
+
cacheWriteTokens: z.number().nullable(),
|
|
21
|
+
outputTokens: z.number().nullable(),
|
|
22
|
+
reasoningTokens: z.number().nullable(),
|
|
23
|
+
totalTokens: z.number().nullable(),
|
|
24
|
+
featuresJson: z.string().nullable(),
|
|
25
|
+
status: z.enum(usageStatuses),
|
|
26
|
+
error: z.string().nullable(),
|
|
27
|
+
duration: z.number(),
|
|
28
|
+
estimatedCostUsdMicro: z.number().nullable(),
|
|
29
|
+
pricingVersion: z.string().nullable(),
|
|
30
|
+
rawUsageJson: z.string().nullable(),
|
|
31
|
+
createdAt: z.number(),
|
|
32
|
+
});
|
|
33
|
+
export const getProviderUsageRecords = oc
|
|
34
|
+
.route({
|
|
35
|
+
summary: "Get provider usage records",
|
|
36
|
+
description: "Returns provider-level usage records with id > cursor, ordered by id ascending",
|
|
37
|
+
tags: ["Admin"],
|
|
38
|
+
spec: (op) => {
|
|
39
|
+
op.security = [{ bearerAuth: [] }];
|
|
40
|
+
return op;
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
.input(z.object({
|
|
44
|
+
cursor: z.number().optional().default(0),
|
|
45
|
+
limit: z.number().optional().default(1000),
|
|
46
|
+
}))
|
|
47
|
+
.output(z.object({
|
|
48
|
+
records: z.array(providerUsageRecordSchema),
|
|
49
|
+
hasMore: z.boolean(),
|
|
50
|
+
}));
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
status: z.ZodEnum<{
|
|
17
|
+
success: "success";
|
|
18
|
+
system_error: "system_error";
|
|
19
|
+
user_error: "user_error";
|
|
20
|
+
}>;
|
|
21
|
+
errorStage: z.ZodNullable<z.ZodEnum<{
|
|
22
|
+
auth: "auth";
|
|
23
|
+
preprocessing: "preprocessing";
|
|
24
|
+
processing: "processing";
|
|
25
|
+
validation: "validation";
|
|
26
|
+
}>>;
|
|
27
|
+
errorCode: z.ZodNullable<z.ZodString>;
|
|
28
|
+
duration: z.ZodNumber;
|
|
29
|
+
operation: z.ZodString;
|
|
30
|
+
pageCount: z.ZodNullable<z.ZodNumber>;
|
|
31
|
+
requestedModel: z.ZodString;
|
|
32
|
+
actualModel: z.ZodNullable<z.ZodString>;
|
|
33
|
+
apiKey: z.ZodNullable<z.ZodString>;
|
|
34
|
+
workspaceId: z.ZodNullable<z.ZodNumber>;
|
|
35
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
36
|
+
api: "api";
|
|
37
|
+
make: "make";
|
|
38
|
+
mcp: "mcp";
|
|
39
|
+
n8n: "n8n";
|
|
40
|
+
playground: "playground";
|
|
41
|
+
sdk: "sdk";
|
|
42
|
+
unknown: "unknown";
|
|
43
|
+
zapier: "zapier";
|
|
44
|
+
}>>;
|
|
45
|
+
createdAt: z.ZodNumber;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
hasMore: z.ZodBoolean;
|
|
48
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
49
|
+
//# sourceMappingURL=get-usage-records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-usage-records.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/instance/router/admin/get-usage-records.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0BxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAsB1B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { apiSources, errorStages, usageStatuses } from "@pdfvector/util";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
const usageRecordSchema = z.object({
|
|
5
|
+
id: z.number(),
|
|
6
|
+
credits: z.number(),
|
|
7
|
+
model: z.string().nullable(),
|
|
8
|
+
inputSource: z.string(),
|
|
9
|
+
inputRef: z.string().nullable(),
|
|
10
|
+
fileSize: z.number(),
|
|
11
|
+
documentType: z.string(),
|
|
12
|
+
documentId: z.string().nullable(),
|
|
13
|
+
error: z.string().nullable(),
|
|
14
|
+
status: z.enum(usageStatuses),
|
|
15
|
+
errorStage: z.enum(errorStages).nullable(),
|
|
16
|
+
errorCode: z.string().nullable(),
|
|
17
|
+
duration: z.number(),
|
|
18
|
+
operation: z.string(),
|
|
19
|
+
pageCount: z.number().nullable(),
|
|
20
|
+
requestedModel: z.string(),
|
|
21
|
+
actualModel: z.string().nullable(),
|
|
22
|
+
apiKey: z.string().nullable(),
|
|
23
|
+
workspaceId: z.number().nullable(),
|
|
24
|
+
source: z.enum(apiSources).default("unknown"),
|
|
25
|
+
createdAt: z.number(),
|
|
26
|
+
});
|
|
27
|
+
export const getUsageRecords = oc
|
|
28
|
+
.route({
|
|
29
|
+
summary: "Get usage records",
|
|
30
|
+
description: "Returns usage records with id > cursor, ordered by id ascending",
|
|
31
|
+
tags: ["Admin"],
|
|
32
|
+
spec: (op) => {
|
|
33
|
+
op.security = [{ bearerAuth: [] }];
|
|
34
|
+
return op;
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
.input(z.object({
|
|
38
|
+
cursor: z.number().optional().default(0),
|
|
39
|
+
limit: z.number().optional().default(1000),
|
|
40
|
+
}))
|
|
41
|
+
.output(z.object({
|
|
42
|
+
records: z.array(usageRecordSchema),
|
|
43
|
+
hasMore: z.boolean(),
|
|
44
|
+
}));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const healthCheck: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
3
|
+
message: z.ZodString;
|
|
4
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
5
|
+
//# sourceMappingURL=health-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-check.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/instance/router/admin/health-check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,WAAW;;8DAUG,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const adminOutputSchema = z.object({ message: z.string() });
|
|
4
|
+
export const healthCheck = oc
|
|
5
|
+
.route({
|
|
6
|
+
summary: "Health check",
|
|
7
|
+
description: "Check that the instance server and database are operational",
|
|
8
|
+
tags: ["Admin"],
|
|
9
|
+
spec: (op) => {
|
|
10
|
+
op.security = [{ bearerAuth: [] }];
|
|
11
|
+
return op;
|
|
12
|
+
},
|
|
13
|
+
})
|
|
14
|
+
.output(adminOutputSchema);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./get-environment.js";
|
|
2
|
+
export * from "./get-free-usage-records.js";
|
|
3
|
+
export * from "./get-provider-usage-records.js";
|
|
4
|
+
export * from "./get-usage-records.js";
|
|
5
|
+
export * from "./health-check.js";
|
|
6
|
+
export * from "./set-domain.js";
|
|
7
|
+
export * from "./set-environment.js";
|
|
8
|
+
export * from "./set-version.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/instance/router/admin/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./get-environment.js";
|
|
2
|
+
export * from "./get-free-usage-records.js";
|
|
3
|
+
export * from "./get-provider-usage-records.js";
|
|
4
|
+
export * from "./get-usage-records.js";
|
|
5
|
+
export * from "./health-check.js";
|
|
6
|
+
export * from "./set-domain.js";
|
|
7
|
+
export * from "./set-environment.js";
|
|
8
|
+
export * from "./set-version.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const setDomain: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3
|
+
domain: z.ZodString;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
message: z.ZodString;
|
|
6
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
7
|
+
//# sourceMappingURL=set-domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-domain.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/instance/router/admin/set-domain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,SAAS;;;;8DAWK,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const adminOutputSchema = z.object({ message: z.string() });
|
|
4
|
+
const setDomainInputSchema = z.object({
|
|
5
|
+
domain: z
|
|
6
|
+
.string()
|
|
7
|
+
.regex(/^([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/, "Must be a valid hostname (e.g. app.example.com)"),
|
|
8
|
+
});
|
|
9
|
+
export const setDomain = oc
|
|
10
|
+
.route({
|
|
11
|
+
summary: "Set instance server's domain",
|
|
12
|
+
description: "Update the instance server's domain name",
|
|
13
|
+
tags: ["Admin"],
|
|
14
|
+
spec: (op) => {
|
|
15
|
+
op.security = [{ bearerAuth: [] }];
|
|
16
|
+
return op;
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
.input(setDomainInputSchema)
|
|
20
|
+
.output(adminOutputSchema);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const setEnvironment: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3
|
+
environment: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
message: z.ZodString;
|
|
6
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
7
|
+
//# sourceMappingURL=set-environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-environment.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/instance/router/admin/set-environment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,cAAc;;;;8DA0CgB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const reservedKeys = new Set([
|
|
4
|
+
"NODE_ENV",
|
|
5
|
+
"PDFVECTOR_LOCAL",
|
|
6
|
+
"VITE_PDFVECTOR_LOCAL",
|
|
7
|
+
"NEXT_PUBLIC_PDFVECTOR_LOCAL",
|
|
8
|
+
"PDFVECTOR_RELEASES_REGION",
|
|
9
|
+
"PDFVECTOR_RELEASES_S3_BUCKET",
|
|
10
|
+
"PDFVECTOR_RELEASES_DYNAMODB_TABLE",
|
|
11
|
+
"PDFVECTOR_INSTANCE_SERVER_DOMAIN",
|
|
12
|
+
"PDFVECTOR_INSTANCE_SERVER_DATA_DIR",
|
|
13
|
+
]);
|
|
14
|
+
export const setEnvironment = oc
|
|
15
|
+
.route({
|
|
16
|
+
summary: "Set instance server's environment",
|
|
17
|
+
description: "Update instance environment variables, or remove them by passing null",
|
|
18
|
+
tags: ["Admin"],
|
|
19
|
+
spec: (op) => {
|
|
20
|
+
op.security = [{ bearerAuth: [] }];
|
|
21
|
+
return op;
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
.input(z.object({
|
|
25
|
+
environment: z
|
|
26
|
+
.record(z
|
|
27
|
+
.string()
|
|
28
|
+
.regex(/^[A-Z_][A-Z0-9_]*$/, "Keys must be valid env var names (e.g. MY_VAR)"), z.union([
|
|
29
|
+
z
|
|
30
|
+
.string()
|
|
31
|
+
.regex(/^[^\0\n\r]*$/, "Values must not contain NULs or newlines"),
|
|
32
|
+
z.null(),
|
|
33
|
+
]))
|
|
34
|
+
.refine((env) => Object.keys(env).length > 0, {
|
|
35
|
+
message: "At least one environment variable is required",
|
|
36
|
+
})
|
|
37
|
+
.refine((env) => !Object.keys(env).some((key) => reservedKeys.has(key)), {
|
|
38
|
+
message: `Cannot set reserved keys: ${[...reservedKeys].join(", ")}`,
|
|
39
|
+
}),
|
|
40
|
+
}))
|
|
41
|
+
.output(z.object({ message: z.string() }));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const setVersion: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3
|
+
version: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"LATEST">]>;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
message: z.ZodString;
|
|
6
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
7
|
+
//# sourceMappingURL=set-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-version.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/instance/router/admin/set-version.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,UAAU;;;;8DAWI,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const setVersionInputSchema = z.object({
|
|
4
|
+
version: z.union([
|
|
5
|
+
z.string().regex(/^\d+\.\d+\.\d+$/, "Must be a valid semver (e.g. 1.2.3)"),
|
|
6
|
+
z.literal("LATEST"),
|
|
7
|
+
]),
|
|
8
|
+
});
|
|
9
|
+
const adminOutputSchema = z.object({ message: z.string() });
|
|
10
|
+
export const setVersion = oc
|
|
11
|
+
.route({
|
|
12
|
+
summary: "Set instance server's version",
|
|
13
|
+
description: "Update the instance server to a specific version",
|
|
14
|
+
tags: ["Admin"],
|
|
15
|
+
spec: (op) => {
|
|
16
|
+
op.security = [{ bearerAuth: [] }];
|
|
17
|
+
return op;
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
.input(setVersionInputSchema)
|
|
21
|
+
.output(adminOutputSchema);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/instance/router/authenticate/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./validate-credential.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const validateCredential: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
|
|
3
|
+
status: z.ZodString;
|
|
4
|
+
version: z.ZodString;
|
|
5
|
+
timestamp: z.ZodString;
|
|
6
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
7
|
+
//# sourceMappingURL=validate-credential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-credential.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/instance/router/authenticate/validate-credential.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,kBAAkB;;;;8DAYT,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const inputSchema = z.object({}).optional();
|
|
4
|
+
const outputSchema = z.object({
|
|
5
|
+
status: z.string().describe("Server status indicator"),
|
|
6
|
+
version: z.string().describe("Server version"),
|
|
7
|
+
timestamp: z.string().describe("Current server timestamp in ISO 8601 format"),
|
|
8
|
+
});
|
|
9
|
+
export const validateCredential = oc
|
|
10
|
+
.route({
|
|
11
|
+
summary: "Validate API credential",
|
|
12
|
+
description: "Verify that the API key is valid and the server is reachable. Returns basic server information.",
|
|
13
|
+
tags: ["Authenticate"],
|
|
14
|
+
spec: (op) => {
|
|
15
|
+
op.security = [{ bearerAuth: [] }];
|
|
16
|
+
return op;
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
.input(inputSchema)
|
|
20
|
+
.output(outputSchema);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ask: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
4
|
+
file: z.ZodOptional<z.ZodFile>;
|
|
5
|
+
base64: z.ZodOptional<z.ZodString>;
|
|
6
|
+
question: z.ZodString;
|
|
7
|
+
model: z.ZodDefault<z.ZodEnum<{
|
|
8
|
+
auto: "auto";
|
|
9
|
+
max: "max";
|
|
10
|
+
mini: "mini";
|
|
11
|
+
nano: "nano";
|
|
12
|
+
pro: "pro";
|
|
13
|
+
}>>;
|
|
14
|
+
documentId: z.ZodOptional<z.ZodString>;
|
|
15
|
+
callback: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
url: z.ZodURL;
|
|
17
|
+
type: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
markdown: z.ZodString;
|
|
21
|
+
pageCount: z.ZodNumber;
|
|
22
|
+
model: z.ZodEnum<{
|
|
23
|
+
max: "max";
|
|
24
|
+
mini: "mini";
|
|
25
|
+
nano: "nano";
|
|
26
|
+
pro: "pro";
|
|
27
|
+
}>;
|
|
28
|
+
credits: z.ZodNumber;
|
|
29
|
+
requestId: z.ZodNumber;
|
|
30
|
+
documentId: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
32
|
+
//# sourceMappingURL=ask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/instance/router/bankStatement/ask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiGxB,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAYS,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { getOpenApiCodeSamples } from "@pdfvector/api-docs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { fetchableUrlSchema } from "../../fetchable-url-schema.js";
|
|
5
|
+
import { pdfvectorModelSchema } from "../../pdfvector-model-schema.js";
|
|
6
|
+
import { outputAskModelDescription, specializedAskModelDescription, supportedFileFormatsDescription, supportedFileMimeErrorMessage, supportedFileMimes, supportedFileTypesLong, } from "../../supported-mimes.js";
|
|
7
|
+
import { getDefaultSpec } from "./get-default-spec.js";
|
|
8
|
+
const specializedModelSchema = z
|
|
9
|
+
.enum(["auto", ...pdfvectorModelSchema.options])
|
|
10
|
+
.default("auto");
|
|
11
|
+
const askInputSchema = z.object({
|
|
12
|
+
url: fetchableUrlSchema
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("URL of the bank statement file to fetch and parse"),
|
|
15
|
+
file: z
|
|
16
|
+
.file()
|
|
17
|
+
.mime([...supportedFileMimes], supportedFileMimeErrorMessage)
|
|
18
|
+
.optional()
|
|
19
|
+
.describe(`Bank statement file upload via multipart form-data (${supportedFileFormatsDescription})`),
|
|
20
|
+
base64: z
|
|
21
|
+
.string()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe("Base64-encoded bank statement file content"),
|
|
24
|
+
question: z
|
|
25
|
+
.string()
|
|
26
|
+
.min(4, "question must be at least 4 characters")
|
|
27
|
+
.describe("The question to answer about the bank statement"),
|
|
28
|
+
model: specializedModelSchema.describe(specializedAskModelDescription),
|
|
29
|
+
documentId: z
|
|
30
|
+
.string()
|
|
31
|
+
.trim()
|
|
32
|
+
.min(1)
|
|
33
|
+
.max(512)
|
|
34
|
+
.optional()
|
|
35
|
+
.describe("Optional external document ID for usage attribution. The x-pdfvector-document-id header takes precedence when both are provided."),
|
|
36
|
+
callback: z
|
|
37
|
+
.object({
|
|
38
|
+
url: fetchableUrlSchema.describe("Webhook URL where results will be POSTed when processing completes"),
|
|
39
|
+
type: z
|
|
40
|
+
.string()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("Callback type identifier (e.g. 'zapier')"),
|
|
43
|
+
})
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("Optional webhook callback for async processing. " +
|
|
46
|
+
"When provided, the server returns 202 immediately and POSTs the full response payload to the callback URL when processing completes. " +
|
|
47
|
+
"On error, the callback receives a POST with X-Pdfvector-Callback-Failed: true header and error details in the body. " +
|
|
48
|
+
"Useful for long-running operations that may exceed client timeout limits."),
|
|
49
|
+
});
|
|
50
|
+
const askOutputSchema = z.object({
|
|
51
|
+
markdown: z.string().describe("The answer to the question"),
|
|
52
|
+
pageCount: z.number().int().describe("Total number of pages in the document"),
|
|
53
|
+
model: pdfvectorModelSchema.describe(outputAskModelDescription),
|
|
54
|
+
credits: z
|
|
55
|
+
.number()
|
|
56
|
+
.int()
|
|
57
|
+
.describe("Number of credits consumed by this API call. Cost per page: nano=6, mini=10, pro=14, max=18."),
|
|
58
|
+
requestId: z
|
|
59
|
+
.number()
|
|
60
|
+
.int()
|
|
61
|
+
.describe("Unique request identifier for this API call"),
|
|
62
|
+
documentId: z
|
|
63
|
+
.string()
|
|
64
|
+
.optional()
|
|
65
|
+
.describe("Document ID if provided via x-pdfvector-document-id header or request body"),
|
|
66
|
+
});
|
|
67
|
+
const requestExamples = {
|
|
68
|
+
"Ask from URL": {
|
|
69
|
+
summary: "Ask from URL",
|
|
70
|
+
value: {
|
|
71
|
+
url: "https://example.com/bank-statement.pdf",
|
|
72
|
+
question: "What is the ending balance?",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
export const ask = oc
|
|
77
|
+
.route({
|
|
78
|
+
summary: "Ask a question about a bank statement",
|
|
79
|
+
description: `Parse a bank statement and answer a question about its content using AI. Supports ${supportedFileTypesLong}. Provide the document via file upload, a public URL, or a base64-encoded string.`,
|
|
80
|
+
tags: ["Bank Statement"],
|
|
81
|
+
spec: (op) => {
|
|
82
|
+
const spec = getDefaultSpec(op, requestExamples);
|
|
83
|
+
spec["x-codeSamples"] = getOpenApiCodeSamples("bank-statement-ask");
|
|
84
|
+
return spec;
|
|
85
|
+
},
|
|
86
|
+
})
|
|
87
|
+
.input(askInputSchema)
|
|
88
|
+
.output(askOutputSchema);
|