@pdfvector/util 0.3.0 → 0.4.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 +2 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/free.d.ts +1 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/free.d.ts.map +1 -1
- package/.tsc/lib/contract/gateway/router/admin/usage/index.d.ts +1 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/index.d.ts.map +1 -1
- package/.tsc/lib/contract/gateway/router/admin/usage/index.js +1 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/overview.d.ts +2 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/overview.d.ts.map +1 -1
- package/.tsc/lib/contract/gateway/router/admin/usage/provider-costs.d.ts +39 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/provider-costs.d.ts.map +1 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/provider-costs.js +23 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/records.d.ts +1 -0
- package/.tsc/lib/contract/gateway/router/admin/usage/records.d.ts.map +1 -1
- package/.tsc/lib/contract/gateway/router/instance/billing.d.ts +25 -0
- package/.tsc/lib/contract/gateway/router/instance/billing.d.ts.map +1 -1
- package/.tsc/lib/contract/gateway/router/instance/billing.js +12 -0
- package/.tsc/lib/contract/gateway/router/instance/instances.d.ts +12 -0
- package/.tsc/lib/contract/gateway/router/instance/instances.d.ts.map +1 -1
- package/.tsc/lib/contract/gateway/router/instance/instances.js +9 -0
- package/.tsc/lib/contract/gateway/router/instance/usage.d.ts +4 -0
- package/.tsc/lib/contract/gateway/router/instance/usage.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/admin/get-free-usage-records.d.ts +1 -0
- package/.tsc/lib/contract/instance/router/admin/get-free-usage-records.d.ts.map +1 -1
- package/.tsc/lib/contract/instance/router/admin/get-usage-records.d.ts +1 -0
- package/.tsc/lib/contract/instance/router/admin/get-usage-records.d.ts.map +1 -1
- package/.tsc/lib/environment.d.ts +1 -0
- package/.tsc/lib/environment.d.ts.map +1 -1
- package/.tsc/lib/environment.js +3 -0
- package/.tsc/lib/region-profiles.d.ts +18 -0
- package/.tsc/lib/region-profiles.d.ts.map +1 -0
- package/.tsc/lib/region-profiles.js +63 -0
- package/.tsc/lib/resolve-environment.d.ts +1 -0
- package/.tsc/lib/resolve-environment.d.ts.map +1 -1
- package/.tsc/lib/resolve-environment.js +7 -0
- package/.tsc/lib/urls.d.ts.map +1 -1
- package/.tsc/lib/urls.js +10 -5
- package/CHANGELOG.md +20 -0
- package/package.json +1 -1
package/.tsc/lib/api-source.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const apiSources: readonly ["make", "zapier", "n8n", "sdk", "mcp", "playground", "api", "unknown"];
|
|
1
|
+
export declare const apiSources: readonly ["make", "zapier", "n8n", "sdk", "mcp", "playground", "api", "unknown", "internal"];
|
|
2
2
|
export type APISource = (typeof apiSources)[number];
|
|
3
3
|
//# sourceMappingURL=api-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-source.d.ts","sourceRoot":"","sources":["../../lib/api-source.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,YACtB,MAAM,EACN,QAAQ,EACR,KAAK,EACL,KAAK,EACL,KAAK,EACL,YAAY,EACZ,KAAK,EACL,SAAS,
|
|
1
|
+
{"version":3,"file":"api-source.d.ts","sourceRoot":"","sources":["../../lib/api-source.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,YACtB,MAAM,EACN,QAAQ,EACR,KAAK,EACL,KAAK,EACL,KAAK,EACL,YAAY,EACZ,KAAK,EACL,SAAS,EAET,UAAU,CACD,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
package/.tsc/lib/api-source.js
CHANGED
|
@@ -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
|
|
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 +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,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,WAAW,CAAC"}
|
|
@@ -9,6 +9,7 @@ export declare const getUsageOverview: import("@orpc/contract").ContractProcedur
|
|
|
9
9
|
instanceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
10
10
|
sources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
11
11
|
api: "api";
|
|
12
|
+
internal: "internal";
|
|
12
13
|
make: "make";
|
|
13
14
|
mcp: "mcp";
|
|
14
15
|
n8n: "n8n";
|
|
@@ -44,6 +45,7 @@ export declare const getUsageOverview: import("@orpc/contract").ContractProcedur
|
|
|
44
45
|
date: z.ZodString;
|
|
45
46
|
source: z.ZodEnum<{
|
|
46
47
|
api: "api";
|
|
48
|
+
internal: "internal";
|
|
47
49
|
make: "make";
|
|
48
50
|
mcp: "mcp";
|
|
49
51
|
n8n: "n8n";
|
|
@@ -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
|
|
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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
/** Estimated provider cost (OCR, LLM, academic APIs, proxy) for the admin dashboard. */
|
|
3
|
+
export declare const getProviderCosts: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
4
|
+
period: z.ZodDefault<z.ZodEnum<{
|
|
5
|
+
"30d": "30d";
|
|
6
|
+
"7d": "7d";
|
|
7
|
+
"90d": "90d";
|
|
8
|
+
all: "all";
|
|
9
|
+
}>>;
|
|
10
|
+
instanceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
11
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
12
|
+
api: "api";
|
|
13
|
+
internal: "internal";
|
|
14
|
+
make: "make";
|
|
15
|
+
mcp: "mcp";
|
|
16
|
+
n8n: "n8n";
|
|
17
|
+
playground: "playground";
|
|
18
|
+
sdk: "sdk";
|
|
19
|
+
unknown: "unknown";
|
|
20
|
+
zapier: "zapier";
|
|
21
|
+
}>>>;
|
|
22
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
23
|
+
totalCostUsdMicro: z.ZodNumber;
|
|
24
|
+
byProvider: z.ZodArray<z.ZodObject<{
|
|
25
|
+
calls: z.ZodNumber;
|
|
26
|
+
failedCalls: z.ZodNumber;
|
|
27
|
+
costUsdMicro: z.ZodNumber;
|
|
28
|
+
provider: z.ZodString;
|
|
29
|
+
service: z.ZodString;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
byOperationTier: z.ZodArray<z.ZodObject<{
|
|
32
|
+
calls: z.ZodNumber;
|
|
33
|
+
failedCalls: z.ZodNumber;
|
|
34
|
+
costUsdMicro: z.ZodNumber;
|
|
35
|
+
operation: z.ZodString;
|
|
36
|
+
tier: z.ZodString;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
39
|
+
//# sourceMappingURL=provider-costs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-costs.d.ts","sourceRoot":"","sources":["../../../../../../../lib/contract/gateway/router/admin/usage/provider-costs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAQzB,wFAAwF;AACxF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAqB3B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { apiSources } from "@pdfvector/util";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
const costRowSchema = z.object({
|
|
5
|
+
calls: z.number(),
|
|
6
|
+
failedCalls: z.number(),
|
|
7
|
+
costUsdMicro: z.number(),
|
|
8
|
+
});
|
|
9
|
+
/** Estimated provider cost (OCR, LLM, academic APIs, proxy) for the admin dashboard. */
|
|
10
|
+
export const getProviderCosts = oc
|
|
11
|
+
.input(z.object({
|
|
12
|
+
period: z.enum(["7d", "30d", "90d", "all"]).default("30d"),
|
|
13
|
+
instanceId: z.number().nullable().optional(),
|
|
14
|
+
sources: z.array(z.enum(apiSources)).optional(),
|
|
15
|
+
}))
|
|
16
|
+
.output(z.object({
|
|
17
|
+
totalCostUsdMicro: z.number(),
|
|
18
|
+
byProvider: z.array(costRowSchema.extend({ provider: z.string(), service: z.string() })),
|
|
19
|
+
byOperationTier: z.array(costRowSchema.extend({
|
|
20
|
+
operation: z.string(),
|
|
21
|
+
tier: z.string(),
|
|
22
|
+
})),
|
|
23
|
+
}));
|
|
@@ -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
|
|
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"}
|
|
@@ -50,6 +50,10 @@ export declare const createWithBilling: import("@orpc/contract").ContractProcedu
|
|
|
50
50
|
syd: "syd";
|
|
51
51
|
yyz: "yyz";
|
|
52
52
|
}>>;
|
|
53
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
54
|
+
full: "full";
|
|
55
|
+
"local-pdf": "local-pdf";
|
|
56
|
+
}>>;
|
|
53
57
|
requestKey: z.ZodString;
|
|
54
58
|
quoteId: z.ZodString;
|
|
55
59
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -74,4 +78,25 @@ export declare const billingOperation: import("@orpc/contract").ContractProcedur
|
|
|
74
78
|
instanceId: z.ZodNullable<z.ZodNumber>;
|
|
75
79
|
hostedInvoiceUrl: z.ZodNullable<z.ZodString>;
|
|
76
80
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
81
|
+
export declare const pendingBillingOperations: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodArray<z.ZodObject<{
|
|
82
|
+
operationId: z.ZodString;
|
|
83
|
+
state: z.ZodEnum<{
|
|
84
|
+
creating: "creating";
|
|
85
|
+
paid: "paid";
|
|
86
|
+
payment_required: "payment_required";
|
|
87
|
+
reserved: "reserved";
|
|
88
|
+
}>;
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
region: z.ZodNullable<z.ZodString>;
|
|
91
|
+
kind: z.ZodEnum<{
|
|
92
|
+
full: "full";
|
|
93
|
+
"local-pdf": "local-pdf";
|
|
94
|
+
}>;
|
|
95
|
+
createdAt: z.ZodDate;
|
|
96
|
+
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
97
|
+
export declare const cancelBillingOperation: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
98
|
+
operationId: z.ZodString;
|
|
99
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
100
|
+
success: z.ZodLiteral<true>;
|
|
101
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
77
102
|
//# sourceMappingURL=billing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/gateway/router/instance/billing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,cAAc;;;;;;;;;8DAa1B,CAAC;AACF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;8DASxB,CAAC;AACF,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/gateway/router/instance/billing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,cAAc;;;;;;;;;8DAa1B,CAAC;AACF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;8DASxB,CAAC;AACF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAWd,CAAC;AACjB,eAAO,MAAM,gBAAgB;;;;;;;;;;;8DAEb,CAAC;AACjB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;+DAWpC,CAAC;AACF,eAAO,MAAM,sBAAsB;;;;8DAEa,CAAC"}
|
|
@@ -34,6 +34,7 @@ export const createWithBilling = oc
|
|
|
34
34
|
name: z.string().min(1).max(255),
|
|
35
35
|
description: z.string().max(1000).optional(),
|
|
36
36
|
region: z.enum(flyRegions.map((region) => region.code)).optional(),
|
|
37
|
+
kind: z.enum(["local-pdf", "full"]).optional(),
|
|
37
38
|
requestKey: z.string().uuid(),
|
|
38
39
|
quoteId: z.string().uuid(),
|
|
39
40
|
}))
|
|
@@ -41,3 +42,14 @@ export const createWithBilling = oc
|
|
|
41
42
|
export const billingOperation = oc
|
|
42
43
|
.input(z.object({ operationId: z.string().uuid() }))
|
|
43
44
|
.output(result);
|
|
45
|
+
export const pendingBillingOperations = oc.output(z.array(z.object({
|
|
46
|
+
operationId: z.string().uuid(),
|
|
47
|
+
state: z.enum(["reserved", "creating", "payment_required", "paid"]),
|
|
48
|
+
name: z.string(),
|
|
49
|
+
region: z.string().nullable(),
|
|
50
|
+
kind: z.enum(["local-pdf", "full"]),
|
|
51
|
+
createdAt: z.date(),
|
|
52
|
+
})));
|
|
53
|
+
export const cancelBillingOperation = oc
|
|
54
|
+
.input(z.object({ operationId: z.string().uuid() }))
|
|
55
|
+
.output(z.object({ success: z.literal(true) }));
|
|
@@ -72,6 +72,10 @@ export declare const create: import("@orpc/contract").ContractProcedureBuilderWi
|
|
|
72
72
|
syd: "syd";
|
|
73
73
|
yyz: "yyz";
|
|
74
74
|
}>>;
|
|
75
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
76
|
+
full: "full";
|
|
77
|
+
"local-pdf": "local-pdf";
|
|
78
|
+
}>>;
|
|
75
79
|
requestKey: z.ZodOptional<z.ZodString>;
|
|
76
80
|
name: z.ZodString;
|
|
77
81
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -142,4 +146,12 @@ export declare const getCredits: import("@orpc/contract").ContractProcedureBuild
|
|
|
142
146
|
resetsAt: z.ZodNullable<z.ZodDate>;
|
|
143
147
|
eligible: z.ZodBoolean;
|
|
144
148
|
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
149
|
+
export declare const regionProfiles: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodArray<z.ZodObject<{
|
|
150
|
+
code: z.ZodString;
|
|
151
|
+
name: z.ZodString;
|
|
152
|
+
profile: z.ZodString;
|
|
153
|
+
residency: z.ZodString;
|
|
154
|
+
processing: z.ZodString;
|
|
155
|
+
available: z.ZodBoolean;
|
|
156
|
+
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
145
157
|
//# sourceMappingURL=instances.d.ts.map
|
|
@@ -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
|
|
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"}
|
|
@@ -33,6 +33,7 @@ export const get = oc
|
|
|
33
33
|
export const create = oc
|
|
34
34
|
.input(z.object({
|
|
35
35
|
region: z.enum(flyRegions.map((region) => region.code)).optional(),
|
|
36
|
+
kind: z.enum(["local-pdf", "full"]).optional(),
|
|
36
37
|
requestKey: z.string().uuid().optional(),
|
|
37
38
|
name: z.string().min(1).max(255),
|
|
38
39
|
description: z.string().max(1000).optional(),
|
|
@@ -56,3 +57,11 @@ export const getCredits = oc
|
|
|
56
57
|
eligible: z.boolean(),
|
|
57
58
|
})
|
|
58
59
|
.nullable());
|
|
60
|
+
export const regionProfiles = oc.output(z.array(z.object({
|
|
61
|
+
code: z.string(),
|
|
62
|
+
name: z.string(),
|
|
63
|
+
profile: z.string(),
|
|
64
|
+
residency: z.string(),
|
|
65
|
+
processing: z.string(),
|
|
66
|
+
available: z.boolean(),
|
|
67
|
+
})));
|
|
@@ -40,6 +40,7 @@ export declare const getUsage: import("@orpc/contract").ContractProcedureBuilder
|
|
|
40
40
|
workspaceId: z.ZodNullable<z.ZodNumber>;
|
|
41
41
|
source: z.ZodEnum<{
|
|
42
42
|
api: "api";
|
|
43
|
+
internal: "internal";
|
|
43
44
|
make: "make";
|
|
44
45
|
mcp: "mcp";
|
|
45
46
|
n8n: "n8n";
|
|
@@ -69,6 +70,7 @@ export declare const listUsageRecords: import("@orpc/contract").ContractProcedur
|
|
|
69
70
|
excludedApiKeys: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>>;
|
|
70
71
|
sources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
71
72
|
api: "api";
|
|
73
|
+
internal: "internal";
|
|
72
74
|
make: "make";
|
|
73
75
|
mcp: "mcp";
|
|
74
76
|
n8n: "n8n";
|
|
@@ -134,6 +136,7 @@ export declare const listUsageRecords: import("@orpc/contract").ContractProcedur
|
|
|
134
136
|
workspaceId: z.ZodNullable<z.ZodNumber>;
|
|
135
137
|
source: z.ZodEnum<{
|
|
136
138
|
api: "api";
|
|
139
|
+
internal: "internal";
|
|
137
140
|
make: "make";
|
|
138
141
|
mcp: "mcp";
|
|
139
142
|
n8n: "n8n";
|
|
@@ -213,6 +216,7 @@ export declare const getUsageRecord: import("@orpc/contract").ContractProcedureB
|
|
|
213
216
|
workspaceId: z.ZodNullable<z.ZodNumber>;
|
|
214
217
|
source: z.ZodEnum<{
|
|
215
218
|
api: "api";
|
|
219
|
+
internal: "internal";
|
|
216
220
|
make: "make";
|
|
217
221
|
mcp: "mcp";
|
|
218
222
|
n8n: "n8n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/gateway/router/instance/usage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AA6BzB,eAAO,MAAM,SAAS;;;;8DAEoB,CAAC;AAE3C,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../../../../lib/contract/gateway/router/instance/usage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AA6BzB,eAAO,MAAM,SAAS;;;;8DAEoB,CAAC;AAE3C,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAQe,CAAC;AAErC,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DA6C3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;8DAO5B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;8DAoB1B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAMzB,CAAC"}
|
|
@@ -1 +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
|
|
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"}
|
|
@@ -1 +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
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../lib/environment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../lib/environment.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,IAAI,SAAiB,CAAC;AACnC,eAAO,MAAM,OAAO,SAAoB,CAAC;AACzC,eAAO,MAAM,MAAM,SAAW,CAAC;AAC/B,eAAO,MAAM,SAAS,SAAgC,CAAC"}
|
package/.tsc/lib/environment.js
CHANGED
|
@@ -5,10 +5,12 @@ const nodeEnvironment = readRuntimeEnvironment(Reflect.get(globalThis, "process"
|
|
|
5
5
|
const nextPublicEnvironment = safelyReadEnvironment(() => ({
|
|
6
6
|
NEXT_PUBLIC_CI: process.env["NEXT_PUBLIC_CI"],
|
|
7
7
|
NEXT_PUBLIC_PDFVECTOR_LOCAL: process.env["NEXT_PUBLIC_PDFVECTOR_LOCAL"],
|
|
8
|
+
NEXT_PUBLIC_PDFVECTOR_STAGING: process.env["NEXT_PUBLIC_PDFVECTOR_STAGING"],
|
|
8
9
|
}));
|
|
9
10
|
const viteEnvironment = safelyReadEnvironment(() => ({
|
|
10
11
|
VITE_CI: import.meta.env["VITE_CI"],
|
|
11
12
|
VITE_PDFVECTOR_LOCAL: import.meta.env["VITE_PDFVECTOR_LOCAL"],
|
|
13
|
+
VITE_PDFVECTOR_STAGING: import.meta.env["VITE_PDFVECTOR_STAGING"],
|
|
12
14
|
}));
|
|
13
15
|
const environment = resolveEnvironment([
|
|
14
16
|
runtimeFlags(bunEnvironment),
|
|
@@ -19,3 +21,4 @@ const environment = resolveEnvironment([
|
|
|
19
21
|
export const isCI = environment.ci;
|
|
20
22
|
export const isLocal = environment.local;
|
|
21
23
|
export const isLive = !isLocal;
|
|
24
|
+
export const isStaging = isLive && environment.staging;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { flyRegions } from "./fly-regions.js";
|
|
2
|
+
export declare const regionProfileIds: readonly ["uk", "eu", "us", "jp", "au", "apac"];
|
|
3
|
+
export type RegionProfileId = (typeof regionProfileIds)[number];
|
|
4
|
+
export type FlyRegionCode = (typeof flyRegions)[number]["code"];
|
|
5
|
+
export declare const regionProfileInfo: Record<RegionProfileId, {
|
|
6
|
+
residency: string;
|
|
7
|
+
label: string;
|
|
8
|
+
processing: string;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Fly region -> region profile for full instances. Only regions whose AI and OCR
|
|
12
|
+
* providers run in the same residency zone as the machine are listed; others
|
|
13
|
+
* (Sao Paulo, Johannesburg, Toronto) keep text-PDF instances only.
|
|
14
|
+
*/
|
|
15
|
+
export declare const flyRegionProfiles: Partial<Record<FlyRegionCode, RegionProfileId>>;
|
|
16
|
+
export declare function isRegionProfileId(value: unknown): value is RegionProfileId;
|
|
17
|
+
export declare function regionProfileForFlyRegion(code: string): RegionProfileId | undefined;
|
|
18
|
+
//# sourceMappingURL=region-profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"region-profiles.d.ts","sourceRoot":"","sources":["../../lib/region-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,eAAO,MAAM,gBAAgB,YAAI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAU,CAAC;AAEhF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,eAAO,MAAM,iBAAiB,EAAE,MAAM,CACrC,eAAe,EACf;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAsCxD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,CACtC,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC,CAgBtC,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAK1E;AAED,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,MAAM,GACV,eAAe,GAAG,SAAS,CAG7B"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { flyRegions } from "./fly-regions.js";
|
|
2
|
+
export const regionProfileIds = ["uk", "eu", "us", "jp", "au", "apac"];
|
|
3
|
+
export const regionProfileInfo = {
|
|
4
|
+
uk: {
|
|
5
|
+
residency: "UK",
|
|
6
|
+
label: "United Kingdom",
|
|
7
|
+
processing: "AI and OCR run in London (AWS eu-west-2, Azure UK South, Google europe-west2).",
|
|
8
|
+
},
|
|
9
|
+
eu: {
|
|
10
|
+
residency: "EU",
|
|
11
|
+
label: "Europe",
|
|
12
|
+
processing: "AI runs in the European data zone (Azure EU Data Zone, AWS Bedrock EU profiles); OCR runs in Sweden and the Google EU multi-region.",
|
|
13
|
+
},
|
|
14
|
+
us: {
|
|
15
|
+
residency: "US",
|
|
16
|
+
label: "United States",
|
|
17
|
+
processing: "AI runs in the US data zone (Azure US Data Zone, AWS us-east-1 and US profiles); OCR runs in the US.",
|
|
18
|
+
},
|
|
19
|
+
jp: {
|
|
20
|
+
residency: "JP",
|
|
21
|
+
label: "Japan",
|
|
22
|
+
processing: "AI runs in Japan (AWS Tokyo and Japan profiles); OCR runs in Azure Japan East.",
|
|
23
|
+
},
|
|
24
|
+
au: {
|
|
25
|
+
residency: "AU",
|
|
26
|
+
label: "Australia",
|
|
27
|
+
processing: "AI runs in Australia (AWS Sydney and Australia profiles); OCR runs in Azure Australia East and Google australia-southeast1.",
|
|
28
|
+
},
|
|
29
|
+
apac: {
|
|
30
|
+
residency: "APAC",
|
|
31
|
+
label: "Asia Pacific",
|
|
32
|
+
processing: "AI runs in AWS Sydney and Tokyo (in-region and Australia profiles), with Asia Pacific profiles as fallback; OCR runs in Azure Southeast Asia and Google asia-southeast1.",
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Fly region -> region profile for full instances. Only regions whose AI and OCR
|
|
37
|
+
* providers run in the same residency zone as the machine are listed; others
|
|
38
|
+
* (Sao Paulo, Johannesburg, Toronto) keep text-PDF instances only.
|
|
39
|
+
*/
|
|
40
|
+
export const flyRegionProfiles = {
|
|
41
|
+
ams: "eu",
|
|
42
|
+
arn: "eu",
|
|
43
|
+
cdg: "eu",
|
|
44
|
+
dfw: "us",
|
|
45
|
+
ewr: "us",
|
|
46
|
+
fra: "eu",
|
|
47
|
+
iad: "us",
|
|
48
|
+
lax: "us",
|
|
49
|
+
lhr: "uk",
|
|
50
|
+
nrt: "jp",
|
|
51
|
+
ord: "us",
|
|
52
|
+
sin: "apac",
|
|
53
|
+
sjc: "us",
|
|
54
|
+
syd: "au",
|
|
55
|
+
};
|
|
56
|
+
export function isRegionProfileId(value) {
|
|
57
|
+
return (typeof value === "string" &&
|
|
58
|
+
regionProfileIds.some((profileId) => profileId === value));
|
|
59
|
+
}
|
|
60
|
+
export function regionProfileForFlyRegion(code) {
|
|
61
|
+
const region = flyRegions.find((candidate) => candidate.code === code);
|
|
62
|
+
return region ? flyRegionProfiles[region.code] : undefined;
|
|
63
|
+
}
|
|
@@ -2,6 +2,7 @@ type Environment = Readonly<Record<string, string | undefined>> | undefined;
|
|
|
2
2
|
interface ResolvedEnvironment {
|
|
3
3
|
ci: boolean;
|
|
4
4
|
local: boolean;
|
|
5
|
+
staging: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare function runtimeFlags(environment: Environment): Environment;
|
|
7
8
|
export declare function resolveEnvironment(environments: readonly Environment[]): ResolvedEnvironment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-environment.d.ts","sourceRoot":"","sources":["../../lib/resolve-environment.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,CAAC;AAE5E,UAAU,mBAAmB;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve-environment.d.ts","sourceRoot":"","sources":["../../lib/resolve-environment.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,CAAC;AAE5E,UAAU,mBAAmB;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CACjB;AAID,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAOlE;AAeD,wBAAgB,kBAAkB,CACjC,YAAY,EAAE,SAAS,WAAW,EAAE,GAClC,mBAAmB,CAkBrB"}
|
|
@@ -5,6 +5,7 @@ export function runtimeFlags(environment) {
|
|
|
5
5
|
return {
|
|
6
6
|
CI: environment["CI"],
|
|
7
7
|
PDFVECTOR_LOCAL: environment["PDFVECTOR_LOCAL"],
|
|
8
|
+
PDFVECTOR_STAGING: environment["PDFVECTOR_STAGING"],
|
|
8
9
|
};
|
|
9
10
|
}
|
|
10
11
|
function findValue(environments, keys) {
|
|
@@ -24,8 +25,14 @@ export function resolveEnvironment(environments) {
|
|
|
24
25
|
"NEXT_PUBLIC_PDFVECTOR_LOCAL",
|
|
25
26
|
"VITE_PDFVECTOR_LOCAL",
|
|
26
27
|
]);
|
|
28
|
+
const staging = findValue(environments, [
|
|
29
|
+
"PDFVECTOR_STAGING",
|
|
30
|
+
"NEXT_PUBLIC_PDFVECTOR_STAGING",
|
|
31
|
+
"VITE_PDFVECTOR_STAGING",
|
|
32
|
+
]);
|
|
27
33
|
return {
|
|
28
34
|
ci: ci !== undefined && enabledValues.has(ci),
|
|
29
35
|
local: local !== undefined && enabledValues.has(local),
|
|
36
|
+
staging: staging !== undefined && enabledValues.has(staging),
|
|
30
37
|
};
|
|
31
38
|
}
|
package/.tsc/lib/urls.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urls.d.ts","sourceRoot":"","sources":["../../lib/urls.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"urls.d.ts","sourceRoot":"","sources":["../../lib/urls.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,UAAU,QAEF,CAAC;AAEtB,eAAO,MAAM,MAAM,QAEE,CAAC;AAEtB,eAAO,MAAM,gBAAgB,QAEJ,CAAC;AAE1B,eAAO,MAAM,wBAAwB,QAEb,CAAC"}
|
package/.tsc/lib/urls.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { isLocal } from "./environment.js";
|
|
1
|
+
import { isLocal, isStaging } from "./environment.js";
|
|
2
2
|
import { appPort, gatewayServerPort, instanceServerPort, websitePort, } from "./ports.js";
|
|
3
|
+
function deployedURL(subdomain) {
|
|
4
|
+
return isStaging
|
|
5
|
+
? `https://staging-${subdomain}.pdfvector.com`
|
|
6
|
+
: `https://${subdomain}.pdfvector.com`;
|
|
7
|
+
}
|
|
3
8
|
export const websiteURL = isLocal
|
|
4
9
|
? `http://localhost:${websitePort}`
|
|
5
|
-
: "
|
|
10
|
+
: deployedURL("www");
|
|
6
11
|
export const appURL = isLocal
|
|
7
12
|
? `http://localhost:${appPort}`
|
|
8
|
-
: "
|
|
13
|
+
: deployedURL("app");
|
|
9
14
|
export const gatewayServerURL = isLocal
|
|
10
15
|
? `http://localhost:${gatewayServerPort}`
|
|
11
|
-
: "
|
|
16
|
+
: deployedURL("gateway");
|
|
12
17
|
export const generalInstanceServerURL = isLocal
|
|
13
18
|
? `http://localhost:${instanceServerPort}`
|
|
14
|
-
: "
|
|
19
|
+
: deployedURL("global");
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @pdfvector/util
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#500](https://github.com/phuctm97/pdfvector/pull/500) [`a9d1140`](https://github.com/phuctm97/pdfvector/commit/a9d1140c701fe3ccb599d49ccf3459ab17e519cd) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Provider cost tracking:
|
|
8
|
+
- LLM calls (Azure OpenAI, Bedrock) now record an estimated cost from a versioned list-price table (`2026-11-list-price`), per deployment type and region, including cached input and cache writes.
|
|
9
|
+
- Academic providers are tracked: Scrapingdog (Google Scholar, 5 credits per call), the Webshare proxy (bandwidth), and Crossref Plus and Semantic Scholar (call volume at $0).
|
|
10
|
+
- A new admin endpoint `getProviderCosts` and a "Provider cost" card on the admin usage overview show cost per provider and per API + tier.
|
|
11
|
+
|
|
12
|
+
## 0.3.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#498](https://github.com/phuctm97/pdfvector/pull/498) [`b216ac0`](https://github.com/phuctm97/pdfvector/commit/b216ac0b2fec63c92148514390f0b8ceb3831987) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - New model chains from the 2026-11 benchmark.
|
|
17
|
+
|
|
18
|
+
- Global instance: nano, mini and pro use gpt-6-luna at default reasoning (mini and pro no longer force low effort). max uses gpt-6.1-sol. Fallbacks are gpt-oss-120b, Claude Haiku 4.5 and Claude Sonnet 4.6 instead of Amazon Nova. Content validation uses gpt-oss-120b.
|
|
19
|
+
- UK, JP, AU and APAC region instances: nano, mini and pro use gpt-oss-120b inside the zone, and max uses Claude Sonnet 4.6 inside the zone, replacing Amazon Nova and Claude Haiku. EU pro and max fall back to Claude Sonnet 4.6 (EU profile). US matches the global chains.
|
|
20
|
+
- APAC models can run in different in-zone Bedrock regions (Sydney, Tokyo).
|
|
21
|
+
- The privacy page now lists the providers we actually use.
|
|
22
|
+
|
|
3
23
|
## 0.3.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|