@xanots/sdk 0.0.5 → 0.0.7
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 +29 -0
- package/README.md +3 -3
- package/dist/.build-fingerprint +1 -1
- package/dist/{agent-file-refresh-IJ7GN2FJ.js → agent-file-refresh-4W37DGXS.js} +4 -4
- package/dist/bin.js +8 -8
- package/dist/branch-commands-PBQ36L4A.js +134 -0
- package/dist/{chunk-CYJ7R3AD.js → chunk-2V3JUXTF.js} +24 -11
- package/dist/{chunk-OR43PDCW.js → chunk-3EYUR3TX.js} +2 -2
- package/dist/{chunk-SG4UBJ47.js → chunk-3QW5NFZJ.js} +26 -5
- package/dist/{chunk-7SISR3CS.js → chunk-4PE4ZAB7.js} +3 -3
- package/dist/{chunk-PGBK64U5.js → chunk-4PTSTDIG.js} +2 -2
- package/dist/{live-diff-FP4SFNT4.js → chunk-5HCDZ2XN.js} +67 -6
- package/dist/{chunk-OARSPAIE.js → chunk-5PDOAR77.js} +58 -38
- package/dist/{chunk-5WGEURVI.js → chunk-6AAT2AYQ.js} +21 -1
- package/dist/{chunk-QA5ICJ4M.js → chunk-7BUTRVKA.js} +3 -3
- package/dist/{chunk-YUBJLB6G.js → chunk-7JDT4PBU.js} +75 -8
- package/dist/{chunk-LLWK6H77.js → chunk-BKDJN76G.js} +31 -1
- package/dist/{chunk-MS3BRZAZ.js → chunk-CL2H2WYE.js} +50 -27
- package/dist/{chunk-KXCPZUUM.js → chunk-DBHE35JM.js} +8 -67
- package/dist/chunk-EQW3YT5U.js +159 -0
- package/dist/{chunk-BPEEGJJA.js → chunk-FAWNUE2U.js} +39 -8
- package/dist/{chunk-ZGA5MUNC.js → chunk-FDKR4YMN.js} +2 -2
- package/dist/{chunk-APOR6TCV.js → chunk-H2DEDWQF.js} +4 -4
- package/dist/{chunk-PXXLBXOP.js → chunk-JAVB27HL.js} +2 -2
- package/dist/{chunk-AAFBSOSD.js → chunk-JQJPFUZI.js} +3 -3
- package/dist/{chunk-IVP6TS26.js → chunk-JQLR64UC.js} +6 -5
- package/dist/{chunk-FN4OQT2J.js → chunk-JUHKEAHJ.js} +4 -4
- package/dist/{chunk-WJYB7DSI.js → chunk-MDXR5E5Q.js} +2 -2
- package/dist/{chunk-WGDAOOXG.js → chunk-MU3O43L2.js} +3 -3
- package/dist/{chunk-YUPQOLFX.js → chunk-NJGNUVXR.js} +15 -4
- package/dist/{chunk-F5T45NAM.js → chunk-OKNSR7MT.js} +45 -2
- package/dist/{chunk-MFIHIS6B.js → chunk-OYMR5AMJ.js} +2 -2
- package/dist/{chunk-QUUB7HYK.js → chunk-P5C2YKAM.js} +2 -2
- package/dist/{chunk-6DHJVLYP.js → chunk-Q77KNEUL.js} +1 -1
- package/dist/{chunk-D6OGU2AI.js → chunk-QIWBCS7N.js} +2 -2
- package/dist/cli.d.ts +28 -2
- package/dist/cli.js +7 -7
- package/dist/{codegen-command-BLOS3GR3.js → codegen-command-DYH4H4TD.js} +18 -18
- package/dist/{completion-GHP5RRLQ.js → completion-A6BZ3XGU.js} +8 -7
- package/dist/{deploy-command-XOH76USO.js → deploy-command-HM57BINV.js} +15 -15
- package/dist/{env-target-POGJMD6Q.js → env-target-WA3BH5YU.js} +6 -6
- package/dist/{ephemeral-command-46SL27GJ.js → ephemeral-command-SD2KLX4P.js} +10 -10
- package/dist/index.d.ts +69 -26
- package/dist/index.js +6 -6
- package/dist/init-command-VIPWAQYS.js +30 -0
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +120 -62
- package/dist/{io-7VIA5SON.js → io-M7XZEMK7.js} +3 -3
- package/dist/live-diff-QK4KC2FJ.js +12 -0
- package/dist/{lock-KXOJIGCG.js → lock-GFXD6G2E.js} +6 -2
- package/dist/{lock-commands-6UONZW26.js → lock-commands-7VJKAXV6.js} +8 -8
- package/dist/{login-command-SG7IWTHW.js → login-command-DFCURZLC.js} +6 -6
- package/dist/{logout-command-J2AG5NKC.js → logout-command-WXVZQCAV.js} +2 -2
- package/dist/{marketplace-command-NKTQ3VPS.js → marketplace-command-BCOAAN2I.js} +3 -3
- package/dist/{meta-client-OW5WKWW7.js → meta-client-57ZWVHST.js} +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.js +10 -10
- package/dist/{profile-command-ZPC2DPFV.js → profile-command-QJAAUZIV.js} +3 -3
- package/dist/{release-command-FKQ6E3TD.js → release-command-3IET7YII.js} +206 -26
- package/dist/{sandbox-details-command-DMY2KGA2.js → sandbox-details-command-EDO56IY3.js} +4 -4
- package/dist/{sandbox-export-command-R6QMEK3D.js → sandbox-export-command-MO6DEZ7Z.js} +5 -5
- package/dist/scaffold.d.ts +10 -13
- package/dist/scaffold.js +3 -3
- package/dist/{store-BJONDJoZ.d.ts → store-DfuWu1tE.d.ts} +1 -1
- package/dist/{test-command-56IAEYHX.js → test-command-S7SMRWMP.js} +8 -8
- package/dist/{upgrade-command-M2DZ3ZPD.js → upgrade-command-TZYSGXP7.js} +13 -13
- package/dist/{validate-command-CIBQJND7.js → validate-command-MMXEVHH3.js} +10 -10
- package/dist/{workspace-command-HZS43PHJ.js → workspace-command-X6L7HTXO.js} +24 -20
- package/guides/environment.md +6 -3
- package/guides/scaffold.md +3 -2
- package/llms/fields.md +8 -0
- package/llms/kinds-core.md +2 -1
- package/llms/lambda.md +1 -1
- package/llms/legacy.md +1 -1
- package/llms/lock.md +32 -0
- package/llms/object-kinds.md +2 -2
- package/llms/statements-calls.md +10 -3
- package/llms/statements-data.md +2 -1
- package/llms-full.txt +108 -58
- package/llms.txt +49 -49
- package/manifest.json +2 -2
- package/package.json +1 -1
- package/dist/init-command-NCRPVFGE.js +0 -30
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "./chunk-ZOYMZZ3S.js";
|
|
19
19
|
import {
|
|
20
20
|
getAccessToken
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-3QW5NFZJ.js";
|
|
22
22
|
import {
|
|
23
23
|
exportWorkspaceBundle
|
|
24
24
|
} from "./chunk-QTNO2WD6.js";
|
|
@@ -27,15 +27,15 @@ import {
|
|
|
27
27
|
resolveFrontendPreset,
|
|
28
28
|
resolveThemeChoice,
|
|
29
29
|
sanitizeAppName
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-DBHE35JM.js";
|
|
31
31
|
import {
|
|
32
32
|
XANO_DIR,
|
|
33
33
|
resolveAiPresets,
|
|
34
34
|
scaffoldProject
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-4PE4ZAB7.js";
|
|
36
36
|
import {
|
|
37
37
|
TEST_EXPECT_TYPES
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-JAVB27HL.js";
|
|
39
39
|
import {
|
|
40
40
|
raw
|
|
41
41
|
} from "./chunk-LU7TRWMC.js";
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
describeOrigin,
|
|
45
45
|
renderCodegenMarker,
|
|
46
46
|
renderCodegenReadme
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-P5C2YKAM.js";
|
|
48
48
|
import {
|
|
49
49
|
FIELD_METHODS,
|
|
50
50
|
STATEMENT_SURFACES,
|
|
@@ -67,14 +67,14 @@ import {
|
|
|
67
67
|
searchConstrainsRows,
|
|
68
68
|
tableTrigger,
|
|
69
69
|
workspaceTrigger
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-2V3JUXTF.js";
|
|
71
71
|
import {
|
|
72
72
|
loadDefault,
|
|
73
73
|
readVersion
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-CL2H2WYE.js";
|
|
75
75
|
import {
|
|
76
76
|
UsageError
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-JQLR64UC.js";
|
|
78
78
|
import {
|
|
79
79
|
blank,
|
|
80
80
|
detail,
|
|
@@ -115,7 +115,7 @@ import {
|
|
|
115
115
|
sys,
|
|
116
116
|
toolset,
|
|
117
117
|
withFilters
|
|
118
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-NJGNUVXR.js";
|
|
119
119
|
import {
|
|
120
120
|
parsePathParams,
|
|
121
121
|
unboundPathParams
|
|
@@ -130,7 +130,7 @@ import {
|
|
|
130
130
|
} from "./chunk-5XZ744TS.js";
|
|
131
131
|
import {
|
|
132
132
|
REFERENCEABLE_KIND_PAYLOAD_KEYS
|
|
133
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-7JDT4PBU.js";
|
|
134
134
|
|
|
135
135
|
// src/emit/codegen-command.ts
|
|
136
136
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -2732,10 +2732,7 @@ function callDecoder(shape) {
|
|
|
2732
2732
|
shape.path
|
|
2733
2733
|
);
|
|
2734
2734
|
}
|
|
2735
|
-
const target = unbound ? lit(null) :
|
|
2736
|
-
["name", lit("")],
|
|
2737
|
-
["guid", lit(guid)]
|
|
2738
|
-
]) : resolveReference(a.ctx, a.refs, guid, { ...a.resolve, unresolved: "object-ref" });
|
|
2735
|
+
const target = unbound ? lit(null) : resolveReference(a.ctx, a.refs, guid, { ...a.resolve, unresolved: "object-ref" });
|
|
2739
2736
|
const entries = [[shape.arg, target]];
|
|
2740
2737
|
const runtime = {
|
|
2741
2738
|
[shape.arg]: unbound ? null : { name: "", guid }
|
|
@@ -2845,11 +2842,7 @@ var CALL_DECODERS = /* @__PURE__ */ new Map([
|
|
|
2845
2842
|
"mvp:workspace_run_middleware",
|
|
2846
2843
|
callDecoder({ path: "middleware.call", arg: "middleware", idPath: "id" })
|
|
2847
2844
|
],
|
|
2848
|
-
["mvp:workspace_run_addon", callDecoder({ path: "addon.call", arg: "addon", idPath: "id" })]
|
|
2849
|
-
[
|
|
2850
|
-
"mvp:action",
|
|
2851
|
-
callDecoder({ path: "action.call", arg: "action", idPath: "run_version.id", external: true })
|
|
2852
|
-
]
|
|
2845
|
+
["mvp:workspace_run_addon", callDecoder({ path: "addon.call", arg: "addon", idPath: "id" })]
|
|
2853
2846
|
]);
|
|
2854
2847
|
|
|
2855
2848
|
// src/codegen/specials/db.ts
|
|
@@ -4032,26 +4025,52 @@ function callInput2(a) {
|
|
|
4032
4025
|
}
|
|
4033
4026
|
return { expr: obj2(cells), runtime };
|
|
4034
4027
|
}
|
|
4028
|
+
function registryInput(a) {
|
|
4029
|
+
const list = a.stored.settings_registry;
|
|
4030
|
+
return callInput2({ ...a, stored: { ...a.stored, input: Array.isArray(list) ? list : [] } });
|
|
4031
|
+
}
|
|
4032
|
+
function withCallBindings(a, entries, runtime) {
|
|
4033
|
+
for (const [key2, read] of [
|
|
4034
|
+
["input", callInput2],
|
|
4035
|
+
["registry", registryInput]
|
|
4036
|
+
]) {
|
|
4037
|
+
const decoded = read(a);
|
|
4038
|
+
if (!decoded) return false;
|
|
4039
|
+
if (Object.keys(decoded.runtime).length > 0) {
|
|
4040
|
+
entries.push([key2, decoded.expr]);
|
|
4041
|
+
runtime[key2] = decoded.runtime;
|
|
4042
|
+
}
|
|
4043
|
+
}
|
|
4044
|
+
return true;
|
|
4045
|
+
}
|
|
4046
|
+
var actionCall = (a) => {
|
|
4047
|
+
const context = a.stored.context ?? {};
|
|
4048
|
+
const id2 = getPath2(context, "run_version.id");
|
|
4049
|
+
if (typeof id2 !== "string" || id2 === "")
|
|
4050
|
+
return declineHere("action.call: context.run_version.id is blank");
|
|
4051
|
+
const entries = [["actionId", lit(id2)]];
|
|
4052
|
+
const runtime = { actionId: id2 };
|
|
4053
|
+
withAs(a, entries, runtime);
|
|
4054
|
+
if (!withCallBindings(a, entries, runtime)) return null;
|
|
4055
|
+
return prove(a.ctx, a.stored, "action.call", [runtime], [obj2(entries)]);
|
|
4056
|
+
};
|
|
4035
4057
|
var actionPackageCall = (a) => {
|
|
4036
4058
|
const context = a.stored.context ?? {};
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
const entries = [
|
|
4043
|
-
const runtime = {
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
if (!input2) return null;
|
|
4050
|
-
if (Object.keys(input2.runtime).length > 0) {
|
|
4051
|
-
entries.push(["input", input2.expr]);
|
|
4052
|
-
runtime.input = input2.runtime;
|
|
4059
|
+
const parts = {
|
|
4060
|
+
traceId: getPath2(context, "action.trace_id"),
|
|
4061
|
+
versionId: getPath2(context, "package_version.id"),
|
|
4062
|
+
slug: getPath2(context, "package.slug")
|
|
4063
|
+
};
|
|
4064
|
+
const entries = [];
|
|
4065
|
+
const runtime = {};
|
|
4066
|
+
for (const [arg, value] of Object.entries(parts)) {
|
|
4067
|
+
if (typeof value !== "string" || value === "")
|
|
4068
|
+
return declineHere(`action.package.call: context identity part \`${arg}\` is blank`);
|
|
4069
|
+
entries.push([arg, lit(value)]);
|
|
4070
|
+
runtime[arg] = value;
|
|
4053
4071
|
}
|
|
4054
4072
|
withAs(a, entries, runtime);
|
|
4073
|
+
if (!withCallBindings(a, entries, runtime)) return null;
|
|
4055
4074
|
return prove(a.ctx, a.stored, "action.package.call", [runtime], [obj2(entries)]);
|
|
4056
4075
|
};
|
|
4057
4076
|
var workflowTestCall = (a) => {
|
|
@@ -4165,6 +4184,7 @@ var MISC_DECODERS = /* @__PURE__ */ new Map([
|
|
|
4165
4184
|
["mvp:realtime_publish", realtimePublish],
|
|
4166
4185
|
["mvp:create_auth", createAuthToken],
|
|
4167
4186
|
["mvp:guid", createGuid],
|
|
4187
|
+
["mvp:action", actionCall],
|
|
4168
4188
|
["mvp:action_package", actionPackageCall],
|
|
4169
4189
|
["mvp:workspace_run_workflow_test", workflowTestCall]
|
|
4170
4190
|
]);
|
|
@@ -6731,7 +6751,7 @@ async function fetchBundle(args, source) {
|
|
|
6731
6751
|
if (source.kind === "sandbox") {
|
|
6732
6752
|
const auth3 = await getAccessToken(args);
|
|
6733
6753
|
step("Reading the sandbox workspace");
|
|
6734
|
-
const { fetchSandboxBundle } = await import("./sandbox-export-command-
|
|
6754
|
+
const { fetchSandboxBundle } = await import("./sandbox-export-command-MO6DEZ7Z.js");
|
|
6735
6755
|
return {
|
|
6736
6756
|
bundle: await fetchSandboxBundle(auth3),
|
|
6737
6757
|
origin: { source: "sandbox", origin: auth3.instance }
|
|
@@ -6745,7 +6765,7 @@ async function fetchBundle(args, source) {
|
|
|
6745
6765
|
);
|
|
6746
6766
|
}
|
|
6747
6767
|
const auth3 = await getAccessToken(args);
|
|
6748
|
-
const { resolveLive, fetchEphemeralBundle } = await import("./ephemeral-command-
|
|
6768
|
+
const { resolveLive, fetchEphemeralBundle } = await import("./ephemeral-command-SD2KLX4P.js");
|
|
6749
6769
|
const summary = await resolveLive(auth3, auth3.workspaceId, name);
|
|
6750
6770
|
step(`Reading ephemeral "${name}"`);
|
|
6751
6771
|
return {
|
|
@@ -7014,4 +7034,4 @@ export {
|
|
|
7014
7034
|
verifyCrashEntry,
|
|
7015
7035
|
blameGeneratedFile
|
|
7016
7036
|
};
|
|
7017
|
-
//# sourceMappingURL=chunk-
|
|
7037
|
+
//# sourceMappingURL=chunk-5PDOAR77.js.map
|
|
@@ -7,12 +7,20 @@ import {
|
|
|
7
7
|
// src/deploy/import.ts
|
|
8
8
|
var IMPORT_TIMEOUT_MS = 12e4;
|
|
9
9
|
var PROBE_TIMEOUT_MS = 15e3;
|
|
10
|
+
function plannedBranch(parsed) {
|
|
11
|
+
const summary = parsed.summary !== null && typeof parsed.summary === "object" && !Array.isArray(parsed.summary) ? parsed.summary : {};
|
|
12
|
+
for (const candidate of [parsed.branch, parsed.branch_label, summary.branch, summary.branch_label]) {
|
|
13
|
+
if (typeof candidate === "string" && candidate !== "") return candidate;
|
|
14
|
+
}
|
|
15
|
+
return void 0;
|
|
16
|
+
}
|
|
10
17
|
function query(opts) {
|
|
11
18
|
const params = new URLSearchParams();
|
|
12
19
|
if (opts.mode !== void 0) params.set("mode", opts.mode);
|
|
13
20
|
if (opts.prune !== void 0) params.set("delete", String(opts.prune));
|
|
14
21
|
if (opts.records !== void 0) params.set("records", String(opts.records));
|
|
15
22
|
if (opts.truncate !== void 0) params.set("truncate", String(opts.truncate));
|
|
23
|
+
if (opts.branch !== void 0) params.set("branch", opts.branch);
|
|
16
24
|
const qs = params.toString();
|
|
17
25
|
return qs === "" ? "" : `?${qs}`;
|
|
18
26
|
}
|
|
@@ -66,6 +74,16 @@ async function assertMergeSupported(auth, opts) {
|
|
|
66
74
|
${text}`
|
|
67
75
|
);
|
|
68
76
|
}
|
|
77
|
+
function assertBranchTargetHonored(plan, requested, baseUrl) {
|
|
78
|
+
if (plan.branch === requested) return;
|
|
79
|
+
const observed = plan.branch === void 0 ? `it did not say which branch the plan targets` : `it planned against "${plan.branch}"`;
|
|
80
|
+
throw new Error(
|
|
81
|
+
`Refusing to release to branch "${requested}": ${observed}.
|
|
82
|
+
instance: ${baseUrl}
|
|
83
|
+
An instance that predates branch support IGNORES the branch parameter, imports into whichever branch is LIVE, and still answers 200 \u2014 so a release that looked staged would have overwritten production. That is not recoverable, so it is not attempted on an instance that has not confirmed the target.
|
|
84
|
+
Update the instance, or drop \`--branch\` to release to the live branch deliberately.`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
69
87
|
function body(archive) {
|
|
70
88
|
const form = new FormData();
|
|
71
89
|
form.append("file", new Blob([archive], { type: "application/gzip" }), "workspace.gz");
|
|
@@ -145,12 +163,14 @@ ${text}`);
|
|
|
145
163
|
hasRecords: parsed.has_records === true,
|
|
146
164
|
hasEnv: parsed.has_env === true,
|
|
147
165
|
operations,
|
|
166
|
+
branch: plannedBranch(parsed),
|
|
148
167
|
raw: text
|
|
149
168
|
};
|
|
150
169
|
}
|
|
151
170
|
|
|
152
171
|
export {
|
|
172
|
+
assertBranchTargetHonored,
|
|
153
173
|
importWorkspaceArchive,
|
|
154
174
|
planWorkspaceImport
|
|
155
175
|
};
|
|
156
|
-
//# sourceMappingURL=chunk-
|
|
176
|
+
//# sourceMappingURL=chunk-6AAT2AYQ.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compileBundle
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CL2H2WYE.js";
|
|
4
4
|
import {
|
|
5
5
|
missingArgument
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JQLR64UC.js";
|
|
7
7
|
|
|
8
8
|
// src/emit/bundle-input.ts
|
|
9
9
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -34,4 +34,4 @@ export {
|
|
|
34
34
|
assertBundleInput,
|
|
35
35
|
loadBundleText
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
37
|
+
//# sourceMappingURL=chunk-7BUTRVKA.js.map
|
|
@@ -269,6 +269,39 @@ function realtimeMessageSeedName(server, channelPath, name) {
|
|
|
269
269
|
seedPart("message", "name", name)
|
|
270
270
|
].join(SEED_SEP);
|
|
271
271
|
}
|
|
272
|
+
function querySeedName(group, verb, name) {
|
|
273
|
+
return [
|
|
274
|
+
group === "" ? "" : seedPart("query", "apiGroup", group),
|
|
275
|
+
seedPart("query", "verb", verb),
|
|
276
|
+
seedPart("query", "name", name)
|
|
277
|
+
].join(SEED_SEP);
|
|
278
|
+
}
|
|
279
|
+
function deriveQueryGuid(group, verb, name) {
|
|
280
|
+
const seed = `query:${querySeedName(group, verb, name)}`;
|
|
281
|
+
const guid = getLockedGuid(seed) ?? getLockedGuid(`query:${name}`) ?? rawDeriveGuid(seed);
|
|
282
|
+
SEEN_SEEDS.set(guid, seed);
|
|
283
|
+
return guid;
|
|
284
|
+
}
|
|
285
|
+
function queryGroupComponent(ref) {
|
|
286
|
+
if (ref.apiGroupId !== void 0) return `#${ref.apiGroupId}`;
|
|
287
|
+
const group = ref.apiGroup;
|
|
288
|
+
if (group === void 0) return "";
|
|
289
|
+
return typeof group === "string" ? group : group.name;
|
|
290
|
+
}
|
|
291
|
+
function resolveQueryRef(target) {
|
|
292
|
+
if (typeof target !== "string" && target.guid) {
|
|
293
|
+
if (target.name) SEEN_SEEDS.set(target.guid, `query:${target.name}`);
|
|
294
|
+
return target.guid;
|
|
295
|
+
}
|
|
296
|
+
const handle = typeof target === "string" ? void 0 : target;
|
|
297
|
+
if (handle?.verb !== void 0 && handle.name) {
|
|
298
|
+
return deriveQueryGuid(queryGroupComponent(handle), handle.verb, handle.name);
|
|
299
|
+
}
|
|
300
|
+
const label = typeof target === "string" ? `"${target}"` : `"${handle?.name ?? "?"}"`;
|
|
301
|
+
throw new Error(
|
|
302
|
+
`Cannot resolve query reference ${label}: a query's identity is composed from its api group, verb, and name, so a bare name cannot identify one. Pass the query() def handle (it carries all three), or a { name, guid } pair to address an object by explicit identity.`
|
|
303
|
+
);
|
|
304
|
+
}
|
|
272
305
|
function rawDeriveGuid(seed) {
|
|
273
306
|
return md5Hex(seed);
|
|
274
307
|
}
|
|
@@ -321,6 +354,30 @@ function resolvePayloadKey(kindOrPayloadKey) {
|
|
|
321
354
|
function lockKey(payloadKey, name) {
|
|
322
355
|
return `${payloadKey}:${name}`;
|
|
323
356
|
}
|
|
357
|
+
function lockNameForObject(payloadKey, obj, appNameByGuid) {
|
|
358
|
+
if (payloadKey !== "query") return obj.name;
|
|
359
|
+
const verb = typeof obj.verb === "string" ? obj.verb : "";
|
|
360
|
+
const appId = obj.app?.id;
|
|
361
|
+
let group = "";
|
|
362
|
+
if (typeof appId === "string" && appId !== "") {
|
|
363
|
+
group = appNameByGuid.get(appId) ?? appId;
|
|
364
|
+
} else if (typeof appId === "number" && appId !== 0) {
|
|
365
|
+
group = `#${appId}`;
|
|
366
|
+
}
|
|
367
|
+
return [group, verb, obj.name].join("|");
|
|
368
|
+
}
|
|
369
|
+
function appNamesByGuid(appSection) {
|
|
370
|
+
const map = /* @__PURE__ */ new Map();
|
|
371
|
+
if (!Array.isArray(appSection)) return map;
|
|
372
|
+
for (const row of appSection) {
|
|
373
|
+
if (!row || typeof row !== "object") continue;
|
|
374
|
+
const { name, guid } = row;
|
|
375
|
+
if (typeof name === "string" && typeof guid === "string" && guid !== "") {
|
|
376
|
+
map.set(guid, name);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return map;
|
|
380
|
+
}
|
|
324
381
|
function emptyLock() {
|
|
325
382
|
return { version: LOCK_VERSION, objects: {} };
|
|
326
383
|
}
|
|
@@ -447,11 +504,14 @@ function validateLockObjects(raw, path) {
|
|
|
447
504
|
guidOwners.set(guid, key);
|
|
448
505
|
}
|
|
449
506
|
if (typeof canonical === "string") {
|
|
450
|
-
const
|
|
507
|
+
const scope = isWorkspaceKey ? WORKSPACE_KEY : key.slice(0, key.indexOf(":"));
|
|
508
|
+
let owners = canonicalOwners.get(scope);
|
|
509
|
+
if (owners === void 0) canonicalOwners.set(scope, owners = /* @__PURE__ */ new Map());
|
|
510
|
+
const owner = owners.get(canonical);
|
|
451
511
|
if (owner !== void 0) {
|
|
452
512
|
fail(path, `entries "${owner}" and "${key}" share the same canonical (${canonical}).`);
|
|
453
513
|
}
|
|
454
|
-
|
|
514
|
+
owners.set(canonical, key);
|
|
455
515
|
}
|
|
456
516
|
const entry = {};
|
|
457
517
|
if (typeof guid === "string") entry.guid = guid;
|
|
@@ -505,7 +565,7 @@ function recordObserved(ctx, key, identity) {
|
|
|
505
565
|
const prior = ctx.observed[key];
|
|
506
566
|
if (prior?.guid !== void 0 && identity.guid !== void 0 && prior.guid !== identity.guid) {
|
|
507
567
|
throw new Error(
|
|
508
|
-
`Two exported objects collapse onto lock key "${key}" with different guids (${prior.guid} vs ${identity.guid}) \u2014 two same-kind objects sharing a name
|
|
568
|
+
`Two exported objects collapse onto lock key "${key}" with different guids (${prior.guid} vs ${identity.guid}) \u2014 two same-kind objects sharing a name behind explicit guids, or a realtime kind whose identity is composed from more than the name (a channel is unique per server, a message per channel). The lock cannot track both under one key; rename one of the objects.`
|
|
509
569
|
);
|
|
510
570
|
}
|
|
511
571
|
const entry = ctx.lock.objects[key];
|
|
@@ -570,6 +630,7 @@ function adoptFromBundle(lock, bundle, bundlePath) {
|
|
|
570
630
|
objects[key] = after;
|
|
571
631
|
}
|
|
572
632
|
};
|
|
633
|
+
const appNames = appNamesByGuid(sections["app"]);
|
|
573
634
|
for (const payloadKey of LOCK_PAYLOAD_KEYS) {
|
|
574
635
|
const arr = sections[payloadKey];
|
|
575
636
|
if (!Array.isArray(arr)) continue;
|
|
@@ -578,18 +639,19 @@ function adoptFromBundle(lock, bundle, bundlePath) {
|
|
|
578
639
|
if (!obj || typeof obj !== "object") continue;
|
|
579
640
|
const o = obj;
|
|
580
641
|
if (typeof o.name !== "string" || typeof o.guid !== "string" || o.guid === "") continue;
|
|
581
|
-
|
|
642
|
+
const lockName = lockNameForObject(payloadKey, o, appNames);
|
|
643
|
+
if (namesSeen.has(lockName)) {
|
|
582
644
|
throw new Error(
|
|
583
|
-
`${bundlePath} contains two "${payloadKey}" objects
|
|
645
|
+
`${bundlePath} contains two "${payloadKey}" objects with the identity "${lockName}" \u2014 the lock keys identity per kind and cannot represent both. Adoption aborted; rename one of them engine-side, then re-export and re-adopt.`
|
|
584
646
|
);
|
|
585
647
|
}
|
|
586
|
-
namesSeen.add(
|
|
648
|
+
namesSeen.add(lockName);
|
|
587
649
|
const incoming = { guid: o.guid };
|
|
588
650
|
if (typeof o.canonical === "string" && o.canonical !== "") {
|
|
589
651
|
incoming.canonical = o.canonical;
|
|
590
652
|
canonicalsSeen = true;
|
|
591
653
|
}
|
|
592
|
-
applyEntry(lockKey(payloadKey,
|
|
654
|
+
applyEntry(lockKey(payloadKey, lockName), incoming);
|
|
593
655
|
}
|
|
594
656
|
}
|
|
595
657
|
const ws = sections["workspace"];
|
|
@@ -660,6 +722,9 @@ export {
|
|
|
660
722
|
REFERENCEABLE_KINDS,
|
|
661
723
|
realtimeChannelSeedName,
|
|
662
724
|
realtimeMessageSeedName,
|
|
725
|
+
deriveQueryGuid,
|
|
726
|
+
queryGroupComponent,
|
|
727
|
+
resolveQueryRef,
|
|
663
728
|
deriveGuid,
|
|
664
729
|
guidSeedHint,
|
|
665
730
|
resolveRef,
|
|
@@ -669,6 +734,8 @@ export {
|
|
|
669
734
|
CANONICAL_PAYLOAD_KEYS,
|
|
670
735
|
resolvePayloadKey,
|
|
671
736
|
lockKey,
|
|
737
|
+
lockNameForObject,
|
|
738
|
+
appNamesByGuid,
|
|
672
739
|
emptyLock,
|
|
673
740
|
parseLock,
|
|
674
741
|
validateLockModel,
|
|
@@ -680,4 +747,4 @@ export {
|
|
|
680
747
|
adoptFromBundle,
|
|
681
748
|
mergeObserved
|
|
682
749
|
};
|
|
683
|
-
//# sourceMappingURL=chunk-
|
|
750
|
+
//# sourceMappingURL=chunk-7JDT4PBU.js.map
|
|
@@ -122,6 +122,34 @@ function oauthErrorCode(err) {
|
|
|
122
122
|
}
|
|
123
123
|
return void 0;
|
|
124
124
|
}
|
|
125
|
+
function oauthErrorResponse(err) {
|
|
126
|
+
const cause = err?.cause;
|
|
127
|
+
return typeof Response !== "undefined" && cause instanceof Response ? cause : void 0;
|
|
128
|
+
}
|
|
129
|
+
var OAUTH_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
130
|
+
"invalid_request",
|
|
131
|
+
"invalid_client",
|
|
132
|
+
"invalid_grant",
|
|
133
|
+
"unauthorized_client",
|
|
134
|
+
"unsupported_grant_type",
|
|
135
|
+
"invalid_scope"
|
|
136
|
+
]);
|
|
137
|
+
async function resolveOAuthErrorCode(err) {
|
|
138
|
+
const rfc = oauthErrorCode(err);
|
|
139
|
+
if (rfc !== void 0) return rfc;
|
|
140
|
+
const res = oauthErrorResponse(err);
|
|
141
|
+
if (res === void 0 || res.bodyUsed) return void 0;
|
|
142
|
+
try {
|
|
143
|
+
const body = await res.clone().json();
|
|
144
|
+
if (!body || typeof body !== "object") return void 0;
|
|
145
|
+
const fields = body;
|
|
146
|
+
for (const candidate of [fields.error, fields.message, fields.code]) {
|
|
147
|
+
if (typeof candidate === "string" && OAUTH_ERROR_CODES.has(candidate)) return candidate;
|
|
148
|
+
}
|
|
149
|
+
} catch {
|
|
150
|
+
}
|
|
151
|
+
return void 0;
|
|
152
|
+
}
|
|
125
153
|
var OpenIdProvider = class {
|
|
126
154
|
constructor(opts) {
|
|
127
155
|
this.opts = opts;
|
|
@@ -470,6 +498,8 @@ export {
|
|
|
470
498
|
DEFAULT_PORT,
|
|
471
499
|
decodeAudience,
|
|
472
500
|
oauthErrorCode,
|
|
501
|
+
oauthErrorResponse,
|
|
502
|
+
resolveOAuthErrorCode,
|
|
473
503
|
OpenIdProvider,
|
|
474
504
|
globalAuthFilePath,
|
|
475
505
|
localAuthFilePath,
|
|
@@ -483,4 +513,4 @@ export {
|
|
|
483
513
|
resolveScope,
|
|
484
514
|
assertHttpsOrigin
|
|
485
515
|
};
|
|
486
|
-
//# sourceMappingURL=chunk-
|
|
516
|
+
//# sourceMappingURL=chunk-BKDJN76G.js.map
|