@abloatai/ablo 0.18.0 → 0.20.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 +49 -0
- package/dist/Model.d.ts +22 -0
- package/dist/Model.js +45 -0
- package/dist/ObjectPool.d.ts +14 -1
- package/dist/ObjectPool.js +8 -1
- package/dist/SyncClient.js +7 -1
- package/dist/SyncEngineContext.js +2 -0
- package/dist/ai-sdk/coordination-context.d.ts +2 -1
- package/dist/ai-sdk/coordination-context.js +3 -3
- package/dist/ai-sdk/index.d.ts +3 -4
- package/dist/ai-sdk/index.js +2 -3
- package/dist/ai-sdk/wrap.d.ts +13 -18
- package/dist/ai-sdk/wrap.js +2 -6
- package/dist/cli.cjs +253 -160
- package/dist/client/Ablo.d.ts +83 -22
- package/dist/client/Ablo.js +116 -32
- package/dist/client/ApiClient.d.ts +2 -2
- package/dist/client/ApiClient.js +27 -32
- package/dist/client/auth.d.ts +26 -0
- package/dist/client/auth.js +208 -0
- package/dist/client/createModelProxy.d.ts +16 -11
- package/dist/client/createModelProxy.js +15 -15
- package/dist/client/sessionMint.d.ts +10 -0
- package/dist/client/sessionMint.js +8 -1
- package/dist/coordination/schema.d.ts +10 -10
- package/dist/coordination/schema.js +7 -8
- package/dist/coordination/trace.d.ts +91 -0
- package/dist/coordination/trace.js +147 -0
- package/dist/errorCodes.d.ts +2 -0
- package/dist/errorCodes.js +2 -0
- package/dist/errors.d.ts +1 -2
- package/dist/errors.js +6 -9
- package/dist/index.d.ts +6 -1
- package/dist/index.js +13 -0
- package/dist/interfaces/index.d.ts +45 -2
- package/dist/mutators/undoApply.d.ts +7 -2
- package/dist/mutators/undoApply.js +7 -35
- package/dist/policy/types.d.ts +18 -9
- package/dist/policy/types.js +26 -16
- package/dist/react/AbloProvider.d.ts +2 -2
- package/dist/react/useAblo.js +12 -2
- package/dist/schema/sugar.js +10 -2
- package/dist/server/read-config.d.ts +7 -0
- package/dist/sync/HydrationCoordinator.js +7 -3
- package/dist/sync/SyncWebSocket.d.ts +11 -2
- package/dist/sync/SyncWebSocket.js +67 -3
- package/dist/sync/createClaimStream.d.ts +9 -2
- package/dist/sync/createClaimStream.js +9 -7
- package/dist/sync/participants.d.ts +12 -11
- package/dist/sync/participants.js +5 -5
- package/dist/transactions/TransactionQueue.d.ts +1 -0
- package/dist/transactions/TransactionQueue.js +40 -3
- package/dist/types/streams.d.ts +57 -135
- package/dist/utils/json.d.ts +39 -0
- package/dist/utils/json.js +88 -0
- package/docs/coordination.md +16 -0
- package/docs/debugging.md +194 -0
- package/docs/index.md +1 -0
- package/package.json +1 -1
- package/dist/ai-sdk/claim-broadcast.d.ts +0 -83
- package/dist/ai-sdk/claim-broadcast.js +0 -79
package/dist/cli.cjs
CHANGED
|
@@ -6044,8 +6044,8 @@ var require_typescript = __commonJS({
|
|
|
6044
6044
|
function createGetCanonicalFileName(useCaseSensitiveFileNames2) {
|
|
6045
6045
|
return useCaseSensitiveFileNames2 ? identity : toFileNameLowerCase;
|
|
6046
6046
|
}
|
|
6047
|
-
function patternText({ prefix, suffix }) {
|
|
6048
|
-
return `${
|
|
6047
|
+
function patternText({ prefix: prefix2, suffix }) {
|
|
6048
|
+
return `${prefix2}*${suffix}`;
|
|
6049
6049
|
}
|
|
6050
6050
|
function matchedText(pattern, candidate) {
|
|
6051
6051
|
Debug.assert(isPatternMatch(pattern, candidate));
|
|
@@ -6064,17 +6064,17 @@ var require_typescript = __commonJS({
|
|
|
6064
6064
|
}
|
|
6065
6065
|
return matchedValue;
|
|
6066
6066
|
}
|
|
6067
|
-
function startsWith(str,
|
|
6068
|
-
return ignoreCase ? equateStringsCaseInsensitive(str.slice(0,
|
|
6067
|
+
function startsWith(str, prefix2, ignoreCase) {
|
|
6068
|
+
return ignoreCase ? equateStringsCaseInsensitive(str.slice(0, prefix2.length), prefix2) : str.lastIndexOf(prefix2, 0) === 0;
|
|
6069
6069
|
}
|
|
6070
|
-
function removePrefix(str,
|
|
6071
|
-
return startsWith(str,
|
|
6070
|
+
function removePrefix(str, prefix2) {
|
|
6071
|
+
return startsWith(str, prefix2) ? str.substr(prefix2.length) : str;
|
|
6072
6072
|
}
|
|
6073
|
-
function tryRemovePrefix(str,
|
|
6074
|
-
return startsWith(getCanonicalFileName(str), getCanonicalFileName(
|
|
6073
|
+
function tryRemovePrefix(str, prefix2, getCanonicalFileName = identity) {
|
|
6074
|
+
return startsWith(getCanonicalFileName(str), getCanonicalFileName(prefix2)) ? str.substring(prefix2.length) : void 0;
|
|
6075
6075
|
}
|
|
6076
|
-
function isPatternMatch({ prefix, suffix }, candidate) {
|
|
6077
|
-
return candidate.length >=
|
|
6076
|
+
function isPatternMatch({ prefix: prefix2, suffix }, candidate) {
|
|
6077
|
+
return candidate.length >= prefix2.length + suffix.length && startsWith(candidate, prefix2) && endsWith(candidate, suffix);
|
|
6078
6078
|
}
|
|
6079
6079
|
function and(f, g2) {
|
|
6080
6080
|
return (arg) => f(arg) && g2(arg);
|
|
@@ -11848,8 +11848,8 @@ ${lanes.join("\n")}
|
|
|
11848
11848
|
);
|
|
11849
11849
|
const firstComponent = pathComponents2[0];
|
|
11850
11850
|
if (isAbsolutePathAnUrl && isRootedDiskPath(firstComponent)) {
|
|
11851
|
-
const
|
|
11852
|
-
pathComponents2[0] =
|
|
11851
|
+
const prefix2 = firstComponent.charAt(0) === directorySeparator ? "file://" : "file:///";
|
|
11852
|
+
pathComponents2[0] = prefix2 + firstComponent;
|
|
11853
11853
|
}
|
|
11854
11854
|
return getPathFromPathComponents(pathComponents2);
|
|
11855
11855
|
}
|
|
@@ -28865,12 +28865,12 @@ ${lanes.join("\n")}
|
|
|
28865
28865
|
node.symbol = void 0;
|
|
28866
28866
|
return node;
|
|
28867
28867
|
}
|
|
28868
|
-
function createBaseGeneratedIdentifier(text, autoGenerateFlags,
|
|
28868
|
+
function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix2, suffix) {
|
|
28869
28869
|
const node = createBaseIdentifier(escapeLeadingUnderscores(text));
|
|
28870
28870
|
setIdentifierAutoGenerate(node, {
|
|
28871
28871
|
flags: autoGenerateFlags,
|
|
28872
28872
|
id: nextAutoGenerateId,
|
|
28873
|
-
prefix,
|
|
28873
|
+
prefix: prefix2,
|
|
28874
28874
|
suffix
|
|
28875
28875
|
});
|
|
28876
28876
|
nextAutoGenerateId++;
|
|
@@ -28893,10 +28893,10 @@ ${lanes.join("\n")}
|
|
|
28893
28893
|
}
|
|
28894
28894
|
return node;
|
|
28895
28895
|
}
|
|
28896
|
-
function createTempVariable(recordTempVariable, reservedInNestedScopes,
|
|
28896
|
+
function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix2, suffix) {
|
|
28897
28897
|
let flags2 = 1;
|
|
28898
28898
|
if (reservedInNestedScopes) flags2 |= 8;
|
|
28899
|
-
const name = createBaseGeneratedIdentifier("", flags2,
|
|
28899
|
+
const name = createBaseGeneratedIdentifier("", flags2, prefix2, suffix);
|
|
28900
28900
|
if (recordTempVariable) {
|
|
28901
28901
|
recordTempVariable(name);
|
|
28902
28902
|
}
|
|
@@ -28914,23 +28914,23 @@ ${lanes.join("\n")}
|
|
|
28914
28914
|
void 0
|
|
28915
28915
|
);
|
|
28916
28916
|
}
|
|
28917
|
-
function createUniqueName(text, flags2 = 0,
|
|
28917
|
+
function createUniqueName(text, flags2 = 0, prefix2, suffix) {
|
|
28918
28918
|
Debug.assert(!(flags2 & 7), "Argument out of range: flags");
|
|
28919
28919
|
Debug.assert((flags2 & (16 | 32)) !== 32, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic");
|
|
28920
|
-
return createBaseGeneratedIdentifier(text, 3 | flags2,
|
|
28920
|
+
return createBaseGeneratedIdentifier(text, 3 | flags2, prefix2, suffix);
|
|
28921
28921
|
}
|
|
28922
|
-
function getGeneratedNameForNode(node, flags2 = 0,
|
|
28922
|
+
function getGeneratedNameForNode(node, flags2 = 0, prefix2, suffix) {
|
|
28923
28923
|
Debug.assert(!(flags2 & 7), "Argument out of range: flags");
|
|
28924
28924
|
const text = !node ? "" : isMemberName(node) ? formatGeneratedName(
|
|
28925
28925
|
/*privateName*/
|
|
28926
28926
|
false,
|
|
28927
|
-
|
|
28927
|
+
prefix2,
|
|
28928
28928
|
node,
|
|
28929
28929
|
suffix,
|
|
28930
28930
|
idText
|
|
28931
28931
|
) : `generated@${getNodeId(node)}`;
|
|
28932
|
-
if (
|
|
28933
|
-
const name = createBaseGeneratedIdentifier(text, 4 | flags2,
|
|
28932
|
+
if (prefix2 || suffix) flags2 |= 16;
|
|
28933
|
+
const name = createBaseGeneratedIdentifier(text, 4 | flags2, prefix2, suffix);
|
|
28934
28934
|
name.original = node;
|
|
28935
28935
|
return name;
|
|
28936
28936
|
}
|
|
@@ -28947,33 +28947,33 @@ ${lanes.join("\n")}
|
|
|
28947
28947
|
if (!startsWith(text, "#")) Debug.fail("First character of private identifier must be #: " + text);
|
|
28948
28948
|
return createBasePrivateIdentifier(escapeLeadingUnderscores(text));
|
|
28949
28949
|
}
|
|
28950
|
-
function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags,
|
|
28950
|
+
function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix2, suffix) {
|
|
28951
28951
|
const node = createBasePrivateIdentifier(escapeLeadingUnderscores(text));
|
|
28952
28952
|
setIdentifierAutoGenerate(node, {
|
|
28953
28953
|
flags: autoGenerateFlags,
|
|
28954
28954
|
id: nextAutoGenerateId,
|
|
28955
|
-
prefix,
|
|
28955
|
+
prefix: prefix2,
|
|
28956
28956
|
suffix
|
|
28957
28957
|
});
|
|
28958
28958
|
nextAutoGenerateId++;
|
|
28959
28959
|
return node;
|
|
28960
28960
|
}
|
|
28961
|
-
function createUniquePrivateName(text,
|
|
28961
|
+
function createUniquePrivateName(text, prefix2, suffix) {
|
|
28962
28962
|
if (text && !startsWith(text, "#")) Debug.fail("First character of private identifier must be #: " + text);
|
|
28963
28963
|
const autoGenerateFlags = 8 | (text ? 3 : 1);
|
|
28964
|
-
return createBaseGeneratedPrivateIdentifier(text ?? "", autoGenerateFlags,
|
|
28964
|
+
return createBaseGeneratedPrivateIdentifier(text ?? "", autoGenerateFlags, prefix2, suffix);
|
|
28965
28965
|
}
|
|
28966
|
-
function getGeneratedPrivateNameForNode(node,
|
|
28966
|
+
function getGeneratedPrivateNameForNode(node, prefix2, suffix) {
|
|
28967
28967
|
const text = isMemberName(node) ? formatGeneratedName(
|
|
28968
28968
|
/*privateName*/
|
|
28969
28969
|
true,
|
|
28970
|
-
|
|
28970
|
+
prefix2,
|
|
28971
28971
|
node,
|
|
28972
28972
|
suffix,
|
|
28973
28973
|
idText
|
|
28974
28974
|
) : `#generated@${getNodeId(node)}`;
|
|
28975
|
-
const flags2 =
|
|
28976
|
-
const name = createBaseGeneratedPrivateIdentifier(text, 4 | flags2,
|
|
28975
|
+
const flags2 = prefix2 || suffix ? 16 : 0;
|
|
28976
|
+
const name = createBaseGeneratedPrivateIdentifier(text, 4 | flags2, prefix2, suffix);
|
|
28977
28977
|
name.original = node;
|
|
28978
28978
|
return name;
|
|
28979
28979
|
}
|
|
@@ -33775,13 +33775,13 @@ ${lanes.join("\n")}
|
|
|
33775
33775
|
[expr]
|
|
33776
33776
|
);
|
|
33777
33777
|
}
|
|
33778
|
-
function createSetFunctionNameHelper(f, name,
|
|
33778
|
+
function createSetFunctionNameHelper(f, name, prefix2) {
|
|
33779
33779
|
context.requestEmitHelper(setFunctionNameHelper);
|
|
33780
33780
|
return context.factory.createCallExpression(
|
|
33781
33781
|
getUnscopedHelperName("__setFunctionName"),
|
|
33782
33782
|
/*typeArguments*/
|
|
33783
33783
|
void 0,
|
|
33784
|
-
|
|
33784
|
+
prefix2 ? [f, name, context.factory.createStringLiteral(prefix2)] : [f, name]
|
|
33785
33785
|
);
|
|
33786
33786
|
}
|
|
33787
33787
|
function createValuesHelper(expression) {
|
|
@@ -36118,11 +36118,11 @@ ${lanes.join("\n")}
|
|
|
36118
36118
|
function formatIdentifierWorker(node, generateName) {
|
|
36119
36119
|
return isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : isGeneratedIdentifier(node) ? generateName(node) : isPrivateIdentifier(node) ? node.escapedText.slice(1) : idText(node);
|
|
36120
36120
|
}
|
|
36121
|
-
function formatGeneratedName(privateName,
|
|
36122
|
-
|
|
36121
|
+
function formatGeneratedName(privateName, prefix2, baseName, suffix, generateName) {
|
|
36122
|
+
prefix2 = formatGeneratedNamePart(prefix2, generateName);
|
|
36123
36123
|
suffix = formatGeneratedNamePart(suffix, generateName);
|
|
36124
36124
|
baseName = formatIdentifier(baseName, generateName);
|
|
36125
|
-
return `${privateName ? "#" : ""}${
|
|
36125
|
+
return `${privateName ? "#" : ""}${prefix2}${baseName}${suffix}`;
|
|
36126
36126
|
}
|
|
36127
36127
|
function createAccessorPropertyBackingField(factory2, node, modifiers, initializer) {
|
|
36128
36128
|
return factory2.updatePropertyDeclaration(
|
|
@@ -56197,11 +56197,11 @@ ${lanes.join("\n")}
|
|
|
56197
56197
|
candidates.push({ ending: void 0, value: relativeToBaseUrl });
|
|
56198
56198
|
}
|
|
56199
56199
|
if (indexOfStar !== -1) {
|
|
56200
|
-
const
|
|
56200
|
+
const prefix2 = pattern.substring(0, indexOfStar);
|
|
56201
56201
|
const suffix = pattern.substring(indexOfStar + 1);
|
|
56202
56202
|
for (const { ending, value } of candidates) {
|
|
56203
|
-
if (value.length >=
|
|
56204
|
-
const matchedStar = value.substring(
|
|
56203
|
+
if (value.length >= prefix2.length + suffix.length && startsWith(value, prefix2) && endsWith(value, suffix) && validateEnding({ ending, value })) {
|
|
56204
|
+
const matchedStar = value.substring(prefix2.length, value.length - suffix.length);
|
|
56205
56205
|
if (!pathIsRelative(matchedStar)) {
|
|
56206
56206
|
return replaceFirstStar(key, matchedStar);
|
|
56207
56207
|
}
|
|
@@ -75900,9 +75900,9 @@ ${lanes.join("\n")}
|
|
|
75900
75900
|
}
|
|
75901
75901
|
secondaryRootErrors.unshift([mappedMsg, args[0], args[1]]);
|
|
75902
75902
|
} else {
|
|
75903
|
-
const
|
|
75903
|
+
const prefix2 = msg.code === Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code || msg.code === Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code ? "new " : "";
|
|
75904
75904
|
const params = msg.code === Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code || msg.code === Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code ? "" : "...";
|
|
75905
|
-
path = `${
|
|
75905
|
+
path = `${prefix2}${path}(${params})`;
|
|
75906
75906
|
}
|
|
75907
75907
|
break;
|
|
75908
75908
|
}
|
|
@@ -110744,13 +110744,13 @@ ${lanes.join("\n")}
|
|
|
110744
110744
|
}
|
|
110745
110745
|
function createHoistedVariableForClass(name, node, suffix) {
|
|
110746
110746
|
const { className } = getPrivateIdentifierEnvironment().data;
|
|
110747
|
-
const
|
|
110748
|
-
const identifier = typeof name === "object" ? factory2.getGeneratedNameForNode(name, 16 | 8,
|
|
110747
|
+
const prefix2 = className ? { prefix: "_", node: className, suffix: "_" } : "_";
|
|
110748
|
+
const identifier = typeof name === "object" ? factory2.getGeneratedNameForNode(name, 16 | 8, prefix2, suffix) : typeof name === "string" ? factory2.createUniqueName(name, 16, prefix2, suffix) : factory2.createTempVariable(
|
|
110749
110749
|
/*recordTempVariable*/
|
|
110750
110750
|
void 0,
|
|
110751
110751
|
/*reservedInNestedScopes*/
|
|
110752
110752
|
true,
|
|
110753
|
-
|
|
110753
|
+
prefix2,
|
|
110754
110754
|
suffix
|
|
110755
110755
|
);
|
|
110756
110756
|
if (resolver.hasNodeCheckFlag(
|
|
@@ -111823,7 +111823,7 @@ ${lanes.join("\n")}
|
|
|
111823
111823
|
if (!decoratorExpressions) {
|
|
111824
111824
|
return void 0;
|
|
111825
111825
|
}
|
|
111826
|
-
const
|
|
111826
|
+
const prefix2 = getClassMemberPrefix(node, member);
|
|
111827
111827
|
const memberName = getExpressionForPropertyName(
|
|
111828
111828
|
member,
|
|
111829
111829
|
/*generateNameForComputedPropertyName*/
|
|
@@ -111836,7 +111836,7 @@ ${lanes.join("\n")}
|
|
|
111836
111836
|
const descriptor = isPropertyDeclaration(member) && !hasAccessorModifier(member) ? factory2.createVoidZero() : factory2.createNull();
|
|
111837
111837
|
const helper = emitHelpers().createDecorateHelper(
|
|
111838
111838
|
decoratorExpressions,
|
|
111839
|
-
|
|
111839
|
+
prefix2,
|
|
111840
111840
|
memberName,
|
|
111841
111841
|
descriptor
|
|
111842
111842
|
);
|
|
@@ -113739,13 +113739,13 @@ ${lanes.join("\n")}
|
|
|
113739
113739
|
3072
|
|
113740
113740
|
/* NoComments */
|
|
113741
113741
|
);
|
|
113742
|
-
const
|
|
113742
|
+
const prefix2 = kind === "get" || kind === "set" ? kind : void 0;
|
|
113743
113743
|
const functionName = factory2.createStringLiteralFromNode(
|
|
113744
113744
|
name,
|
|
113745
113745
|
/*isSingleQuote*/
|
|
113746
113746
|
void 0
|
|
113747
113747
|
);
|
|
113748
|
-
const namedFunction = emitHelpers().createSetFunctionNameHelper(func, functionName,
|
|
113748
|
+
const namedFunction = emitHelpers().createSetFunctionNameHelper(func, functionName, prefix2);
|
|
113749
113749
|
const method = factory2.createPropertyAssignment(factory2.createIdentifier(kind), namedFunction);
|
|
113750
113750
|
setOriginalNode(method, original);
|
|
113751
113751
|
setSourceMapRange(method, moveRangePastDecorators(original));
|
|
@@ -134525,9 +134525,9 @@ ${lanes.join("\n")}
|
|
|
134525
134525
|
emitExpression(node, parenthesizerRule);
|
|
134526
134526
|
}
|
|
134527
134527
|
}
|
|
134528
|
-
function emitNodeWithPrefix(
|
|
134528
|
+
function emitNodeWithPrefix(prefix2, prefixWriter, node, emit2) {
|
|
134529
134529
|
if (node) {
|
|
134530
|
-
prefixWriter(
|
|
134530
|
+
prefixWriter(prefix2);
|
|
134531
134531
|
emit2(node);
|
|
134532
134532
|
}
|
|
134533
134533
|
}
|
|
@@ -135265,10 +135265,10 @@ ${lanes.join("\n")}
|
|
|
135265
135265
|
return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name));
|
|
135266
135266
|
}
|
|
135267
135267
|
}
|
|
135268
|
-
function generateNameCached(node, privateName, flags,
|
|
135268
|
+
function generateNameCached(node, privateName, flags, prefix2, suffix) {
|
|
135269
135269
|
const nodeId = getNodeId(node);
|
|
135270
135270
|
const cache = privateName ? nodeIdToGeneratedPrivateName : nodeIdToGeneratedName;
|
|
135271
|
-
return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags ?? 0, formatGeneratedNamePart(
|
|
135271
|
+
return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags ?? 0, formatGeneratedNamePart(prefix2, generateName), formatGeneratedNamePart(suffix)));
|
|
135272
135272
|
}
|
|
135273
135273
|
function isUniqueName(name, privateName) {
|
|
135274
135274
|
return isFileLevelUniqueNameInCurrentFile(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
|
|
@@ -135335,15 +135335,15 @@ ${lanes.join("\n")}
|
|
|
135335
135335
|
break;
|
|
135336
135336
|
}
|
|
135337
135337
|
}
|
|
135338
|
-
function makeTempVariableName(flags, reservedInNestedScopes, privateName,
|
|
135339
|
-
if (
|
|
135340
|
-
|
|
135338
|
+
function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix2, suffix) {
|
|
135339
|
+
if (prefix2.length > 0 && prefix2.charCodeAt(0) === 35) {
|
|
135340
|
+
prefix2 = prefix2.slice(1);
|
|
135341
135341
|
}
|
|
135342
|
-
const key = formatGeneratedName(privateName,
|
|
135342
|
+
const key = formatGeneratedName(privateName, prefix2, "", suffix);
|
|
135343
135343
|
let tempFlags2 = getTempFlags(key);
|
|
135344
135344
|
if (flags && !(tempFlags2 & flags)) {
|
|
135345
135345
|
const name = flags === 268435456 ? "_i" : "_n";
|
|
135346
|
-
const fullName = formatGeneratedName(privateName,
|
|
135346
|
+
const fullName = formatGeneratedName(privateName, prefix2, name, suffix);
|
|
135347
135347
|
if (isUniqueName(fullName, privateName)) {
|
|
135348
135348
|
tempFlags2 |= flags;
|
|
135349
135349
|
if (privateName) {
|
|
@@ -135360,7 +135360,7 @@ ${lanes.join("\n")}
|
|
|
135360
135360
|
tempFlags2++;
|
|
135361
135361
|
if (count !== 8 && count !== 13) {
|
|
135362
135362
|
const name = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26);
|
|
135363
|
-
const fullName = formatGeneratedName(privateName,
|
|
135363
|
+
const fullName = formatGeneratedName(privateName, prefix2, name, suffix);
|
|
135364
135364
|
if (isUniqueName(fullName, privateName)) {
|
|
135365
135365
|
if (privateName) {
|
|
135366
135366
|
reservePrivateNameInNestedScopes(fullName);
|
|
@@ -135373,15 +135373,15 @@ ${lanes.join("\n")}
|
|
|
135373
135373
|
}
|
|
135374
135374
|
}
|
|
135375
135375
|
}
|
|
135376
|
-
function makeUniqueName2(baseName, checkFn = isUniqueName, optimistic, scoped, privateName,
|
|
135376
|
+
function makeUniqueName2(baseName, checkFn = isUniqueName, optimistic, scoped, privateName, prefix2, suffix) {
|
|
135377
135377
|
if (baseName.length > 0 && baseName.charCodeAt(0) === 35) {
|
|
135378
135378
|
baseName = baseName.slice(1);
|
|
135379
135379
|
}
|
|
135380
|
-
if (
|
|
135381
|
-
|
|
135380
|
+
if (prefix2.length > 0 && prefix2.charCodeAt(0) === 35) {
|
|
135381
|
+
prefix2 = prefix2.slice(1);
|
|
135382
135382
|
}
|
|
135383
135383
|
if (optimistic) {
|
|
135384
|
-
const fullName = formatGeneratedName(privateName,
|
|
135384
|
+
const fullName = formatGeneratedName(privateName, prefix2, baseName, suffix);
|
|
135385
135385
|
if (checkFn(fullName, privateName)) {
|
|
135386
135386
|
if (privateName) {
|
|
135387
135387
|
reservePrivateNameInNestedScopes(fullName);
|
|
@@ -135398,7 +135398,7 @@ ${lanes.join("\n")}
|
|
|
135398
135398
|
}
|
|
135399
135399
|
let i = 1;
|
|
135400
135400
|
while (true) {
|
|
135401
|
-
const fullName = formatGeneratedName(privateName,
|
|
135401
|
+
const fullName = formatGeneratedName(privateName, prefix2, baseName + i, suffix);
|
|
135402
135402
|
if (checkFn(fullName, privateName)) {
|
|
135403
135403
|
if (privateName) {
|
|
135404
135404
|
reservePrivateNameInNestedScopes(fullName);
|
|
@@ -135495,7 +135495,7 @@ ${lanes.join("\n")}
|
|
|
135495
135495
|
""
|
|
135496
135496
|
);
|
|
135497
135497
|
}
|
|
135498
|
-
function generateNameForMethodOrAccessor(node, privateName,
|
|
135498
|
+
function generateNameForMethodOrAccessor(node, privateName, prefix2, suffix) {
|
|
135499
135499
|
if (isIdentifier3(node.name)) {
|
|
135500
135500
|
return generateNameCached(node.name, privateName);
|
|
135501
135501
|
}
|
|
@@ -135504,11 +135504,11 @@ ${lanes.join("\n")}
|
|
|
135504
135504
|
/*reservedInNestedScopes*/
|
|
135505
135505
|
false,
|
|
135506
135506
|
privateName,
|
|
135507
|
-
|
|
135507
|
+
prefix2,
|
|
135508
135508
|
suffix
|
|
135509
135509
|
);
|
|
135510
135510
|
}
|
|
135511
|
-
function generateNameForNode(node, privateName, flags,
|
|
135511
|
+
function generateNameForNode(node, privateName, flags, prefix2, suffix) {
|
|
135512
135512
|
switch (node.kind) {
|
|
135513
135513
|
case 80:
|
|
135514
135514
|
case 81:
|
|
@@ -135518,20 +135518,20 @@ ${lanes.join("\n")}
|
|
|
135518
135518
|
!!(flags & 16),
|
|
135519
135519
|
!!(flags & 8),
|
|
135520
135520
|
privateName,
|
|
135521
|
-
|
|
135521
|
+
prefix2,
|
|
135522
135522
|
suffix
|
|
135523
135523
|
);
|
|
135524
135524
|
case 267:
|
|
135525
135525
|
case 266:
|
|
135526
|
-
Debug.assert(!
|
|
135526
|
+
Debug.assert(!prefix2 && !suffix && !privateName);
|
|
135527
135527
|
return generateNameForModuleOrEnum(node);
|
|
135528
135528
|
case 272:
|
|
135529
135529
|
case 278:
|
|
135530
|
-
Debug.assert(!
|
|
135530
|
+
Debug.assert(!prefix2 && !suffix && !privateName);
|
|
135531
135531
|
return generateNameForImportOrExportDeclaration(node);
|
|
135532
135532
|
case 262:
|
|
135533
135533
|
case 263: {
|
|
135534
|
-
Debug.assert(!
|
|
135534
|
+
Debug.assert(!prefix2 && !suffix && !privateName);
|
|
135535
135535
|
const name = node.name;
|
|
135536
135536
|
if (name && !isGeneratedIdentifier(name)) {
|
|
135537
135537
|
return generateNameForNode(
|
|
@@ -135539,29 +135539,29 @@ ${lanes.join("\n")}
|
|
|
135539
135539
|
/*privateName*/
|
|
135540
135540
|
false,
|
|
135541
135541
|
flags,
|
|
135542
|
-
|
|
135542
|
+
prefix2,
|
|
135543
135543
|
suffix
|
|
135544
135544
|
);
|
|
135545
135545
|
}
|
|
135546
135546
|
return generateNameForExportDefault();
|
|
135547
135547
|
}
|
|
135548
135548
|
case 277:
|
|
135549
|
-
Debug.assert(!
|
|
135549
|
+
Debug.assert(!prefix2 && !suffix && !privateName);
|
|
135550
135550
|
return generateNameForExportDefault();
|
|
135551
135551
|
case 231:
|
|
135552
|
-
Debug.assert(!
|
|
135552
|
+
Debug.assert(!prefix2 && !suffix && !privateName);
|
|
135553
135553
|
return generateNameForClassExpression();
|
|
135554
135554
|
case 174:
|
|
135555
135555
|
case 177:
|
|
135556
135556
|
case 178:
|
|
135557
|
-
return generateNameForMethodOrAccessor(node, privateName,
|
|
135557
|
+
return generateNameForMethodOrAccessor(node, privateName, prefix2, suffix);
|
|
135558
135558
|
case 167:
|
|
135559
135559
|
return makeTempVariableName(
|
|
135560
135560
|
0,
|
|
135561
135561
|
/*reservedInNestedScopes*/
|
|
135562
135562
|
true,
|
|
135563
135563
|
privateName,
|
|
135564
|
-
|
|
135564
|
+
prefix2,
|
|
135565
135565
|
suffix
|
|
135566
135566
|
);
|
|
135567
135567
|
default:
|
|
@@ -135570,18 +135570,18 @@ ${lanes.join("\n")}
|
|
|
135570
135570
|
/*reservedInNestedScopes*/
|
|
135571
135571
|
false,
|
|
135572
135572
|
privateName,
|
|
135573
|
-
|
|
135573
|
+
prefix2,
|
|
135574
135574
|
suffix
|
|
135575
135575
|
);
|
|
135576
135576
|
}
|
|
135577
135577
|
}
|
|
135578
135578
|
function makeName(name) {
|
|
135579
135579
|
const autoGenerate = name.emitNode.autoGenerate;
|
|
135580
|
-
const
|
|
135580
|
+
const prefix2 = formatGeneratedNamePart(autoGenerate.prefix, generateName);
|
|
135581
135581
|
const suffix = formatGeneratedNamePart(autoGenerate.suffix);
|
|
135582
135582
|
switch (autoGenerate.flags & 7) {
|
|
135583
135583
|
case 1:
|
|
135584
|
-
return makeTempVariableName(0, !!(autoGenerate.flags & 8), isPrivateIdentifier(name),
|
|
135584
|
+
return makeTempVariableName(0, !!(autoGenerate.flags & 8), isPrivateIdentifier(name), prefix2, suffix);
|
|
135585
135585
|
case 2:
|
|
135586
135586
|
Debug.assertNode(name, isIdentifier3);
|
|
135587
135587
|
return makeTempVariableName(
|
|
@@ -135589,7 +135589,7 @@ ${lanes.join("\n")}
|
|
|
135589
135589
|
!!(autoGenerate.flags & 8),
|
|
135590
135590
|
/*privateName*/
|
|
135591
135591
|
false,
|
|
135592
|
-
|
|
135592
|
+
prefix2,
|
|
135593
135593
|
suffix
|
|
135594
135594
|
);
|
|
135595
135595
|
case 3:
|
|
@@ -135599,7 +135599,7 @@ ${lanes.join("\n")}
|
|
|
135599
135599
|
!!(autoGenerate.flags & 16),
|
|
135600
135600
|
!!(autoGenerate.flags & 8),
|
|
135601
135601
|
isPrivateIdentifier(name),
|
|
135602
|
-
|
|
135602
|
+
prefix2,
|
|
135603
135603
|
suffix
|
|
135604
135604
|
);
|
|
135605
135605
|
}
|
|
@@ -152155,8 +152155,8 @@ ${lanes.join("\n")}
|
|
|
152155
152155
|
}
|
|
152156
152156
|
function buildLinkParts(link, checker) {
|
|
152157
152157
|
var _a;
|
|
152158
|
-
const
|
|
152159
|
-
const parts = [linkPart(`{@${
|
|
152158
|
+
const prefix2 = isJSDocLink(link) ? "link" : isJSDocLinkCode(link) ? "linkcode" : "linkplain";
|
|
152159
|
+
const parts = [linkPart(`{@${prefix2} `)];
|
|
152160
152160
|
if (!link.name) {
|
|
152161
152161
|
if (link.text) {
|
|
152162
152162
|
parts.push(linkTextPart(link.text));
|
|
@@ -153629,9 +153629,9 @@ ${lanes.join("\n")}
|
|
|
153629
153629
|
let token = 0;
|
|
153630
153630
|
let lastNonTriviaToken = 0;
|
|
153631
153631
|
const templateStack = [];
|
|
153632
|
-
const { prefix, pushTemplate } = getPrefixFromLexState(lexState);
|
|
153633
|
-
text =
|
|
153634
|
-
const offset =
|
|
153632
|
+
const { prefix: prefix2, pushTemplate } = getPrefixFromLexState(lexState);
|
|
153633
|
+
text = prefix2 + text;
|
|
153634
|
+
const offset = prefix2.length;
|
|
153635
153635
|
if (pushTemplate) {
|
|
153636
153636
|
templateStack.push(
|
|
153637
153637
|
16
|
|
@@ -162789,11 +162789,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162789
162789
|
if (decls && decls.some((d3) => d3.parent === scopeDecl)) {
|
|
162790
162790
|
return factory.createIdentifier(symbol.name);
|
|
162791
162791
|
}
|
|
162792
|
-
const
|
|
162793
|
-
if (
|
|
162792
|
+
const prefix2 = tryReplaceWithQualifiedNameOrPropertyAccess(symbol.parent, scopeDecl, isTypeNode2);
|
|
162793
|
+
if (prefix2 === void 0) {
|
|
162794
162794
|
return void 0;
|
|
162795
162795
|
}
|
|
162796
|
-
return isTypeNode2 ? factory.createQualifiedName(
|
|
162796
|
+
return isTypeNode2 ? factory.createQualifiedName(prefix2, factory.createIdentifier(symbol.name)) : factory.createPropertyAccessExpression(prefix2, symbol.name);
|
|
162797
162797
|
}
|
|
162798
162798
|
}
|
|
162799
162799
|
function getExtractableParent(node) {
|
|
@@ -164108,13 +164108,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164108
164108
|
if (textChangeRange) {
|
|
164109
164109
|
if (version2 !== sourceFile.version) {
|
|
164110
164110
|
let newText;
|
|
164111
|
-
const
|
|
164111
|
+
const prefix2 = textChangeRange.span.start !== 0 ? sourceFile.text.substr(0, textChangeRange.span.start) : "";
|
|
164112
164112
|
const suffix = textSpanEnd(textChangeRange.span) !== sourceFile.text.length ? sourceFile.text.substr(textSpanEnd(textChangeRange.span)) : "";
|
|
164113
164113
|
if (textChangeRange.newLength === 0) {
|
|
164114
|
-
newText =
|
|
164114
|
+
newText = prefix2 && suffix ? prefix2 + suffix : prefix2 || suffix;
|
|
164115
164115
|
} else {
|
|
164116
164116
|
const changedText = scriptSnapshot.getText(textChangeRange.span.start, textChangeRange.span.start + textChangeRange.newLength);
|
|
164117
|
-
newText =
|
|
164117
|
+
newText = prefix2 && suffix ? prefix2 + changedText + suffix : prefix2 ? prefix2 + changedText : changedText + suffix;
|
|
164118
164118
|
}
|
|
164119
164119
|
const newSourceFile = updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
|
|
164120
164120
|
setSourceFileFields(newSourceFile, scriptSnapshot, version2);
|
|
@@ -166244,8 +166244,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166244
166244
|
const end = pos + 6;
|
|
166245
166245
|
const typeChecker = program.getTypeChecker();
|
|
166246
166246
|
const symbol = typeChecker.getSymbolAtLocation(node.parent);
|
|
166247
|
-
const
|
|
166248
|
-
return { text: `${
|
|
166247
|
+
const prefix2 = symbol ? `${typeChecker.symbolToString(symbol, node.parent)} ` : "";
|
|
166248
|
+
return { text: `${prefix2}static {}`, pos, end };
|
|
166249
166249
|
}
|
|
166250
166250
|
const declName = isAssignedExpression(node) ? node.parent.name : Debug.checkDefined(getNameOfDeclaration(node), "Expected call hierarchy item to have a name");
|
|
166251
166251
|
let text = isIdentifier3(declName) ? idText(declName) : isStringOrNumericLiteralLike(declName) ? declName.text : isComputedPropertyName(declName) ? isStringOrNumericLiteralLike(declName.expression) ? declName.expression.text : void 0 : void 0;
|
|
@@ -169591,18 +169591,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
169591
169591
|
const commentNode = node.parent;
|
|
169592
169592
|
const { leftSibling, rightSibling } = getLeftAndRightSiblings(node);
|
|
169593
169593
|
let pos = commentNode.getStart();
|
|
169594
|
-
let
|
|
169594
|
+
let prefix2 = "";
|
|
169595
169595
|
if (!leftSibling && commentNode.comment) {
|
|
169596
169596
|
pos = findEndOfTextBetween(commentNode, commentNode.getStart(), node.getStart());
|
|
169597
|
-
|
|
169597
|
+
prefix2 = `${newLine} */${newLine}`;
|
|
169598
169598
|
}
|
|
169599
169599
|
if (leftSibling) {
|
|
169600
169600
|
if (fixAll && isJSDocTypedefTag(leftSibling)) {
|
|
169601
169601
|
pos = node.getStart();
|
|
169602
|
-
|
|
169602
|
+
prefix2 = "";
|
|
169603
169603
|
} else {
|
|
169604
169604
|
pos = findEndOfTextBetween(commentNode, leftSibling.getStart(), node.getStart());
|
|
169605
|
-
|
|
169605
|
+
prefix2 = `${newLine} */${newLine}`;
|
|
169606
169606
|
}
|
|
169607
169607
|
}
|
|
169608
169608
|
let end = commentNode.getEnd();
|
|
@@ -169616,7 +169616,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
169616
169616
|
suffix = `${newLine}/**${newLine} * `;
|
|
169617
169617
|
}
|
|
169618
169618
|
}
|
|
169619
|
-
changes.replaceRange(sourceFile, { pos, end }, declaration, { prefix, suffix });
|
|
169619
|
+
changes.replaceRange(sourceFile, { pos, end }, declaration, { prefix: prefix2, suffix });
|
|
169620
169620
|
}
|
|
169621
169621
|
function getLeftAndRightSiblings(typedefNode) {
|
|
169622
169622
|
const commentNode = typedefNode.parent;
|
|
@@ -174034,9 +174034,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
174034
174034
|
result.push(createDeleteFix(deletion, [Diagnostics.Remove_unused_declaration_for_Colon_0, name.getText(sourceFile)]));
|
|
174035
174035
|
}
|
|
174036
174036
|
}
|
|
174037
|
-
const
|
|
174038
|
-
if (
|
|
174039
|
-
result.push(createCodeFixAction(fixName3,
|
|
174037
|
+
const prefix2 = ts_textChanges_exports.ChangeTracker.with(context, (t) => tryPrefixDeclaration(t, errorCode, sourceFile, token));
|
|
174038
|
+
if (prefix2.length) {
|
|
174039
|
+
result.push(createCodeFixAction(fixName3, prefix2, [Diagnostics.Prefix_0_with_an_underscore, token.getText(sourceFile)], fixIdPrefix, Diagnostics.Prefix_all_unused_declarations_with_where_possible));
|
|
174040
174040
|
}
|
|
174041
174041
|
return result;
|
|
174042
174042
|
},
|
|
@@ -183737,9 +183737,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
183737
183737
|
function getDirectoryMatches(directoryName) {
|
|
183738
183738
|
return mapDefined(tryGetDirectories(host, directoryName), (dir) => dir === "node_modules" ? void 0 : directoryResult(dir));
|
|
183739
183739
|
}
|
|
183740
|
-
function trimPrefixAndSuffix(path,
|
|
183740
|
+
function trimPrefixAndSuffix(path, prefix2) {
|
|
183741
183741
|
return firstDefined(matchingSuffixes, (suffix) => {
|
|
183742
|
-
const inner = withoutStartAndEnd(normalizePath(path),
|
|
183742
|
+
const inner = withoutStartAndEnd(normalizePath(path), prefix2, suffix);
|
|
183743
183743
|
return inner === void 0 ? void 0 : removeLeadingDirectorySeparator(inner);
|
|
183744
183744
|
});
|
|
183745
183745
|
}
|
|
@@ -183772,7 +183772,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
183772
183772
|
if (!match) {
|
|
183773
183773
|
return void 0;
|
|
183774
183774
|
}
|
|
183775
|
-
const [,
|
|
183775
|
+
const [, prefix2, kind, toComplete] = match;
|
|
183776
183776
|
const scriptPath = getDirectoryPath(sourceFile.path);
|
|
183777
183777
|
const names = kind === "path" ? getCompletionEntriesForDirectoryFragment(
|
|
183778
183778
|
toComplete,
|
|
@@ -183785,7 +183785,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
183785
183785
|
true,
|
|
183786
183786
|
sourceFile.path
|
|
183787
183787
|
) : kind === "types" ? getCompletionEntriesFromTypings(program, host, moduleSpecifierResolutionHost, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1, sourceFile)) : Debug.fail();
|
|
183788
|
-
return addReplacementSpans(toComplete, range.pos +
|
|
183788
|
+
return addReplacementSpans(toComplete, range.pos + prefix2.length, arrayFrom(names.values()));
|
|
183789
183789
|
}
|
|
183790
183790
|
function getCompletionEntriesFromTypings(program, host, moduleSpecifierResolutionHost, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
|
|
183791
183791
|
const options = program.getCompilerOptions();
|
|
@@ -190136,8 +190136,8 @@ ${content}
|
|
|
190136
190136
|
), spacePart()];
|
|
190137
190137
|
function getSignatureHelpItem(candidateSignature, callTargetDisplayParts, isTypeParameterList, checker, enclosingDeclaration, sourceFile) {
|
|
190138
190138
|
const infos = (isTypeParameterList ? itemInfoForTypeParameters : itemInfoForParameters)(candidateSignature, checker, enclosingDeclaration, sourceFile);
|
|
190139
|
-
return map(infos, ({ isVariadic, parameters, prefix, suffix }) => {
|
|
190140
|
-
const prefixDisplayParts = [...callTargetDisplayParts, ...
|
|
190139
|
+
return map(infos, ({ isVariadic, parameters, prefix: prefix2, suffix }) => {
|
|
190140
|
+
const prefixDisplayParts = [...callTargetDisplayParts, ...prefix2];
|
|
190141
190141
|
const suffixDisplayParts = [...suffix, ...returnTypeToDisplayParts(candidateSignature, enclosingDeclaration, checker)];
|
|
190142
190142
|
const documentation = candidateSignature.getDocumentationComment(checker);
|
|
190143
190143
|
const tags = candidateSignature.getJsDocTags();
|
|
@@ -192224,11 +192224,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
192224
192224
|
const noIndent = options.indentation !== void 0 || getLineStartPositionForPosition(pos, targetSourceFile) === pos ? text : text.replace(/^\s+/, "");
|
|
192225
192225
|
return (options.prefix || "") + noIndent + (!options.suffix || endsWith(noIndent, options.suffix) ? "" : options.suffix);
|
|
192226
192226
|
}
|
|
192227
|
-
function getFormattedTextOfNode(nodeIn, targetSourceFile, sourceFile, pos, { indentation, prefix, delta }, newLineCharacter, formatContext, validate) {
|
|
192227
|
+
function getFormattedTextOfNode(nodeIn, targetSourceFile, sourceFile, pos, { indentation, prefix: prefix2, delta }, newLineCharacter, formatContext, validate) {
|
|
192228
192228
|
const { node, text } = getNonformattedText(nodeIn, targetSourceFile, newLineCharacter);
|
|
192229
192229
|
if (validate) validate(node, text);
|
|
192230
192230
|
const formatOptions = getFormatCodeSettingsForWriting(formatContext, targetSourceFile);
|
|
192231
|
-
const initialIndentation = indentation !== void 0 ? indentation : ts_formatting_exports.SmartIndenter.getIndentation(pos, sourceFile, formatOptions,
|
|
192231
|
+
const initialIndentation = indentation !== void 0 ? indentation : ts_formatting_exports.SmartIndenter.getIndentation(pos, sourceFile, formatOptions, prefix2 === newLineCharacter || getLineStartPositionForPosition(pos, targetSourceFile) === pos);
|
|
192232
192232
|
if (delta === void 0) {
|
|
192233
192233
|
delta = ts_formatting_exports.SmartIndenter.shouldIndentChildNode(formatOptions, nodeIn) ? formatOptions.indentSize || 0 : 0;
|
|
192234
192234
|
}
|
|
@@ -209953,9 +209953,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
209953
209953
|
);
|
|
209954
209954
|
if (completions === void 0) return void 0;
|
|
209955
209955
|
if (kind === "completions-full") return completions;
|
|
209956
|
-
const
|
|
209956
|
+
const prefix2 = args.prefix || "";
|
|
209957
209957
|
const entries = mapDefined(completions.entries, (entry) => {
|
|
209958
|
-
if (completions.isMemberCompletion || startsWith(entry.name.toLowerCase(),
|
|
209958
|
+
if (completions.isMemberCompletion || startsWith(entry.name.toLowerCase(), prefix2.toLowerCase())) {
|
|
209959
209959
|
const convertedSpan = entry.replacementSpan ? toProtocolTextSpan(entry.replacementSpan, scriptInfo) : void 0;
|
|
209960
209960
|
return {
|
|
209961
209961
|
...entry,
|
|
@@ -214868,15 +214868,15 @@ var require_to_regex_range = __commonJS({
|
|
|
214868
214868
|
}
|
|
214869
214869
|
return tokens;
|
|
214870
214870
|
}
|
|
214871
|
-
function filterPatterns(arr, comparison,
|
|
214871
|
+
function filterPatterns(arr, comparison, prefix2, intersection, options) {
|
|
214872
214872
|
let result = [];
|
|
214873
214873
|
for (let ele of arr) {
|
|
214874
214874
|
let { string } = ele;
|
|
214875
214875
|
if (!intersection && !contains(comparison, "string", string)) {
|
|
214876
|
-
result.push(
|
|
214876
|
+
result.push(prefix2 + string);
|
|
214877
214877
|
}
|
|
214878
214878
|
if (intersection && contains(comparison, "string", string)) {
|
|
214879
|
-
result.push(
|
|
214879
|
+
result.push(prefix2 + string);
|
|
214880
214880
|
}
|
|
214881
214881
|
}
|
|
214882
214882
|
return result;
|
|
@@ -214987,7 +214987,7 @@ var require_fill_range = __commonJS({
|
|
|
214987
214987
|
var toSequence = (parts, options, maxLen) => {
|
|
214988
214988
|
parts.negatives.sort((a, b4) => a < b4 ? -1 : a > b4 ? 1 : 0);
|
|
214989
214989
|
parts.positives.sort((a, b4) => a < b4 ? -1 : a > b4 ? 1 : 0);
|
|
214990
|
-
let
|
|
214990
|
+
let prefix2 = options.capture ? "" : "?:";
|
|
214991
214991
|
let positives = "";
|
|
214992
214992
|
let negatives = "";
|
|
214993
214993
|
let result;
|
|
@@ -214995,7 +214995,7 @@ var require_fill_range = __commonJS({
|
|
|
214995
214995
|
positives = parts.positives.map((v) => toMaxLen(String(v), maxLen)).join("|");
|
|
214996
214996
|
}
|
|
214997
214997
|
if (parts.negatives.length) {
|
|
214998
|
-
negatives = `-(${
|
|
214998
|
+
negatives = `-(${prefix2}${parts.negatives.map((v) => toMaxLen(String(v), maxLen)).join("|")})`;
|
|
214999
214999
|
}
|
|
215000
215000
|
if (positives && negatives) {
|
|
215001
215001
|
result = `${positives}|${negatives}`;
|
|
@@ -215003,7 +215003,7 @@ var require_fill_range = __commonJS({
|
|
|
215003
215003
|
result = positives || negatives;
|
|
215004
215004
|
}
|
|
215005
215005
|
if (options.wrap) {
|
|
215006
|
-
return `(${
|
|
215006
|
+
return `(${prefix2}${result})`;
|
|
215007
215007
|
}
|
|
215008
215008
|
return result;
|
|
215009
215009
|
};
|
|
@@ -215019,8 +215019,8 @@ var require_fill_range = __commonJS({
|
|
|
215019
215019
|
var toRegex = (start, end, options) => {
|
|
215020
215020
|
if (Array.isArray(start)) {
|
|
215021
215021
|
let wrap = options.wrap === true;
|
|
215022
|
-
let
|
|
215023
|
-
return wrap ? `(${
|
|
215022
|
+
let prefix2 = options.capture ? "" : "?:";
|
|
215023
|
+
return wrap ? `(${prefix2}${start.join("|")})` : start.join("|");
|
|
215024
215024
|
}
|
|
215025
215025
|
return toRegexRange(start, end, options);
|
|
215026
215026
|
};
|
|
@@ -215142,20 +215142,20 @@ var require_compile = __commonJS({
|
|
|
215142
215142
|
const invalidBlock = utils.isInvalidBrace(parent);
|
|
215143
215143
|
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
215144
215144
|
const invalid = invalidBlock === true || invalidNode === true;
|
|
215145
|
-
const
|
|
215145
|
+
const prefix2 = options.escapeInvalid === true ? "\\" : "";
|
|
215146
215146
|
let output = "";
|
|
215147
215147
|
if (node.isOpen === true) {
|
|
215148
|
-
return
|
|
215148
|
+
return prefix2 + node.value;
|
|
215149
215149
|
}
|
|
215150
215150
|
if (node.isClose === true) {
|
|
215151
|
-
console.log("node.isClose",
|
|
215152
|
-
return
|
|
215151
|
+
console.log("node.isClose", prefix2, node.value);
|
|
215152
|
+
return prefix2 + node.value;
|
|
215153
215153
|
}
|
|
215154
215154
|
if (node.type === "open") {
|
|
215155
|
-
return invalid ?
|
|
215155
|
+
return invalid ? prefix2 + node.value : "(";
|
|
215156
215156
|
}
|
|
215157
215157
|
if (node.type === "close") {
|
|
215158
|
-
return invalid ?
|
|
215158
|
+
return invalid ? prefix2 + node.value : ")";
|
|
215159
215159
|
}
|
|
215160
215160
|
if (node.type === "comma") {
|
|
215161
215161
|
return node.prev.type === "comma" ? "" : invalid ? node.value : "|";
|
|
@@ -216191,10 +216191,10 @@ var require_scan = __commonJS({
|
|
|
216191
216191
|
isGlob = false;
|
|
216192
216192
|
}
|
|
216193
216193
|
let base = str;
|
|
216194
|
-
let
|
|
216194
|
+
let prefix2 = "";
|
|
216195
216195
|
let glob = "";
|
|
216196
216196
|
if (start > 0) {
|
|
216197
|
-
|
|
216197
|
+
prefix2 = str.slice(0, start);
|
|
216198
216198
|
str = str.slice(start);
|
|
216199
216199
|
lastIndex -= start;
|
|
216200
216200
|
}
|
|
@@ -216219,7 +216219,7 @@ var require_scan = __commonJS({
|
|
|
216219
216219
|
}
|
|
216220
216220
|
}
|
|
216221
216221
|
const state = {
|
|
216222
|
-
prefix,
|
|
216222
|
+
prefix: prefix2,
|
|
216223
216223
|
input,
|
|
216224
216224
|
start,
|
|
216225
216225
|
base,
|
|
@@ -216248,7 +216248,7 @@ var require_scan = __commonJS({
|
|
|
216248
216248
|
if (opts.tokens) {
|
|
216249
216249
|
if (idx === 0 && start !== 0) {
|
|
216250
216250
|
tokens[idx].isPrefix = true;
|
|
216251
|
-
tokens[idx].value =
|
|
216251
|
+
tokens[idx].value = prefix2;
|
|
216252
216252
|
} else {
|
|
216253
216253
|
tokens[idx].value = value;
|
|
216254
216254
|
}
|
|
@@ -220466,8 +220466,8 @@ ${nodeLocation}` : message;
|
|
|
220466
220466
|
errors.ArgumentTypeError = ArgumentTypeError;
|
|
220467
220467
|
class PathNotFoundError extends BaseError {
|
|
220468
220468
|
path;
|
|
220469
|
-
constructor(path2,
|
|
220470
|
-
super(`${
|
|
220469
|
+
constructor(path2, prefix2 = "Path") {
|
|
220470
|
+
super(`${prefix2} not found: ${path2}`);
|
|
220471
220471
|
this.path = path2;
|
|
220472
220472
|
}
|
|
220473
220473
|
code = "ENOENT";
|
|
@@ -276770,6 +276770,7 @@ var ERROR_CODES = {
|
|
|
276770
276770
|
browser_database_url_blocked: client("auth", "A database connection string must not be used from a browser context \u2014 it carries DB credentials."),
|
|
276771
276771
|
datasource_registration_failed: client("auth", "Failed to register the provided databaseUrl as a datasource."),
|
|
276772
276772
|
datasource_connection_unsupported: wire("validation", 400, false, "This deployment cannot register a direct (connection string) datasource \u2014 use the signed endpoint kind."),
|
|
276773
|
+
datasource_direct_deprecated: wire("validation", 410, false, "The direct (connection string) datasource is deprecated. Register a signed Data Source endpoint instead \u2014 your app owns the write and your credentials never leave it."),
|
|
276773
276774
|
// ── permission / capability (403) ──────────────────────────────────
|
|
276774
276775
|
capability_scope_denied: wire("capability", 403, false, "The connection's resolved scope does not cover the attempted action."),
|
|
276775
276776
|
issuer_register_forbidden: wire("permission", 403, false, "Registering a trusted issuer requires a secret (sk_) API key."),
|
|
@@ -276846,6 +276847,7 @@ var ERROR_CODES = {
|
|
|
276846
276847
|
unique_violation: wire("conflict", 409, false, "A value violates a uniqueness constraint."),
|
|
276847
276848
|
check_violation: wire("validation", 400, false, "A value violates a database check constraint."),
|
|
276848
276849
|
constraint_violation: wire("validation", 400, false, "A database integrity constraint was violated."),
|
|
276850
|
+
column_type_mismatch: wire("validation", 400, false, "A structured (JSON) value was written to a column whose database type cannot hold it. Ablo adapts a json field to either a jsonb column (native) or a text column (serialized) \u2014 but a scalar column (integer, boolean, uuid, timestamp, \u2026) cannot store a JSON object or array. Use a jsonb or text column for this field. Ablo adapts to your column; it does not alter your schema."),
|
|
276849
276851
|
// ── tenant / unknown model (400) ───────────────────────────────────
|
|
276850
276852
|
server_execute_unknown_model: wire("tenant", 400, false, "Wrote to a model the server does not know. The server keeps its own copy of the schema \u2014 run `ablo push` (or keep `ablo dev` running) to upload `ablo/schema.ts` before writing to new or changed models."),
|
|
276851
276853
|
mutate_create_unknown_model: wire("tenant", 400, false, "Created a model the server does not know. Run `ablo push` (or keep `ablo dev` running) to upload `ablo/schema.ts` first \u2014 the server keeps its own copy of the schema."),
|
|
@@ -277146,8 +277148,8 @@ var claimStatusSchema = import_zod3.z.enum([
|
|
|
277146
277148
|
]);
|
|
277147
277149
|
var wireClaimBaseSchema = targetRefSchema.extend({
|
|
277148
277150
|
claimId: import_zod3.z.string(),
|
|
277149
|
-
/**
|
|
277150
|
-
|
|
277151
|
+
/** Human-readable phase: 'editing' | 'reviewing' | 'forecasting' … */
|
|
277152
|
+
reason: import_zod3.z.string(),
|
|
277151
277153
|
/** Server-stamped declaration time (epoch ms). */
|
|
277152
277154
|
declaredAt: import_zod3.z.number(),
|
|
277153
277155
|
/** Server-computed TTL deadline (epoch ms). Readers treat as advisory. */
|
|
@@ -277156,7 +277158,7 @@ var wireClaimBaseSchema = targetRefSchema.extend({
|
|
|
277156
277158
|
});
|
|
277157
277159
|
var wireClaimSummarySchema = wireClaimBaseSchema.pick({
|
|
277158
277160
|
claimId: true,
|
|
277159
|
-
|
|
277161
|
+
reason: true,
|
|
277160
277162
|
declaredAt: true,
|
|
277161
277163
|
expiresAt: true,
|
|
277162
277164
|
entityType: true,
|
|
@@ -277201,8 +277203,7 @@ var modelClaimSchema = import_zod3.z.object({
|
|
|
277201
277203
|
id: import_zod3.z.string(),
|
|
277202
277204
|
actor: import_zod3.z.string(),
|
|
277203
277205
|
participantKind: wireParticipantKindSchema,
|
|
277204
|
-
/** Human-readable phase (`'editing'`).
|
|
277205
|
-
* wire carries the same value as `action` (healed on read). */
|
|
277206
|
+
/** Human-readable phase (`'editing'`). */
|
|
277206
277207
|
reason: import_zod3.z.string(),
|
|
277207
277208
|
description: import_zod3.z.string().optional(),
|
|
277208
277209
|
field: import_zod3.z.string().optional(),
|
|
@@ -277213,7 +277214,7 @@ var modelClaimSchema = import_zod3.z.object({
|
|
|
277213
277214
|
}).readonly();
|
|
277214
277215
|
var claimBeginPayloadSchema = targetRefSchema.extend({
|
|
277215
277216
|
claimId: import_zod3.z.string(),
|
|
277216
|
-
|
|
277217
|
+
reason: import_zod3.z.string(),
|
|
277217
277218
|
/** Hint for `expiresAt`; the server caps it. */
|
|
277218
277219
|
estimatedMs: import_zod3.z.number().optional(),
|
|
277219
277220
|
/**
|
|
@@ -279584,8 +279585,8 @@ var KIND_BY_PREFIX = [
|
|
|
279584
279585
|
["pk_", "publishable"]
|
|
279585
279586
|
];
|
|
279586
279587
|
function classifyCredentialKind(value) {
|
|
279587
|
-
for (const [
|
|
279588
|
-
if (value.startsWith(
|
|
279588
|
+
for (const [prefix2, kind] of KIND_BY_PREFIX) {
|
|
279589
|
+
if (value.startsWith(prefix2)) return kind;
|
|
279589
279590
|
}
|
|
279590
279591
|
return null;
|
|
279591
279592
|
}
|
|
@@ -279762,6 +279763,38 @@ function modeFromKey(key) {
|
|
|
279762
279763
|
if (/^(sk|rk)_live_/.test(key)) return "production";
|
|
279763
279764
|
return void 0;
|
|
279764
279765
|
}
|
|
279766
|
+
function prefix(key) {
|
|
279767
|
+
return key ? key.slice(0, 12) : null;
|
|
279768
|
+
}
|
|
279769
|
+
function describeEffectiveKey(activeMode, envKey, storedEntry) {
|
|
279770
|
+
const effectiveKey = envKey ?? storedEntry?.apiKey;
|
|
279771
|
+
const keySource = envKey ? "env" : storedEntry ? "stored" : null;
|
|
279772
|
+
const keyMode = effectiveKey ? modeFromKey(effectiveKey) ?? null : null;
|
|
279773
|
+
const keyMatchesActiveMode = keyMode ? keyMode === activeMode : null;
|
|
279774
|
+
const keyMatchesStoredActiveKey = envKey && storedEntry?.apiKey ? envKey === storedEntry.apiKey : null;
|
|
279775
|
+
let keyMismatch = null;
|
|
279776
|
+
if (keyMode && keyMode !== activeMode) {
|
|
279777
|
+
const sourceLabel = envKey ? "ABLO_API_KEY" : "stored active key";
|
|
279778
|
+
keyMismatch = {
|
|
279779
|
+
code: "key_mode_mismatch",
|
|
279780
|
+
message: `${sourceLabel} is a ${keyMode} key but the CLI mode is ${activeMode}. Requests use ${sourceLabel} (${prefix(effectiveKey)}...), not the active CLI mode.`
|
|
279781
|
+
};
|
|
279782
|
+
} else if (envKey && storedEntry?.apiKey && envKey !== storedEntry.apiKey) {
|
|
279783
|
+
keyMismatch = {
|
|
279784
|
+
code: "env_key_overrides_stored",
|
|
279785
|
+
message: `ABLO_API_KEY (${prefix(envKey)}...) overrides the stored ${activeMode} key (${prefix(storedEntry.apiKey)}...).`
|
|
279786
|
+
};
|
|
279787
|
+
}
|
|
279788
|
+
return {
|
|
279789
|
+
keyPrefix: prefix(effectiveKey),
|
|
279790
|
+
keySource,
|
|
279791
|
+
keyMode,
|
|
279792
|
+
storedKeyPrefix: prefix(storedEntry?.apiKey),
|
|
279793
|
+
keyMatchesActiveMode,
|
|
279794
|
+
keyMatchesStoredActiveKey,
|
|
279795
|
+
keyMismatch
|
|
279796
|
+
};
|
|
279797
|
+
}
|
|
279765
279798
|
function normalizeMode(value) {
|
|
279766
279799
|
return normalizeStoredMode(value);
|
|
279767
279800
|
}
|
|
@@ -281202,20 +281235,50 @@ async function ping(apiUrl2) {
|
|
|
281202
281235
|
clearTimeout(t);
|
|
281203
281236
|
}
|
|
281204
281237
|
}
|
|
281238
|
+
async function fetchPushedSchema(apiUrl2, apiKey) {
|
|
281239
|
+
if (!apiKey) return null;
|
|
281240
|
+
const ctrl = new AbortController();
|
|
281241
|
+
const t = setTimeout(() => ctrl.abort(), 3e3);
|
|
281242
|
+
try {
|
|
281243
|
+
const res = await fetch(`${apiUrl2}/api/schema`, {
|
|
281244
|
+
headers: { authorization: `Bearer ${apiKey}` },
|
|
281245
|
+
signal: ctrl.signal
|
|
281246
|
+
});
|
|
281247
|
+
if (!res.ok) return null;
|
|
281248
|
+
return await res.json();
|
|
281249
|
+
} catch {
|
|
281250
|
+
return null;
|
|
281251
|
+
} finally {
|
|
281252
|
+
clearTimeout(t);
|
|
281253
|
+
}
|
|
281254
|
+
}
|
|
281255
|
+
function formatConflict(conflict) {
|
|
281256
|
+
if (!conflict) return "";
|
|
281257
|
+
const parts = ["user", "agent", "system"].flatMap((k3) => conflict[k3] ? [`${k3}:${conflict[k3]}`] : []);
|
|
281258
|
+
return parts.length ? `{${parts.join(",")}}` : "";
|
|
281259
|
+
}
|
|
281205
281260
|
async function status(args = []) {
|
|
281206
281261
|
const apiUrl2 = (process.env.ABLO_API_URL ?? DEFAULT_URL).replace(/\/+$/, "");
|
|
281207
281262
|
const cfg = readConfig();
|
|
281208
281263
|
const mode2 = getMode();
|
|
281209
281264
|
if (args.includes("--json")) {
|
|
281210
281265
|
const entry = getKeyEntry(mode2);
|
|
281266
|
+
const key2 = describeEffectiveKey(mode2, process.env.ABLO_API_KEY, entry);
|
|
281211
281267
|
const plan2 = resolvePushPlan();
|
|
281212
281268
|
const activeProject2 = getActiveProject();
|
|
281269
|
+
const introspectKey = process.env.ABLO_API_KEY ?? entry?.apiKey;
|
|
281270
|
+
const pushed = await fetchPushedSchema(apiUrl2, introspectKey);
|
|
281213
281271
|
const out = {
|
|
281214
281272
|
mode: mode2,
|
|
281215
281273
|
// The locally-active project (`ablo projects use`); null = org-default.
|
|
281216
281274
|
project: activeProject2 ?? null,
|
|
281217
|
-
keyPrefix:
|
|
281218
|
-
keySource:
|
|
281275
|
+
keyPrefix: key2.keyPrefix,
|
|
281276
|
+
keySource: key2.keySource,
|
|
281277
|
+
keyMode: key2.keyMode,
|
|
281278
|
+
storedKeyPrefix: key2.storedKeyPrefix,
|
|
281279
|
+
keyMatchesActiveMode: key2.keyMatchesActiveMode,
|
|
281280
|
+
keyMatchesStoredActiveKey: key2.keyMatchesStoredActiveKey,
|
|
281281
|
+
keyMismatch: key2.keyMismatch,
|
|
281219
281282
|
organizationId: entry?.organizationId ?? null,
|
|
281220
281283
|
// What `ablo push` would do right now — the one-command answer to
|
|
281221
281284
|
// "why did push demand a different key" (2026-06-11 live-key incident).
|
|
@@ -281224,6 +281287,15 @@ async function status(args = []) {
|
|
|
281224
281287
|
keyPrefix: plan2.apiKey?.slice(0, 12) ?? null,
|
|
281225
281288
|
keySource: plan2.source
|
|
281226
281289
|
},
|
|
281290
|
+
// The schema ACTIVE on this key's plane — the typename/conflict the
|
|
281291
|
+
// engine enforces, which may differ from local `schema.ts`. null = the
|
|
281292
|
+
// server didn't answer (unreachable / old server / no key).
|
|
281293
|
+
schema: pushed ? {
|
|
281294
|
+
active: pushed.active,
|
|
281295
|
+
version: pushed.version ?? null,
|
|
281296
|
+
pushedAt: pushed.pushedAt ?? null,
|
|
281297
|
+
models: pushed.models
|
|
281298
|
+
} : null,
|
|
281227
281299
|
apiUrl: apiUrl2,
|
|
281228
281300
|
reachable: await ping(apiUrl2)
|
|
281229
281301
|
};
|
|
@@ -281241,6 +281313,11 @@ async function status(args = []) {
|
|
|
281241
281313
|
console.log(` ${import_picocolors10.default.yellow("!")} Not logged in \u2014 run ${import_picocolors10.default.bold("ablo login")}.`);
|
|
281242
281314
|
}
|
|
281243
281315
|
console.log(` ${import_picocolors10.default.dim("mode")} ${import_picocolors10.default.bold(mode2)}`);
|
|
281316
|
+
const activeEntry = getKeyEntry(mode2);
|
|
281317
|
+
const key = describeEffectiveKey(mode2, process.env.ABLO_API_KEY, activeEntry);
|
|
281318
|
+
if (key.keyMismatch) {
|
|
281319
|
+
console.log(` ${import_picocolors10.default.yellow("!")} ${import_picocolors10.default.yellow(key.keyMismatch.message)}`);
|
|
281320
|
+
}
|
|
281244
281321
|
const activeProject = getActiveProject();
|
|
281245
281322
|
console.log(
|
|
281246
281323
|
` ${import_picocolors10.default.dim("project")} ${activeProject ? `${import_picocolors10.default.bold(activeProject.slug)} ${import_picocolors10.default.dim(`(${activeProject.id})`)}` : import_picocolors10.default.bold("default")}`
|
|
@@ -281255,14 +281332,32 @@ async function status(args = []) {
|
|
|
281255
281332
|
console.log(` ${marker} ${m2.padEnd(10)} ${import_picocolors10.default.dim("\u2014 no key")}`);
|
|
281256
281333
|
}
|
|
281257
281334
|
}
|
|
281258
|
-
const org =
|
|
281335
|
+
const org = activeEntry?.organizationId;
|
|
281259
281336
|
if (org) console.log(` ${import_picocolors10.default.dim("org")} ${org}`);
|
|
281260
281337
|
const plan = resolvePushPlan();
|
|
281261
281338
|
console.log(
|
|
281262
281339
|
` ${import_picocolors10.default.dim("push")} ${plan.apiKey ? `${import_picocolors10.default.bold(plan.flow)} ${import_picocolors10.default.dim(`with ${plan.apiKey.slice(0, 12)}\u2026 (${plan.source})`)}` : `${import_picocolors10.default.bold(plan.flow)} ${import_picocolors10.default.yellow("\u2014 no credential")} ${import_picocolors10.default.dim(`(run ${import_picocolors10.default.bold("ablo login")} or set ${import_picocolors10.default.bold("ABLO_API_KEY")})`)}`}`
|
|
281263
281340
|
);
|
|
281264
281341
|
process.stdout.write(` ${import_picocolors10.default.dim("api")} ${apiUrl2} `);
|
|
281265
|
-
|
|
281342
|
+
const reachable = await ping(apiUrl2);
|
|
281343
|
+
console.log(reachable ? import_picocolors10.default.green("reachable") : import_picocolors10.default.red("unreachable"));
|
|
281344
|
+
if (reachable) {
|
|
281345
|
+
const introspectKey = process.env.ABLO_API_KEY ?? activeEntry?.apiKey;
|
|
281346
|
+
const pushed = await fetchPushedSchema(apiUrl2, introspectKey);
|
|
281347
|
+
if (pushed && pushed.active) {
|
|
281348
|
+
const when = pushed.pushedAt ? ` ${import_picocolors10.default.dim(`@ ${pushed.pushedAt.slice(0, 10)}`)}` : "";
|
|
281349
|
+
const ver = pushed.version != null ? ` ${import_picocolors10.default.dim(`(rev ${pushed.version})`)}` : "";
|
|
281350
|
+
console.log(` ${import_picocolors10.default.dim("schema")} ${import_picocolors10.default.bold(`${pushed.models.length} models pushed`)}${ver}${when}`);
|
|
281351
|
+
for (const m2 of pushed.models) {
|
|
281352
|
+
const tn = m2.typename === m2.key ? import_picocolors10.default.dim(`typename=${m2.typename}`) : import_picocolors10.default.yellow(`typename=${m2.typename}`);
|
|
281353
|
+
const conflict = formatConflict(m2.conflict);
|
|
281354
|
+
const conflictStr = conflict ? ` ${import_picocolors10.default.dim(`conflict=${conflict}`)}` : "";
|
|
281355
|
+
console.log(` ${import_picocolors10.default.dim("\u2022")} ${m2.key.padEnd(14)} ${tn}${conflictStr}`);
|
|
281356
|
+
}
|
|
281357
|
+
} else if (pushed && !pushed.active) {
|
|
281358
|
+
console.log(` ${import_picocolors10.default.dim("schema")} ${import_picocolors10.default.yellow("none pushed")} ${import_picocolors10.default.dim(`(run ${import_picocolors10.default.bold("ablo push")} or ${import_picocolors10.default.bold("ablo dev")})`)}`);
|
|
281359
|
+
}
|
|
281360
|
+
}
|
|
281266
281361
|
console.log();
|
|
281267
281362
|
}
|
|
281268
281363
|
|
|
@@ -282790,7 +282885,7 @@ function bailIfCancelled(value) {
|
|
|
282790
282885
|
}
|
|
282791
282886
|
var INIT_FRAMEWORKS = ["nextjs", "vite", "remix", "vanilla"];
|
|
282792
282887
|
var INIT_AUTHS = ["apikey", "firebase", "auth0", "clerk", "supabase", "betterauth", "jwt"];
|
|
282793
|
-
var INIT_STORAGES = ["
|
|
282888
|
+
var INIT_STORAGES = ["endpoint", "direct", "datasource"];
|
|
282794
282889
|
function parseInitArgs(args) {
|
|
282795
282890
|
const has = (flag2) => args.includes(flag2);
|
|
282796
282891
|
const val = (flag2) => {
|
|
@@ -282916,19 +283011,18 @@ async function init(args = []) {
|
|
|
282916
283011
|
const storageChoice = await chooseOption(
|
|
282917
283012
|
"storage",
|
|
282918
283013
|
opts.storage,
|
|
282919
|
-
"
|
|
283014
|
+
"endpoint",
|
|
282920
283015
|
INIT_STORAGES,
|
|
282921
|
-
|
|
282922
|
-
() =>
|
|
282923
|
-
message: "How should Ablo reach your database?",
|
|
282924
|
-
initialValue: "direct",
|
|
282925
|
-
options: [
|
|
282926
|
-
{ value: "direct", label: "Connection string (DATABASE_URL) \u2014 recommended" },
|
|
282927
|
-
{ value: "endpoint", label: "Signed endpoint in my app (credentials never leave it)" }
|
|
282928
|
-
]
|
|
282929
|
-
})
|
|
283016
|
+
false,
|
|
283017
|
+
() => Promise.resolve("endpoint")
|
|
282930
283018
|
);
|
|
282931
283019
|
const storage = storageChoice === "datasource" ? "endpoint" : storageChoice;
|
|
283020
|
+
if (storage === "direct") {
|
|
283021
|
+
Me(
|
|
283022
|
+
"`--storage direct` uses the deprecated databaseUrl connector. The signed Data\nSource endpoint is the supported path.",
|
|
283023
|
+
import_picocolors19.default.yellow("Deprecated")
|
|
283024
|
+
);
|
|
283025
|
+
}
|
|
282932
283026
|
const agent = await chooseBool(
|
|
282933
283027
|
opts.agent,
|
|
282934
283028
|
true,
|
|
@@ -283107,7 +283201,7 @@ export const schema = defineSchema({
|
|
|
283107
283201
|
}
|
|
283108
283202
|
function generateSyncConfig(auth, storage) {
|
|
283109
283203
|
const databaseLine = storage === "direct" ? `
|
|
283110
|
-
databaseUrl: process.env.DATABASE_URL, //
|
|
283204
|
+
databaseUrl: process.env.DATABASE_URL, // deprecated direct connector` : "";
|
|
283111
283205
|
const authLine = auth === "apikey" ? "" : auth === "firebase" ? `
|
|
283112
283206
|
auth: async () => {
|
|
283113
283207
|
const { getAuth } = await import('firebase/auth');
|
|
@@ -283122,11 +283216,10 @@ function generateSyncConfig(auth, storage) {
|
|
|
283122
283216
|
return `import Ablo from '@abloatai/ablo';
|
|
283123
283217
|
import { schema } from './schema';
|
|
283124
283218
|
|
|
283125
|
-
// SERVER-ONLY client \u2014 it holds your \`sk_\` key
|
|
283126
|
-
//
|
|
283127
|
-
//
|
|
283128
|
-
//
|
|
283129
|
-
// session route and never touches the key or the database URL.
|
|
283219
|
+
// SERVER-ONLY client \u2014 it holds your \`sk_\` key. Use it from server code: the
|
|
283220
|
+
// agent script and the /api/ablo-session route. Do NOT import this into a browser
|
|
283221
|
+
// ('use client') component; the browser uses app/providers.tsx, which authenticates
|
|
283222
|
+
// via the session route and never touches the key.
|
|
283130
283223
|
export const sync = Ablo({
|
|
283131
283224
|
apiKey: process.env.ABLO_API_KEY,${databaseLine}${authLine}
|
|
283132
283225
|
schema,
|
|
@@ -283152,7 +283245,7 @@ export {};
|
|
|
283152
283245
|
}
|
|
283153
283246
|
function generateEnv(storage, opts = {}) {
|
|
283154
283247
|
const { includeApiKey = true } = opts;
|
|
283155
|
-
const databaseBlock = storage === "direct" ? "#
|
|
283248
|
+
const databaseBlock = storage === "direct" ? "# DEPRECATED direct connector. The client registers this connection (sent once\n# over TLS, stored sealed) so Ablo dials into your Postgres. Prefer a signed Data\n# Source endpoint; to keep the transaction log in your infra too, self-host the engine.\n# Use a dedicated non-superuser role; the browser never sees this value.\nDATABASE_URL=postgres://user:password@host:5432/db\n" : "# Used by ablo/data-source.ts (your DB endpoint) + `ablo migrate` \u2014 NOT the client.\n# Ablo never sees it; the browser never sees it. Your DB stays in your app.\nDATABASE_URL=postgres://user:password@host:5432/db\n";
|
|
283156
283249
|
const webhookBlock = storage === "endpoint" ? "# Signing secret for the webhook receiver (app/api/ablo/webhooks/route.ts).\n# Ablo mints this when you register the endpoint's URL (POST /v1/webhook_endpoints\n# or the dashboard) and returns it once \u2014 paste it here.\nABLO_WEBHOOK_SECRET=whsec_your_endpoint_secret_here\n" : "";
|
|
283157
283250
|
const apiKeyBlock = includeApiKey ? "# Ablo Sync Engine \u2014 use a sk_test_ key for local dev (`npx ablo push`)\nABLO_API_KEY=sk_test_your_key_here\n" : "";
|
|
283158
283251
|
return `${apiKeyBlock}${webhookBlock}${databaseBlock}`;
|