stitchkit 0.122.2 → 0.123.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/CHANGELOG.md +80 -0
- package/dist/browser/client.d.ts.map +1 -1
- package/dist/browser/contract-identity.d.ts +21 -0
- package/dist/browser/contract-identity.d.ts.map +1 -0
- package/dist/browser/unknown-operation.d.ts +3 -0
- package/dist/browser/unknown-operation.d.ts.map +1 -0
- package/dist/contract/define.d.ts +6 -2
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/endpoint-capabilities.d.ts.map +1 -1
- package/dist/contract/errors.d.ts +4 -0
- package/dist/contract/errors.d.ts.map +1 -1
- package/dist/contract/fingerprint.d.ts +51 -0
- package/dist/contract/fingerprint.d.ts.map +1 -0
- package/dist/contract/identity.d.ts +21 -0
- package/dist/contract/identity.d.ts.map +1 -0
- package/dist/contract/stream.d.ts +32 -0
- package/dist/contract/stream.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/browser.js +2 -2
- package/dist/entrypoints/agent-runtime/coding-tools.js +11 -11
- package/dist/entrypoints/agent-runtime/harness.js +12 -12
- package/dist/entrypoints/agent-runtime/openrouter.js +1 -1
- package/dist/entrypoints/agent-runtime/realtime.js +2 -2
- package/dist/entrypoints/agent-runtime/sandbox.js +11 -11
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +15 -15
- package/dist/entrypoints/agent-runtime/sqlite/node.js +15 -15
- package/dist/entrypoints/agent-runtime/testing.js +15 -15
- package/dist/entrypoints/agent-runtime.js +22 -22
- package/dist/entrypoints/application/diagnostic-journal.js +5 -5
- package/dist/entrypoints/application/directory-inbox.js +5 -5
- package/dist/entrypoints/application/grammy.js +1 -1
- package/dist/entrypoints/application.js +7 -7
- package/dist/entrypoints/cli/publish.js +5 -5
- package/dist/entrypoints/cli.d.ts +1 -1
- package/dist/entrypoints/cli.d.ts.map +1 -1
- package/dist/entrypoints/cli.js +20 -17
- package/dist/entrypoints/contract.d.ts +2 -0
- package/dist/entrypoints/contract.d.ts.map +1 -1
- package/dist/entrypoints/contract.js +11 -5
- package/dist/entrypoints/files/packaging.d.ts +1 -0
- package/dist/entrypoints/files/packaging.d.ts.map +1 -1
- package/dist/entrypoints/files/packaging.js +230 -61
- package/dist/entrypoints/files.js +5 -5
- package/dist/entrypoints/geo.js +3 -3
- package/dist/entrypoints/http.js +3 -3
- package/dist/entrypoints/index.d.ts +1 -0
- package/dist/entrypoints/index.d.ts.map +1 -1
- package/dist/entrypoints/index.js +45 -24
- package/dist/entrypoints/live.js +2 -2
- package/dist/entrypoints/node.js +11 -11
- package/dist/entrypoints/observability.js +4 -4
- package/dist/entrypoints/primitives.js +1 -1
- package/dist/entrypoints/process/owner-loss.js +2 -2
- package/dist/entrypoints/process.d.ts +6 -1
- package/dist/entrypoints/process.d.ts.map +1 -1
- package/dist/entrypoints/process.js +370 -9
- package/dist/entrypoints/react.js +2 -2
- package/dist/entrypoints/realtime.js +3 -3
- package/dist/entrypoints/remote.js +20 -10
- package/dist/entrypoints/server.d.ts +1 -0
- package/dist/entrypoints/server.d.ts.map +1 -1
- package/dist/entrypoints/server.js +56 -20
- package/dist/entrypoints/telegram/screens.js +4 -4
- package/dist/entrypoints/telegram.js +6 -6
- package/dist/entrypoints/testing.js +10 -10
- package/dist/entrypoints/tools/agent.js +9 -9
- package/dist/entrypoints/tools/connections.js +7 -7
- package/dist/entrypoints/tools/contract.js +1 -1
- package/dist/entrypoints/tools/invoker.js +7 -7
- package/dist/entrypoints/tools/mcp.js +9 -9
- package/dist/entrypoints/tools/toolkit.js +15 -14
- package/dist/entrypoints/tools.js +17 -17
- package/dist/entrypoints/tracking/contract.js +2 -2
- package/dist/entrypoints/tracking.js +1 -1
- package/dist/files/client-artifact.d.ts +75 -0
- package/dist/files/client-artifact.d.ts.map +1 -0
- package/dist/{index-am1h8c9v.js → index-0d3sm0m9.js} +5 -5
- package/dist/{index-72xtvcvr.js → index-0ndz5r8z.js} +1 -1
- package/dist/index-0v9xb8pz.js +66 -0
- package/dist/{index-qcn84byh.js → index-0w0hxp7n.js} +4 -0
- package/dist/{index-3za04re9.js → index-1c945ten.js} +1 -1
- package/dist/{index-r6v4mc67.js → index-1d7s7da0.js} +1 -1
- package/dist/{index-zsvzhjtk.js → index-20hn8pbh.js} +1 -1
- package/dist/{index-f6pw75e1.js → index-2x2ch0bt.js} +2 -2
- package/dist/{index-61hve0ez.js → index-303qne11.js} +1 -1
- package/dist/{index-g149e9pk.js → index-3bzk2645.js} +1 -1
- package/dist/index-45dyex0j.js +119 -0
- package/dist/{index-nwm3ww60.js → index-64b2dxqz.js} +1 -1
- package/dist/{index-aqwg2dm5.js → index-6k47xdtt.js} +2 -2
- package/dist/index-7q05ag0z.js +10 -0
- package/dist/{index-kz9734jc.js → index-96yjwwgf.js} +6 -5
- package/dist/{index-ff39f9dr.js → index-993vtv1w.js} +3 -3
- package/dist/{index-4jpykzvw.js → index-99nnsz39.js} +2 -2
- package/dist/{index-pfvde2fz.js → index-9ypczvpj.js} +1 -1
- package/dist/{index-qch1vcaa.js → index-a7ebd769.js} +2 -2
- package/dist/{index-98hv3sba.js → index-aw6kx2e6.js} +1 -1
- package/dist/{index-yj6saztf.js → index-bz9cmnqq.js} +96 -14
- package/dist/{index-mtwh9hyp.js → index-cjzaj7ev.js} +1 -1
- package/dist/{index-gtx3eknx.js → index-dv7pa9w6.js} +2 -2
- package/dist/{index-sa99p98w.js → index-eabx6qjh.js} +3 -3
- package/dist/{index-8yxgcyt6.js → index-egg0yp2j.js} +1 -1
- package/dist/{index-h1j71dr1.js → index-enkc9pem.js} +1 -1
- package/dist/{index-aqmadanx.js → index-fa53vygr.js} +2 -2
- package/dist/{index-e6c2spsd.js → index-fpwbskp2.js} +1 -1
- package/dist/{index-m8a44e64.js → index-ftk3838x.js} +1 -1
- package/dist/{index-j95jp7ee.js → index-gdqawggb.js} +1 -1
- package/dist/{index-9dyd8xzf.js → index-hkw233vx.js} +2 -2
- package/dist/{index-9jfdm5tg.js → index-hkxgennw.js} +7 -1
- package/dist/{index-qaqxdbxf.js → index-j8rda9n6.js} +7 -7
- package/dist/{index-4tyt1qya.js → index-jc5xgkpk.js} +2 -2
- package/dist/{index-s9a0fjh3.js → index-kffm4r8w.js} +1 -1
- package/dist/{index-5w6t91ze.js → index-m8ddk770.js} +1 -1
- package/dist/{index-2fc1k9k2.js → index-mdyhr36s.js} +32 -122
- package/dist/{index-r7a7r7ha.js → index-mfntvj58.js} +6 -3
- package/dist/{index-gq3fnq3f.js → index-n90tkkcv.js} +2 -2
- package/dist/{index-k42ckyzx.js → index-ndjzbt2v.js} +2 -2
- package/dist/{index-ycqhyars.js → index-qc7tq0za.js} +3 -3
- package/dist/{index-9frf01t9.js → index-r0xr7y4m.js} +1 -1
- package/dist/{index-s3yxw6kt.js → index-s512scra.js} +9 -7
- package/dist/{index-1h2zv8rx.js → index-sqc6ezrb.js} +41 -1
- package/dist/{index-2bqf0a74.js → index-sqkttz7z.js} +1 -1
- package/dist/{index-rbzq0q16.js → index-t8jz0e20.js} +1 -1
- package/dist/{index-8ryydawp.js → index-tt3ej8r3.js} +1 -1
- package/dist/{index-x4p3kw1p.js → index-tynna0n4.js} +6 -6
- package/dist/{index-72r9k0av.js → index-v62cpkx3.js} +1 -1
- package/dist/{index-10rg78vf.js → index-v8xm2s9v.js} +2 -2
- package/dist/{index-y6ye582c.js → index-w0wy05gr.js} +10 -10
- package/dist/{index-kw1ws0cs.js → index-w3nv6kr8.js} +1 -1
- package/dist/{index-eeahxwvg.js → index-ww3gss55.js} +1 -1
- package/dist/{index-6j15ktag.js → index-wzqd6pen.js} +1 -1
- package/dist/{index-aswegq1r.js → index-xjb131sc.js} +367 -131
- package/dist/{index-1fyea34p.js → index-yebkpytc.js} +5 -5
- package/dist/{index-bgcwxhxh.js → index-yfpt7sxr.js} +24 -46
- package/dist/{index-69t14s4a.js → index-yt1gg11x.js} +3 -2
- package/dist/{index-jk29rwkr.js → index-zfncctjp.js} +1 -1
- package/dist/internal/stable-digest.d.ts +5 -0
- package/dist/internal/stable-digest.d.ts.map +1 -1
- package/dist/internal/typed.d.ts +2 -0
- package/dist/internal/typed.d.ts.map +1 -1
- package/dist/process/operation-child.d.ts +38 -0
- package/dist/process/operation-child.d.ts.map +1 -0
- package/dist/process/operation-wire.d.ts +68 -0
- package/dist/process/operation-wire.d.ts.map +1 -0
- package/dist/process/operation.d.ts +74 -0
- package/dist/process/operation.d.ts.map +1 -0
- package/dist/server/contract-identity.d.ts +10 -0
- package/dist/server/contract-identity.d.ts.map +1 -0
- package/dist/server/contract-stream.d.ts.map +1 -1
- package/dist/server/endpoint-response.d.ts.map +1 -1
- package/dist/server/error-hook.d.ts +1 -0
- package/dist/server/error-hook.d.ts.map +1 -1
- package/dist/tools/cli/args-route.d.ts.map +1 -1
- package/dist/tools/cli/args-tokens.d.ts.map +1 -1
- package/dist/tools/cli/command.d.ts +39 -18
- package/dist/tools/cli/command.d.ts.map +1 -1
- package/dist/tools/cli/format.d.ts.map +1 -1
- package/dist/tools/cli/help.d.ts.map +1 -1
- package/dist/tools/cli/invoke.d.ts +3 -1
- package/dist/tools/cli/invoke.d.ts.map +1 -1
- package/dist/tools/cli/io.d.ts +6 -0
- package/dist/tools/cli/io.d.ts.map +1 -1
- package/dist/tools/cli/managed-surface.d.ts +2 -0
- package/dist/tools/cli/managed-surface.d.ts.map +1 -1
- package/dist/tools/cli/policy.d.ts +14 -0
- package/dist/tools/cli/policy.d.ts.map +1 -1
- package/dist/tools/cli/run-managed.d.ts.map +1 -1
- package/dist/tools/cli/run-native.d.ts.map +1 -1
- package/dist/tools/cli/run-stream.d.ts +23 -0
- package/dist/tools/cli/run-stream.d.ts.map +1 -0
- package/dist/tools/cli/session.d.ts +8 -0
- package/dist/tools/cli/session.d.ts.map +1 -1
- package/dist/tools/cli/stream-surface.d.ts +17 -0
- package/dist/tools/cli/stream-surface.d.ts.map +1 -0
- package/dist/tools/execute.d.ts +7 -1
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/invoker.d.ts.map +1 -1
- package/dist/tools/remote.d.ts.map +1 -1
- package/llms/cli.2.txt +56 -1
- package/llms/cli.txt +68 -1
- package/llms/contract.txt +4 -1
- package/llms/files-packaging.txt +10 -0
- package/llms/process.2.txt +75 -1
- package/llms/process.txt +59 -25
- package/llms/server.4.txt +8 -4
- package/llms/server.5.txt +1 -0
- package/llms/stitchkit.2.txt +74 -0
- package/llms/stitchkit.txt +5 -5
- package/llms/tools.txt +1 -1
- package/llms/{upgrading-0.106.0-0.122.0.txt → upgrading-0.106.0-0.123.0.txt} +50 -3
- package/llms/upgrading.txt +1 -1
- package/llms-full.txt +379 -13
- package/llms.txt +7 -7
- package/package.json +1 -1
- package/dist/index-h2fhjqy7.js +0 -19
- package/dist/index-m5m9rmvt.js +0 -44
|
@@ -1,32 +1,199 @@
|
|
|
1
|
+
import"../../index-0ndz5r8z.js";
|
|
2
|
+
import"../../index-gdqawggb.js";
|
|
1
3
|
import {
|
|
2
4
|
NATIVE_NOT_PACKAGED
|
|
3
|
-
} from "../../index-
|
|
5
|
+
} from "../../index-sqc6ezrb.js";
|
|
6
|
+
import {
|
|
7
|
+
runNativeCommand2
|
|
8
|
+
} from "../../index-7q05ag0z.js";
|
|
9
|
+
import {
|
|
10
|
+
safeJsonParse
|
|
11
|
+
} from "../../index-zsarb5xp.js";
|
|
4
12
|
|
|
5
|
-
// src/files/
|
|
13
|
+
// src/files/client-artifact.ts
|
|
6
14
|
import { createHash } from "node:crypto";
|
|
15
|
+
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
16
|
+
import { tmpdir } from "node:os";
|
|
17
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
7
18
|
import { z } from "zod";
|
|
8
|
-
|
|
9
|
-
|
|
19
|
+
class ForbiddenModuleError extends Error {
|
|
20
|
+
module;
|
|
21
|
+
importedBy;
|
|
22
|
+
constructor(module, importedBy) {
|
|
23
|
+
super(`Client artifact contains forbidden module "${module}"` + (importedBy === undefined ? "" : ` (imported by "${importedBy}")`));
|
|
24
|
+
this.module = module;
|
|
25
|
+
this.importedBy = importedBy;
|
|
26
|
+
this.name = "ForbiddenModuleError";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
var MetafileSchema = z.object({
|
|
30
|
+
inputs: z.record(z.string(), z.object({
|
|
31
|
+
imports: z.array(z.object({ path: z.string(), original: z.string().optional() })).default([])
|
|
32
|
+
}))
|
|
33
|
+
});
|
|
34
|
+
function matches(rule, modulePath) {
|
|
35
|
+
if (rule instanceof RegExp)
|
|
36
|
+
return rule.test(modulePath);
|
|
37
|
+
if (rule.startsWith("@") || !rule.includes("/")) {
|
|
38
|
+
return modulePath.includes(`/node_modules/${rule}/`);
|
|
39
|
+
}
|
|
40
|
+
return modulePath.includes(rule.startsWith("/") ? rule : `/${rule}`);
|
|
41
|
+
}
|
|
42
|
+
function absoluteModules(metafile, root) {
|
|
43
|
+
const absolute = (path) => resolve(root, path).replaceAll("\\", "/");
|
|
44
|
+
return {
|
|
45
|
+
inputs: Object.fromEntries(Object.entries(metafile.inputs).map(([path, input]) => [
|
|
46
|
+
absolute(path),
|
|
47
|
+
{
|
|
48
|
+
imports: input.imports.map((imported) => ({
|
|
49
|
+
path: absolute(imported.path),
|
|
50
|
+
original: imported.original
|
|
51
|
+
}))
|
|
52
|
+
}
|
|
53
|
+
]))
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function namesPackage(specifier, rule) {
|
|
57
|
+
return typeof rule === "string" && specifier !== undefined && (specifier === rule || specifier.startsWith(`${rule}/`));
|
|
58
|
+
}
|
|
59
|
+
function refuseForbidden(metafile, forbidden) {
|
|
60
|
+
for (const [importer, input] of Object.entries(metafile.inputs)) {
|
|
61
|
+
const named = input.imports.find((imported) => forbidden.some((rule) => namesPackage(imported.original, rule)));
|
|
62
|
+
if (named)
|
|
63
|
+
throw new ForbiddenModuleError(named.path, importer);
|
|
64
|
+
}
|
|
65
|
+
for (const modulePath of Object.keys(metafile.inputs)) {
|
|
66
|
+
if (!forbidden.some((rule) => matches(rule, modulePath)))
|
|
67
|
+
continue;
|
|
68
|
+
const importer = Object.entries(metafile.inputs).find(([, input]) => input.imports.some((imported) => imported.path === modulePath));
|
|
69
|
+
throw new ForbiddenModuleError(modulePath, importer?.[0]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async function bun(step, args, cwd, what) {
|
|
73
|
+
const result = await runNativeCommand2({
|
|
74
|
+
executable: step.bun,
|
|
75
|
+
args,
|
|
76
|
+
cwd,
|
|
77
|
+
envPolicy: "ambient",
|
|
78
|
+
capture: true,
|
|
79
|
+
maxOutputBytes: 4 * 1024 * 1024,
|
|
80
|
+
timeoutMs: step.timeoutMs,
|
|
81
|
+
signal: step.signal
|
|
82
|
+
});
|
|
83
|
+
const decoder = new TextDecoder;
|
|
84
|
+
if (result.exitCode !== 0) {
|
|
85
|
+
throw new Error(`Client artifact ${what} failed (exit ${result.exitCode ?? result.signal}): ` + `${decoder.decode(result.stderr)}${decoder.decode(result.stdout)}`.trim());
|
|
86
|
+
}
|
|
87
|
+
return decoder.decode(result.stdout);
|
|
88
|
+
}
|
|
89
|
+
async function buildClientArtifact(options) {
|
|
90
|
+
const step = {
|
|
91
|
+
bun: options.executable ?? "bun",
|
|
92
|
+
timeoutMs: options.timeoutMs ?? 120000,
|
|
93
|
+
signal: options.signal
|
|
94
|
+
};
|
|
95
|
+
const file = resolve(options.outFile);
|
|
96
|
+
const sha256File = `${file}.sha256`;
|
|
97
|
+
const work = await mkdtemp(join(tmpdir(), "stitchkit-client-artifact-"));
|
|
98
|
+
try {
|
|
99
|
+
await rm(file, { force: true });
|
|
100
|
+
await rm(sha256File, { force: true });
|
|
101
|
+
const root = dirname(resolve(options.entry));
|
|
102
|
+
const built = join(work, "client.js");
|
|
103
|
+
const metafilePath = join(work, "meta.json");
|
|
104
|
+
await bun(step, [
|
|
105
|
+
"build",
|
|
106
|
+
resolve(options.entry),
|
|
107
|
+
`--target=${options.runtime ?? "node"}`,
|
|
108
|
+
"--format=esm",
|
|
109
|
+
`--outfile=${built}`,
|
|
110
|
+
`--metafile=${metafilePath}`
|
|
111
|
+
], root, "build");
|
|
112
|
+
const metafile = absoluteModules(MetafileSchema.parse(safeJsonParse(await readFile(metafilePath, "utf8"))), root);
|
|
113
|
+
refuseForbidden(metafile, options.forbiddenModules ?? []);
|
|
114
|
+
const bytes = await readFile(built);
|
|
115
|
+
const digest = createHash("sha256").update(bytes).digest("hex");
|
|
116
|
+
await mkdir(dirname(file), { recursive: true });
|
|
117
|
+
await writeFile(file, bytes);
|
|
118
|
+
await writeFile(sha256File, `${digest} ${basename(file)}
|
|
119
|
+
`);
|
|
120
|
+
const artifact = {
|
|
121
|
+
file,
|
|
122
|
+
sha256: digest,
|
|
123
|
+
bytes: bytes.byteLength,
|
|
124
|
+
sha256File,
|
|
125
|
+
modules: Object.keys(metafile.inputs).sort()
|
|
126
|
+
};
|
|
127
|
+
if (options.package === undefined)
|
|
128
|
+
return artifact;
|
|
129
|
+
try {
|
|
130
|
+
return { ...artifact, package: await packAndVerify(step, work, bytes, options.package) };
|
|
131
|
+
} catch (error) {
|
|
132
|
+
await rm(file, { force: true });
|
|
133
|
+
await rm(sha256File, { force: true });
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
} finally {
|
|
137
|
+
await rm(work, { recursive: true, force: true });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async function packAndVerify(step, work, bytes, target) {
|
|
141
|
+
const source = join(work, "package");
|
|
142
|
+
await mkdir(source);
|
|
143
|
+
await writeFile(join(source, "index.js"), bytes);
|
|
144
|
+
await writeFile(join(source, "package.json"), `${JSON.stringify({
|
|
145
|
+
name: target.name,
|
|
146
|
+
version: target.version,
|
|
147
|
+
type: "module",
|
|
148
|
+
main: "./index.js",
|
|
149
|
+
exports: { ".": "./index.js" },
|
|
150
|
+
files: ["index.js"]
|
|
151
|
+
}, null, 2)}
|
|
152
|
+
`);
|
|
153
|
+
const outDir = resolve(target.outDir);
|
|
154
|
+
await mkdir(outDir, { recursive: true });
|
|
155
|
+
const tarball = join(outDir, `${target.name.replace(/^@/, "").replaceAll("/", "-")}-${target.version}.tgz`);
|
|
156
|
+
await bun(step, ["pm", "pack", "--filename", tarball, "--quiet"], source, "pack");
|
|
157
|
+
const consumer = join(work, "consumer");
|
|
158
|
+
await mkdir(consumer);
|
|
159
|
+
await writeFile(join(consumer, "package.json"), `{"name":"client-artifact-consumer","private":true,"type":"module"}
|
|
160
|
+
`);
|
|
161
|
+
await bun(step, ["add", tarball], consumer, "install");
|
|
162
|
+
await writeFile(join(consumer, "verify.mjs"), `const client = await import(${JSON.stringify(target.name)});
|
|
163
|
+
` + `const missing = ${JSON.stringify(target.exports ?? [])}.filter((name) => !(name in client));
|
|
164
|
+
` + `if (missing.length > 0) { console.error('missing exports: ' + missing.join(', ')); process.exit(1); }
|
|
165
|
+
`);
|
|
166
|
+
await bun(step, ["verify.mjs"], consumer, "import verification");
|
|
167
|
+
return {
|
|
168
|
+
tarball,
|
|
169
|
+
sha256: createHash("sha256").update(await readFile(tarball)).digest("hex")
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
// src/files/native-packaging-layout.ts
|
|
173
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
174
|
+
import { z as z2 } from "zod";
|
|
175
|
+
var RelativePathSchema = z2.string().min(1).refine((value) => !value.startsWith("/") && !/^[a-z]:/i.test(value) && !value.includes("\\") && value.split("/").every((part) => part !== ".." && part !== "." && part.length > 0), "Expected a relative path without traversal");
|
|
176
|
+
var NativeLayoutSchema = z2.strictObject({
|
|
10
177
|
loader: RelativePathSchema,
|
|
11
|
-
assets:
|
|
178
|
+
assets: z2.strictObject({ arm64: RelativePathSchema, x64: RelativePathSchema })
|
|
12
179
|
});
|
|
13
|
-
var NativeAssetEntrySchema =
|
|
180
|
+
var NativeAssetEntrySchema = z2.strictObject({
|
|
14
181
|
path: RelativePathSchema,
|
|
15
|
-
size:
|
|
16
|
-
sha256:
|
|
182
|
+
size: z2.int().nonnegative(),
|
|
183
|
+
sha256: z2.string().regex(/^[a-f0-9]{64}$/)
|
|
17
184
|
});
|
|
18
|
-
var NativeAssetManifestSchema =
|
|
19
|
-
formatVersion:
|
|
185
|
+
var NativeAssetManifestSchema = z2.strictObject({
|
|
186
|
+
formatVersion: z2.literal(2, {
|
|
20
187
|
error: "Native asset manifest formatVersion must be 2 for this Stitchkit"
|
|
21
188
|
}),
|
|
22
189
|
loader: RelativePathSchema,
|
|
23
|
-
assets:
|
|
190
|
+
assets: z2.strictObject({
|
|
24
191
|
arm64: NativeAssetEntrySchema.optional(),
|
|
25
192
|
x64: NativeAssetEntrySchema.optional()
|
|
26
193
|
})
|
|
27
194
|
});
|
|
28
195
|
function nativeAssetDigest(bytes) {
|
|
29
|
-
return { size: bytes.byteLength, sha256:
|
|
196
|
+
return { size: bytes.byteLength, sha256: createHash2("sha256").update(bytes).digest("hex") };
|
|
30
197
|
}
|
|
31
198
|
var LOADER_MARK = ["stitchkit", "native", "loader"].join("-");
|
|
32
199
|
function nativeLoaderMarker(state) {
|
|
@@ -86,13 +253,13 @@ function inspectNativeArtifact(bytes) {
|
|
|
86
253
|
}
|
|
87
254
|
// src/files/native-packaging.ts
|
|
88
255
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
89
|
-
import { dirname, relative, resolve } from "node:path";
|
|
256
|
+
import { dirname as dirname2, relative, resolve as resolve2 } from "node:path";
|
|
90
257
|
import { fileURLToPath } from "node:url";
|
|
91
|
-
import { z as
|
|
258
|
+
import { z as z3 } from "zod";
|
|
92
259
|
|
|
93
260
|
// src/files/native-packaging-plugin.ts
|
|
94
261
|
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
95
|
-
import { basename, join } from "node:path";
|
|
262
|
+
import { basename as basename2, join as join2 } from "node:path";
|
|
96
263
|
var realpath = (path) => {
|
|
97
264
|
try {
|
|
98
265
|
return realpathSync(path);
|
|
@@ -105,7 +272,7 @@ function loaderInstallation(path, loaderName) {
|
|
|
105
272
|
if (!path.endsWith(suffix))
|
|
106
273
|
return;
|
|
107
274
|
const root = path.slice(0, -suffix.length);
|
|
108
|
-
const manifest =
|
|
275
|
+
const manifest = join2(root, "package.json");
|
|
109
276
|
if (!existsSync(manifest))
|
|
110
277
|
return;
|
|
111
278
|
try {
|
|
@@ -125,7 +292,7 @@ function nativePlugin(owner, specifiers, embedded, companionEntry) {
|
|
|
125
292
|
const contents = nativeLoaderSource(specifiers, "static");
|
|
126
293
|
const external = new Set(Object.values(specifiers));
|
|
127
294
|
const ownLoader = realpath(owner.loaderPath);
|
|
128
|
-
const loaderFile =
|
|
295
|
+
const loaderFile = basename2(owner.loaderName);
|
|
129
296
|
return {
|
|
130
297
|
name: "stitchkit-native-packaging",
|
|
131
298
|
setup(build) {
|
|
@@ -142,7 +309,7 @@ function nativePlugin(owner, specifiers, embedded, companionEntry) {
|
|
|
142
309
|
build.onLoad({ filter: /\.[cm]?js$/ }, (args) => {
|
|
143
310
|
if (args.path === owner.loaderPath)
|
|
144
311
|
return { contents, loader: "js" };
|
|
145
|
-
if (
|
|
312
|
+
if (basename2(args.path) !== loaderFile)
|
|
146
313
|
return;
|
|
147
314
|
if (realpath(args.path) === ownLoader)
|
|
148
315
|
return { contents, loader: "js" };
|
|
@@ -163,12 +330,12 @@ function nativePlugin(owner, specifiers, embedded, companionEntry) {
|
|
|
163
330
|
}
|
|
164
331
|
|
|
165
332
|
// src/files/native-packaging.ts
|
|
166
|
-
var PackageManifestSchema =
|
|
167
|
-
name:
|
|
168
|
-
version:
|
|
333
|
+
var PackageManifestSchema = z3.object({
|
|
334
|
+
name: z3.literal("stitchkit"),
|
|
335
|
+
version: z3.string().min(1)
|
|
169
336
|
});
|
|
170
|
-
var ArchitectureSchema =
|
|
171
|
-
var PlatformSchema =
|
|
337
|
+
var ArchitectureSchema = z3.enum(["arm64", "x64"]);
|
|
338
|
+
var PlatformSchema = z3.enum(["darwin"]);
|
|
172
339
|
var CommonOptions = {
|
|
173
340
|
platform: PlatformSchema,
|
|
174
341
|
entryPath: RelativePathSchema.refine((value) => !value.includes("[") && !value.includes("]"), "Expected a fixed entry path without Bun naming templates")
|
|
@@ -176,24 +343,24 @@ var CommonOptions = {
|
|
|
176
343
|
var ASSET_HASH_TOKEN = "[hash]";
|
|
177
344
|
var ASSET_HASH_LENGTH = 16;
|
|
178
345
|
var AssetPathSchema = RelativePathSchema.refine((value) => !/[[\]]/.test(value.replaceAll(ASSET_HASH_TOKEN, "")), "Expected an addon path whose only template is [hash]");
|
|
179
|
-
var SingleOptionsSchema =
|
|
346
|
+
var SingleOptionsSchema = z3.object({
|
|
180
347
|
...CommonOptions,
|
|
181
|
-
architecture:
|
|
182
|
-
delivery:
|
|
348
|
+
architecture: z3.string().min(1),
|
|
349
|
+
delivery: z3.literal("companion"),
|
|
183
350
|
assetPath: AssetPathSchema
|
|
184
351
|
});
|
|
185
|
-
var EmbeddedOptionsSchema =
|
|
352
|
+
var EmbeddedOptionsSchema = z3.strictObject({
|
|
186
353
|
platform: PlatformSchema,
|
|
187
|
-
architecture:
|
|
188
|
-
delivery:
|
|
354
|
+
architecture: z3.string().min(1),
|
|
355
|
+
delivery: z3.literal("embedded")
|
|
189
356
|
});
|
|
190
|
-
var MultipleOptionsSchema =
|
|
357
|
+
var MultipleOptionsSchema = z3.object({
|
|
191
358
|
...CommonOptions,
|
|
192
|
-
architecture:
|
|
193
|
-
delivery:
|
|
194
|
-
assetPath:
|
|
359
|
+
architecture: z3.array(z3.string().min(1)).refine((targets) => targets.length > 0),
|
|
360
|
+
delivery: z3.literal("companion"),
|
|
361
|
+
assetPath: z3.record(z3.string().min(1), AssetPathSchema)
|
|
195
362
|
});
|
|
196
|
-
var CompanionOptionsSchema =
|
|
363
|
+
var CompanionOptionsSchema = z3.union([SingleOptionsSchema, MultipleOptionsSchema]).check((ctx) => {
|
|
197
364
|
const input = ctx.value;
|
|
198
365
|
const targets = typeof input.architecture === "string" ? [input.architecture] : input.architecture;
|
|
199
366
|
if (new Set(targets).size !== targets.length)
|
|
@@ -225,35 +392,35 @@ var CompanionOptionsSchema = z2.union([SingleOptionsSchema, MultipleOptionsSchem
|
|
|
225
392
|
}
|
|
226
393
|
}
|
|
227
394
|
});
|
|
228
|
-
var EmbeddedAssetSchema =
|
|
229
|
-
size:
|
|
230
|
-
sha256:
|
|
231
|
-
bytes:
|
|
395
|
+
var EmbeddedAssetSchema = z3.object({
|
|
396
|
+
size: z3.int().nonnegative(),
|
|
397
|
+
sha256: z3.string().regex(/^[a-f0-9]{64}$/),
|
|
398
|
+
bytes: z3.custom((value) => value instanceof Uint8Array)
|
|
232
399
|
});
|
|
233
|
-
var AssetSchema = EmbeddedAssetSchema.extend({ outputPath:
|
|
400
|
+
var AssetSchema = EmbeddedAssetSchema.extend({ outputPath: z3.string() });
|
|
234
401
|
var TargetAssetSchema = AssetSchema.extend({ architecture: ArchitectureSchema });
|
|
235
|
-
var DigestSchema =
|
|
236
|
-
size:
|
|
237
|
-
sha256:
|
|
402
|
+
var DigestSchema = z3.object({
|
|
403
|
+
size: z3.int().nonnegative(),
|
|
404
|
+
sha256: z3.string().regex(/^[a-f0-9]{64}$/)
|
|
238
405
|
});
|
|
239
|
-
var RefusalSchema =
|
|
240
|
-
|
|
241
|
-
state:
|
|
406
|
+
var RefusalSchema = z3.discriminatedUnion("state", [
|
|
407
|
+
z3.object({
|
|
408
|
+
state: z3.literal("unsupported"),
|
|
242
409
|
platform: PlatformSchema,
|
|
243
|
-
architecture:
|
|
244
|
-
code:
|
|
410
|
+
architecture: z3.string(),
|
|
411
|
+
code: z3.literal("NATIVE_TARGET_UNSUPPORTED")
|
|
245
412
|
}),
|
|
246
|
-
|
|
247
|
-
state:
|
|
413
|
+
z3.object({
|
|
414
|
+
state: z3.literal("missing"),
|
|
248
415
|
platform: PlatformSchema,
|
|
249
416
|
architecture: ArchitectureSchema,
|
|
250
|
-
code:
|
|
417
|
+
code: z3.literal("NATIVE_ASSET_MISSING")
|
|
251
418
|
}),
|
|
252
|
-
|
|
253
|
-
state:
|
|
419
|
+
z3.object({
|
|
420
|
+
state: z3.literal("mismatch"),
|
|
254
421
|
platform: PlatformSchema,
|
|
255
422
|
architecture: ArchitectureSchema,
|
|
256
|
-
code:
|
|
423
|
+
code: z3.literal("NATIVE_ASSET_DIGEST_MISMATCH"),
|
|
257
424
|
expected: DigestSchema,
|
|
258
425
|
actual: DigestSchema
|
|
259
426
|
})
|
|
@@ -281,11 +448,11 @@ function resolveTargets(platform, declared) {
|
|
|
281
448
|
return { targets };
|
|
282
449
|
}
|
|
283
450
|
function installedPackageRoot() {
|
|
284
|
-
let directory =
|
|
451
|
+
let directory = dirname2(fileURLToPath(import.meta.url));
|
|
285
452
|
for (let depth = 0;depth < 64; depth++) {
|
|
286
|
-
if (existsSync2(
|
|
453
|
+
if (existsSync2(resolve2(directory, "native-assets.json")))
|
|
287
454
|
return directory;
|
|
288
|
-
const parent =
|
|
455
|
+
const parent = dirname2(directory);
|
|
289
456
|
if (parent === directory)
|
|
290
457
|
break;
|
|
291
458
|
directory = parent;
|
|
@@ -298,7 +465,7 @@ function readVerifiedAsset(root, published, platform, architecture) {
|
|
|
298
465
|
};
|
|
299
466
|
if (!published)
|
|
300
467
|
return missing;
|
|
301
|
-
const sourcePath =
|
|
468
|
+
const sourcePath = resolve2(root, published.path);
|
|
302
469
|
let bytes;
|
|
303
470
|
try {
|
|
304
471
|
bytes = readFileSync2(sourcePath);
|
|
@@ -323,13 +490,13 @@ function readVerifiedAsset(root, published, platform, architecture) {
|
|
|
323
490
|
}
|
|
324
491
|
function installedPackage() {
|
|
325
492
|
const root = installedPackageRoot();
|
|
326
|
-
const published = NativeAssetManifestSchema.parse(JSON.parse(readFileSync2(
|
|
327
|
-
const manifest = PackageManifestSchema.parse(JSON.parse(readFileSync2(
|
|
493
|
+
const published = NativeAssetManifestSchema.parse(JSON.parse(readFileSync2(resolve2(root, "native-assets.json"), "utf8")));
|
|
494
|
+
const manifest = PackageManifestSchema.parse(JSON.parse(readFileSync2(resolve2(root, "package.json"), "utf8")));
|
|
328
495
|
return {
|
|
329
496
|
root,
|
|
330
497
|
published,
|
|
331
498
|
version: manifest.version,
|
|
332
|
-
loaderPath:
|
|
499
|
+
loaderPath: resolve2(root, published.loader),
|
|
333
500
|
loaderName: published.loader
|
|
334
501
|
};
|
|
335
502
|
}
|
|
@@ -372,7 +539,7 @@ function packageCompanion(input) {
|
|
|
372
539
|
const outputPath = template.replaceAll(ASSET_HASH_TOKEN, sha256.slice(0, ASSET_HASH_LENGTH));
|
|
373
540
|
if (assets.some((asset) => asset.outputPath === outputPath))
|
|
374
541
|
throw new Error("Addons must have distinct output paths");
|
|
375
|
-
const specifier = relative(
|
|
542
|
+
const specifier = relative(dirname2(input.entryPath), outputPath).split("\\").join("/");
|
|
376
543
|
specifiers[architecture] = specifier.startsWith(".") ? specifier : `./${specifier}`;
|
|
377
544
|
const asset = { outputPath, size, sha256, bytes };
|
|
378
545
|
assets.push(typeof input.architecture === "string" ? asset : { ...asset, architecture });
|
|
@@ -390,6 +557,8 @@ function createNativePackaging(options) {
|
|
|
390
557
|
return options.delivery === "embedded" ? embedNative(EmbeddedOptionsSchema.parse(options)) : packageCompanion(CompanionOptionsSchema.parse(options));
|
|
391
558
|
}
|
|
392
559
|
export {
|
|
560
|
+
ForbiddenModuleError,
|
|
561
|
+
buildClientArtifact,
|
|
393
562
|
createNativePackaging,
|
|
394
563
|
inspectNativeArtifact
|
|
395
564
|
};
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
ManagedFilePathSchema2,
|
|
3
3
|
ManagedFileRefSchema2
|
|
4
4
|
} from "../index-xqhede6x.js";
|
|
5
|
-
import"../index-
|
|
6
|
-
import"../index-
|
|
7
|
-
import"../index-
|
|
5
|
+
import"../index-sqc6ezrb.js";
|
|
6
|
+
import"../index-n90tkkcv.js";
|
|
7
|
+
import"../index-dv7pa9w6.js";
|
|
8
8
|
import {
|
|
9
9
|
ExclusiveLockError2,
|
|
10
10
|
withExclusiveLock2
|
|
11
|
-
} from "../index-
|
|
11
|
+
} from "../index-64b2dxqz.js";
|
|
12
12
|
import {
|
|
13
13
|
ManagedFileError2,
|
|
14
14
|
createManagedFileBoundary2
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
} from "../index-jj9228tt.js";
|
|
31
31
|
import {
|
|
32
32
|
AppError2
|
|
33
|
-
} from "../index-
|
|
33
|
+
} from "../index-0w0hxp7n.js";
|
|
34
34
|
// src/files/chunk-spool.ts
|
|
35
35
|
import { createHash } from "node:crypto";
|
|
36
36
|
import {
|
package/dist/entrypoints/geo.js
CHANGED
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
} from "../index-d3xdyjt6.js";
|
|
5
5
|
import {
|
|
6
6
|
messageOf
|
|
7
|
-
} from "../index-
|
|
7
|
+
} from "../index-3bzk2645.js";
|
|
8
8
|
import {
|
|
9
9
|
isPublicIp2
|
|
10
|
-
} from "../index-
|
|
10
|
+
} from "../index-w3nv6kr8.js";
|
|
11
11
|
import {
|
|
12
12
|
isRecord
|
|
13
|
-
} from "../index-
|
|
13
|
+
} from "../index-hkxgennw.js";
|
|
14
14
|
|
|
15
15
|
// src/geo/maxmind.ts
|
|
16
16
|
import { realpath, stat } from "node:fs/promises";
|
package/dist/entrypoints/http.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import"../index-m38ej7e5.js";
|
|
2
|
-
import"../index-
|
|
2
|
+
import"../index-0v9xb8pz.js";
|
|
3
3
|
import {
|
|
4
4
|
createHttpClient2
|
|
5
|
-
} from "../index-
|
|
5
|
+
} from "../index-r0xr7y4m.js";
|
|
6
6
|
import {
|
|
7
7
|
uploadInChunks2
|
|
8
8
|
} from "../index-hqsbtvta.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
createUrlBuilder2,
|
|
15
15
|
createUrlBuilders2,
|
|
16
16
|
createScopedUrlBuilders2
|
|
17
|
-
} from "../index-
|
|
17
|
+
} from "../index-mdyhr36s.js";
|
|
18
18
|
import {
|
|
19
19
|
ApiError2
|
|
20
20
|
} from "../index-kfjkb396.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ApiError } from '../browser/api-error.js';
|
|
2
2
|
export { type ChunkedUploadConfig, type ChunkedUploadPart, type ChunkedUploadProgress, type ChunkedUploadStart, type ChunkSource, uploadInChunks, } from '../browser/chunked-upload.js';
|
|
3
3
|
export { type ClientConfig, type ClientContract, type ClientFetch, type ClientRegistryValue, type ContractClientConfig, contractEndpointMatchers, createClient, createClients, createScopedClients, createScopedUrlBuilders, createUrlBuilder, createUrlBuilders, type PathPrefixArgs, type RegistryScope, type ScopeClientConfigs, type ScopedClientRegistry, type ScopedUrlBuilderRegistry, type UrlBuilderConfig, } from '../browser/client.js';
|
|
4
|
+
export { type ContractIdentity, readContractIdentity } from '../browser/contract-identity.js';
|
|
4
5
|
export { type ApiEvent, type ApiEventListener, type ConfiguredHttpClient, createHttpClient, type HeaderProvider, type HttpClient, type HttpClientConfig, type RequestOptions, type UnauthorizedMatcher, } from '../browser/http.js';
|
|
5
6
|
export { createLiveStateController, type LiveStateController, type LiveStateControllerConfig, type LiveStateControllerError, type LiveStateControllerSnapshot, type LiveStateControllerStatus, LiveStateControllerStatusSchema, type LiveStateEventDecision, type LiveStatePhase, LiveStatePhaseSchema, type LiveStateSource, type LiveStateSourceOpenInput, type LiveStateSourceOpenResult, type LiveStateStopReason, LiveStateStopReasonSchema, type LiveStateSubscriberError, } from '../browser/live-state.js';
|
|
6
7
|
export type { BindRealtimeClientOptions, BoundRealtimeClient, RealtimeClientTransport, } from '../browser/realtime-client.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entrypoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD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;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -2,10 +2,28 @@ import"../index-m38ej7e5.js";
|
|
|
2
2
|
import {
|
|
3
3
|
DEFAULT_CONTRACT_STREAM_FRAME_BYTES2,
|
|
4
4
|
ContractStreamFrameSchema2
|
|
5
|
-
} from "../index-
|
|
5
|
+
} from "../index-0v9xb8pz.js";
|
|
6
6
|
import {
|
|
7
7
|
createHttpClient2
|
|
8
|
-
} from "../index-
|
|
8
|
+
} from "../index-r0xr7y4m.js";
|
|
9
|
+
import {
|
|
10
|
+
ContractFingerprintSchema2,
|
|
11
|
+
contractFingerprint2,
|
|
12
|
+
contractIdentityContract2,
|
|
13
|
+
defineErrors2,
|
|
14
|
+
createContractFactory2,
|
|
15
|
+
paginatedSchema2,
|
|
16
|
+
encodeCursor2,
|
|
17
|
+
decodeCursor2
|
|
18
|
+
} from "../index-bz9cmnqq.js";
|
|
19
|
+
import {
|
|
20
|
+
ALL_TRANSPORTS2,
|
|
21
|
+
TOOL_TRANSPORTS2
|
|
22
|
+
} from "../index-yt1gg11x.js";
|
|
23
|
+
import {
|
|
24
|
+
withToolView2,
|
|
25
|
+
defineContract2
|
|
26
|
+
} from "../index-99nnsz39.js";
|
|
9
27
|
import"../index-w0eqdhyd.js";
|
|
10
28
|
import {
|
|
11
29
|
LiveStatePhaseSchema2,
|
|
@@ -16,7 +34,7 @@ import {
|
|
|
16
34
|
import {
|
|
17
35
|
REALTIME_REJECTION_KEY2,
|
|
18
36
|
asRealtimeRejection2
|
|
19
|
-
} from "../index-
|
|
37
|
+
} from "../index-1c945ten.js";
|
|
20
38
|
import {
|
|
21
39
|
RealtimeRequestPhaseSchema2,
|
|
22
40
|
RealtimeRequestPhaseEventSchema2,
|
|
@@ -32,21 +50,6 @@ import {
|
|
|
32
50
|
import {
|
|
33
51
|
defineRealtimeContract2
|
|
34
52
|
} from "../index-814xpr6d.js";
|
|
35
|
-
import {
|
|
36
|
-
ALL_TRANSPORTS2,
|
|
37
|
-
TOOL_TRANSPORTS2
|
|
38
|
-
} from "../index-69t14s4a.js";
|
|
39
|
-
import {
|
|
40
|
-
withToolView2,
|
|
41
|
-
defineContract2
|
|
42
|
-
} from "../index-4jpykzvw.js";
|
|
43
|
-
import {
|
|
44
|
-
defineErrors2,
|
|
45
|
-
createContractFactory2,
|
|
46
|
-
paginatedSchema2,
|
|
47
|
-
encodeCursor2,
|
|
48
|
-
decodeCursor2
|
|
49
|
-
} from "../index-yj6saztf.js";
|
|
50
53
|
import {
|
|
51
54
|
ManagedFilePathSchema2,
|
|
52
55
|
ManagedFileRefSchema2
|
|
@@ -61,8 +64,6 @@ import {
|
|
|
61
64
|
uploadInChunks2
|
|
62
65
|
} from "../index-hqsbtvta.js";
|
|
63
66
|
import {
|
|
64
|
-
StreamLineLimitError2,
|
|
65
|
-
StreamTruncatedLineError2,
|
|
66
67
|
parseNDJSON2,
|
|
67
68
|
createNDJSONDecoder2,
|
|
68
69
|
parseSSE2,
|
|
@@ -73,15 +74,19 @@ import {
|
|
|
73
74
|
createUrlBuilder2,
|
|
74
75
|
createUrlBuilders2,
|
|
75
76
|
createScopedUrlBuilders2
|
|
76
|
-
} from "../index-
|
|
77
|
+
} from "../index-mdyhr36s.js";
|
|
78
|
+
import {
|
|
79
|
+
StreamLineLimitError2,
|
|
80
|
+
StreamTruncatedLineError2
|
|
81
|
+
} from "../index-45dyex0j.js";
|
|
77
82
|
import {
|
|
78
83
|
createRetainedTopics2,
|
|
79
84
|
createRealtimeClientWithPeer,
|
|
80
85
|
createSocketIOClientWithPeer
|
|
81
|
-
} from "../index-
|
|
86
|
+
} from "../index-ftk3838x.js";
|
|
82
87
|
import {
|
|
83
88
|
bindRealtimeClient2
|
|
84
|
-
} from "../index-
|
|
89
|
+
} from "../index-zfncctjp.js";
|
|
85
90
|
import {
|
|
86
91
|
ApiError2
|
|
87
92
|
} from "../index-kfjkb396.js";
|
|
@@ -107,13 +112,25 @@ import {
|
|
|
107
112
|
isRetryableStatus2,
|
|
108
113
|
isStitchErrorCode2,
|
|
109
114
|
appError2
|
|
110
|
-
} from "../index-
|
|
115
|
+
} from "../index-0w0hxp7n.js";
|
|
111
116
|
import {
|
|
112
117
|
createTraceContext2,
|
|
113
118
|
parseTraceparent2,
|
|
114
119
|
formatTraceparent2,
|
|
115
120
|
childSpan2
|
|
116
121
|
} from "../index-yex7eg1v.js";
|
|
122
|
+
// src/browser/contract-identity.ts
|
|
123
|
+
async function readContractIdentity(contracts, configOrClient) {
|
|
124
|
+
const client = contractFingerprint2(contracts);
|
|
125
|
+
const api = createClient2(contractIdentityContract2, configOrClient);
|
|
126
|
+
try {
|
|
127
|
+
return { client, server: await api.read() };
|
|
128
|
+
} catch (error) {
|
|
129
|
+
if (error instanceof ApiError2 && error.status === 404)
|
|
130
|
+
return { client, server: undefined };
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
117
134
|
// src/browser/resumable.ts
|
|
118
135
|
var DEFAULT_RETRY = { minDelayMs: 100, maxDelayMs: 30000, jitter: 0.5 };
|
|
119
136
|
async function* resumableIterator(config) {
|
|
@@ -365,6 +382,7 @@ export {
|
|
|
365
382
|
ApiError2 as ApiError,
|
|
366
383
|
AppError2 as AppError,
|
|
367
384
|
BackoffPolicySchema2 as BackoffPolicySchema,
|
|
385
|
+
ContractFingerprintSchema2 as ContractFingerprintSchema,
|
|
368
386
|
ContractStreamFrameSchema2 as ContractStreamFrameSchema,
|
|
369
387
|
DEFAULT_CONTRACT_STREAM_FRAME_BYTES2 as DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
|
|
370
388
|
LiveStateControllerStatusSchema2 as LiveStateControllerStatusSchema,
|
|
@@ -391,6 +409,8 @@ export {
|
|
|
391
409
|
childSpan2 as childSpan,
|
|
392
410
|
conflict2 as conflict,
|
|
393
411
|
contractEndpointMatchers2 as contractEndpointMatchers,
|
|
412
|
+
contractFingerprint2 as contractFingerprint,
|
|
413
|
+
contractIdentityContract2 as contractIdentityContract,
|
|
394
414
|
createBackoff2 as createBackoff,
|
|
395
415
|
createClient2 as createClient,
|
|
396
416
|
createClients2 as createClients,
|
|
@@ -425,6 +445,7 @@ export {
|
|
|
425
445
|
parseTraceparent2 as parseTraceparent,
|
|
426
446
|
rateLimited2 as rateLimited,
|
|
427
447
|
readBoundedBody2 as readBoundedBody,
|
|
448
|
+
readContractIdentity,
|
|
428
449
|
resumableIterator,
|
|
429
450
|
unauthorized2 as unauthorized,
|
|
430
451
|
uploadInChunks2 as uploadInChunks,
|
package/dist/entrypoints/live.js
CHANGED
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
WATCH_STATE2,
|
|
17
17
|
watchContract2,
|
|
18
18
|
watchKeyString2
|
|
19
|
-
} from "../index-
|
|
19
|
+
} from "../index-a7ebd769.js";
|
|
20
20
|
import {
|
|
21
21
|
argumentsDigest
|
|
22
|
-
} from "../index-
|
|
22
|
+
} from "../index-mfntvj58.js";
|
|
23
23
|
|
|
24
24
|
// src/live/events.ts
|
|
25
25
|
import { z } from "zod";
|