@forklaunch/core 3.0.0 → 3.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.
@@ -68,9 +68,11 @@ export declare function createPaymentsClient(options?: InstanceGatewayOptions):
68
68
  type StripeConstructor = typeof Stripe;
69
69
  export interface StripeClientOptions extends InstanceGatewayOptions {
70
70
  /**
71
- * A Stripe secret key, for a service NOT running in managed mode (local
72
- * development against your own test account, a self-hosted deployment).
73
- * Ignored in managed mode, where the platform holds the key.
71
+ * A Stripe secret key: the service talks to Stripe directly with it (local
72
+ * development against your own test account, a self-hosted or regular
73
+ * deployment). It wins over a managed contract found in the environment;
74
+ * only explicit gateway options (`gatewayUrl`/`instanceId`/`hmacKey`)
75
+ * outrank it. A managed instance passes none and the platform holds the key.
74
76
  */
75
77
  apiKey?: string;
76
78
  /**
@@ -105,11 +107,20 @@ export declare function stripeGatewayFetch(settings: {
105
107
  /**
106
108
  * The Stripe SDK for this service.
107
109
  *
108
- * In managed mode (gateway options given, or `PLATFORM_GATEWAY_URL`,
109
- * `INSTANCE_ID` and `INSTANCE_HMAC_KEY` set) it is a real `Stripe` whose
110
- * requests go to the platform's instance gateway, signed with the instance
111
- * key; there is no Stripe key in the app. Otherwise it is `new
112
- * Stripe(apiKey)`.
110
+ * Which Stripe it talks to, in order:
111
+ * 1. explicit gateway options (`gatewayUrl`/`instanceId`/`hmacKey`): the
112
+ * platform's instance gateway;
113
+ * 2. an explicit `apiKey`: `new Stripe(apiKey)`, directly — even when the
114
+ * environment carries the managed contract. Those three variables also
115
+ * reach a regular app's components that use another platform feature
116
+ * (email), and an app that passes its own key means its own key;
117
+ * 3. the managed contract in the environment (`PLATFORM_GATEWAY_URL`,
118
+ * `INSTANCE_ID`, `INSTANCE_HMAC_KEY`): the gateway, signed with the
119
+ * instance key; there is no Stripe key in the app.
120
+ * Otherwise it throws.
121
+ *
122
+ * (Through @forklaunch/core 3.0.1 an explicit `apiKey` lost to the
123
+ * environment in step 3.)
113
124
  *
114
125
  * Mechanism (stripe-node 22): `host`/`port`/`protocol` point the SDK at the
115
126
  * gateway, `httpClient: Stripe.createFetchHttpClient(signedFetch)` rewrites
@@ -1 +1 @@
1
- {"version":3,"file":"paymentsClient.d.ts","sourceRoot":"","sources":["../../src/http/paymentsClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAGL,2BAA2B,EAG3B,KAAK,sBAAsB,EAC5B,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,+DAA+D;AAC/D,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,cAAc,EAAE,OAAO,CAAC;IACxB,uDAAuD;IACvD,cAAc,EAAE,OAAO,CAAC;IACxB,uEAAuE;IACvE,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,cAAc,CAAC,MAAM,EAAE;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7B,kDAAkD;IAClD,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;CACnC;AAED,sDAAsD;AACtD,qBAAa,oBAAqB,SAAQ,2BAA2B;IACnE,SAAkB,IAAI,EAAG,sBAAsB,CAAU;CAC1D;AAED,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,sBAA2B,GACnC,cAAc,CAuChB;AAED,KAAK,iBAAiB,GAAG,OAAO,MAAM,CAAC;AAEvC,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB;IACjE;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,iBA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AsB,CAAU;CAC1D;AAED,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,sBAA2B,GACnC,cAAc,CAuChB;AAED,KAAK,iBAAiB,GAAG,OAAO,MAAM,CAAC;AAEvC,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB;IACjE;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC;CAC9B;AAsBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EACrE,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,KAAK,CAqDd;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAyC5E"}
@@ -0,0 +1,48 @@
1
+ import { type GatewayChatCompletion, type GatewayChatRequest, type ModelGatewayClientOptions } from './modelGatewayClient';
2
+ /** A local preview's issued ceilings, not a managed product's monthly usage. */
3
+ export interface GatewayPreviewModels {
4
+ models: {
5
+ id: string;
6
+ }[];
7
+ preview: {
8
+ /** Capability expiration, in Unix milliseconds. */
9
+ expiresAt: number;
10
+ /** Initial request ceiling; this is not a remaining-request count. */
11
+ maxCalls: number;
12
+ /** Initial conservative allowance units, not billable or monthly tokens. */
13
+ maxUnits: number;
14
+ };
15
+ }
16
+ /** Preview relays may omit a provider timestamp; they must not invent one. */
17
+ export interface GatewayPreviewChatCompletion extends Pick<GatewayChatCompletion, 'id' | 'object' | 'model' | 'choices' | 'usage'> {
18
+ created?: number;
19
+ [key: string]: unknown;
20
+ }
21
+ export interface PreviewModelGatewayClient {
22
+ models(): Promise<GatewayPreviewModels>;
23
+ chat: {
24
+ completions: {
25
+ create(request: GatewayChatRequest): Promise<GatewayPreviewChatCompletion>;
26
+ };
27
+ };
28
+ }
29
+ /**
30
+ * Use only for the desktop's isolated local preview relay. The desktop supplies
31
+ * PLATFORM_GATEWAY_URL, INSTANCE_ID and a preview-only INSTANCE_HMAC_KEY.
32
+ * This client neither holds the desktop login nor calls a provider directly.
33
+ *
34
+ * Unlike createModelGatewayClient (managed instances), this catalog makes no
35
+ * monthly-token or BAA claims. Streaming is not supported by the preview relay.
36
+ * The gateway still applies its own bounded chat request protocol.
37
+ *
38
+ * @example
39
+ * const client = createPreviewModelGatewayClient();
40
+ * const catalog = await client.models();
41
+ * const reply = await client.chat.completions.create({
42
+ * model: catalog.models[0].id,
43
+ * messages: [{ role: 'user', content: 'Help plan my task.' }]
44
+ * });
45
+ * // catalog.preview.maxUnits is an issued ceiling, not remaining monthly usage.
46
+ */
47
+ export declare function createPreviewModelGatewayClient(options?: ModelGatewayClientOptions): PreviewModelGatewayClient;
48
+ //# sourceMappingURL=previewModelGatewayClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"previewModelGatewayClient.d.ts","sourceRoot":"","sources":["../../src/http/previewModelGatewayClient.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAE9B,gFAAgF;AAChF,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzB,OAAO,EAAE;QACP,mDAAmD;QACnD,SAAS,EAAE,MAAM,CAAC;QAClB,sEAAsE;QACtE,QAAQ,EAAE,MAAM,CAAC;QACjB,4EAA4E;QAC5E,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,8EAA8E;AAC9E,MAAM,WAAW,4BAA6B,SAAQ,IAAI,CACxD,qBAAqB,EACrB,IAAI,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAChD;IACC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACxC,IAAI,EAAE;QACJ,WAAW,EAAE;YACX,MAAM,CACJ,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,4BAA4B,CAAC,CAAC;SAC1C,CAAC;KACH,CAAC;CACH;AA0ED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,GAAE,yBAA8B,GACtC,yBAAyB,CAyC3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/core",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "forklaunch-js core package. Contains useful building blocks.",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -85,58 +85,58 @@
85
85
  "forklaunch-model-gateway-mock": "./bin/model-gateway-mock.mjs"
86
86
  },
87
87
  "dependencies": {
88
- "@asyncapi/parser": "^3.6.3",
88
+ "@asyncapi/parser": "^3.6.4",
89
89
  "@forklaunch/opentelemetry-instrumentation-hyper-express": "0.0.5",
90
- "@mikro-orm/core": "7.2.2",
91
- "@mikro-orm/mongodb": "7.2.2",
90
+ "@mikro-orm/core": "7.2.5",
91
+ "@mikro-orm/mongodb": "7.2.5",
92
92
  "@opentelemetry/api": "^1.9.1",
93
- "@opentelemetry/api-logs": "^0.222.0",
94
- "@opentelemetry/exporter-logs-otlp-http": "^0.222.0",
95
- "@opentelemetry/exporter-metrics-otlp-http": "^0.222.0",
96
- "@opentelemetry/exporter-prometheus": "^0.222.0",
97
- "@opentelemetry/exporter-trace-otlp-http": "^0.222.0",
98
- "@opentelemetry/instrumentation-express": "^0.70.0",
99
- "@opentelemetry/instrumentation-http": "^0.222.0",
100
- "@opentelemetry/resources": "^2.11.0",
101
- "@opentelemetry/sdk-logs": "^0.222.0",
102
- "@opentelemetry/sdk-metrics": "^2.11.0",
103
- "@opentelemetry/sdk-node": "^0.222.0",
104
- "@opentelemetry/sdk-trace-node": "^2.11.0",
93
+ "@opentelemetry/api-logs": "^0.223.0",
94
+ "@opentelemetry/exporter-logs-otlp-http": "^0.223.0",
95
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.223.0",
96
+ "@opentelemetry/exporter-prometheus": "^0.223.0",
97
+ "@opentelemetry/exporter-trace-otlp-http": "^0.223.0",
98
+ "@opentelemetry/instrumentation-express": "^0.71.0",
99
+ "@opentelemetry/instrumentation-http": "^0.223.0",
100
+ "@opentelemetry/resources": "^2.12.0",
101
+ "@opentelemetry/sdk-logs": "^0.223.0",
102
+ "@opentelemetry/sdk-metrics": "^2.12.0",
103
+ "@opentelemetry/sdk-node": "^0.223.0",
104
+ "@opentelemetry/sdk-trace-node": "^2.12.0",
105
105
  "@opentelemetry/semantic-conventions": "^1.43.0",
106
106
  "cors": "^2.8.6",
107
- "dotenv": "^18.0.4",
108
- "fastmcp": "^4.22.1",
107
+ "dotenv": "^18.0.8",
108
+ "fastmcp": "^4.22.8",
109
109
  "jose": "6.2.12",
110
110
  "openapi3-ts": "^4.6.1",
111
- "pino": "^10.3.1",
111
+ "pino": "^10.4.0",
112
112
  "pino-http": "^11.0.0",
113
- "pino-pretty": "^13.1.3",
114
- "redis": "^6.2.1",
115
- "uuid": "^14.0.2",
116
- "zod": "^4.6.5",
117
- "@forklaunch/common": "^1.2.29",
118
- "@forklaunch/validator": "^1.2.30"
113
+ "pino-pretty": "^13.2.0",
114
+ "redis": "^6.3.0",
115
+ "uuid": "^14.0.3",
116
+ "zod": "^4.6.7",
117
+ "@forklaunch/common": "^1.2.31",
118
+ "@forklaunch/validator": "^1.2.32"
119
119
  },
120
120
  "devDependencies": {
121
121
  "@eslint/js": "^10.0.1",
122
- "@mikro-orm/libsql": "7.2.2",
123
- "@scalar/express-api-reference": "^0.10.24",
122
+ "@mikro-orm/libsql": "7.2.5",
123
+ "@scalar/express-api-reference": "^0.10.29",
124
124
  "@types/cors": "^2.8.19",
125
125
  "@types/jest": "^30.0.0",
126
126
  "@types/qs": "^6.15.1",
127
127
  "@types/uuid": "^11.0.0",
128
- "globals": "^17.12.0",
128
+ "globals": "^17.13.0",
129
129
  "jest": "^30.5.2",
130
130
  "jose": "6.1.3",
131
- "prettier": "^3.9.9",
132
- "stripe": "^22.6.2",
133
- "testcontainers": "^12.2.0",
131
+ "prettier": "^3.9.10",
132
+ "stripe": "^23.0.0",
133
+ "testcontainers": "^12.2.1",
134
134
  "ts-jest": "^29.4.14",
135
135
  "ts-node": "^10.9.2",
136
- "tsup": "^8.5.1",
136
+ "tsup": "^9.0.0",
137
137
  "typedoc": "^0.28.20",
138
138
  "typescript": "^7.0.2",
139
- "typescript-eslint": "^8.71.0"
139
+ "typescript-eslint": "^8.71.2"
140
140
  },
141
141
  "peerDependencies": {
142
142
  "stripe": "^22.0.0"