@dereekb/dbx-cli 13.11.8 → 13.11.10
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/index.cjs.js
CHANGED
|
@@ -8940,7 +8940,7 @@ function buildModelCommand(model, entries, context) {
|
|
|
8940
8940
|
}
|
|
8941
8941
|
}
|
|
8942
8942
|
}
|
|
8943
|
-
yargs.command(buildPerModelGetCommand(model));
|
|
8943
|
+
yargs.command(buildPerModelGetCommand(model, context.modelManifest));
|
|
8944
8944
|
hideGlobalOptions(yargs, context.hideOnFocus);
|
|
8945
8945
|
return yargs.demandCommand(1, 'Please specify an action.');
|
|
8946
8946
|
},
|
|
@@ -8950,24 +8950,85 @@ function buildModelCommand(model, entries, context) {
|
|
|
8950
8950
|
};
|
|
8951
8951
|
}
|
|
8952
8952
|
/**
|
|
8953
|
-
*
|
|
8953
|
+
* Resolves a per-model `get` positional into the full Firestore key the backend expects.
|
|
8954
8954
|
*
|
|
8955
|
-
* The
|
|
8956
|
-
*
|
|
8957
|
-
*
|
|
8958
|
-
|
|
8955
|
+
* The backend's `ModelApiController.getOne` only accepts full `prefix/id` keys, so a bare doc id
|
|
8956
|
+
* has to be expanded before the HTTP call. The expansion is only safe for top-level (root) models
|
|
8957
|
+
* whose `collectionPrefix` is enough to address the document — subcollection models also need the
|
|
8958
|
+
* parent prefix/id and cannot be reconstructed from a bare id alone.
|
|
8959
|
+
*
|
|
8960
|
+
* Rules:
|
|
8961
|
+
* 1. Keys containing `/` are treated as full keys and passed through verbatim.
|
|
8962
|
+
* 2. Bare ids on a top-level model resolve to `<collectionPrefix>/<id>` via the manifest.
|
|
8963
|
+
* 3. Bare ids on a subcollection model throw — the parent path is required.
|
|
8964
|
+
* 4. When the manifest is not wired, bare ids pass through unchanged (preserves the old behavior
|
|
8965
|
+
* so the CLI still works without `modelManifest` even though the backend will reject the call).
|
|
8966
|
+
*
|
|
8967
|
+
* @param model - The persisted model type (e.g. `profile`).
|
|
8968
|
+
* @param key - The trimmed `<key>` positional from yargs — full `prefix/id` or bare doc id.
|
|
8969
|
+
* @param manifest - The generated model manifest used to look up the model's `collectionPrefix`
|
|
8970
|
+
* and `parentIdentityConst`. When omitted, the key passes through unchanged.
|
|
8971
|
+
* @returns The resolved Firestore model key ready for `context.getModel(model, key)`.
|
|
8972
|
+
* @__NO_SIDE_EFFECTS__
|
|
8973
|
+
*/ function resolvePerModelGetKey(model, key, manifest) {
|
|
8974
|
+
var result = key;
|
|
8975
|
+
if (!key.includes('/')) {
|
|
8976
|
+
var entry = manifest === null || manifest === void 0 ? void 0 : manifest.find(function(e) {
|
|
8977
|
+
return e.modelType === model;
|
|
8978
|
+
});
|
|
8979
|
+
if (entry) {
|
|
8980
|
+
if (entry.parentIdentityConst) {
|
|
8981
|
+
throw new CliError({
|
|
8982
|
+
message: "get: model '".concat(model, "' is a subcollection — bare doc id '").concat(key, "' is ambiguous without the parent path. Provide a full key (e.g. '<parentPrefix>/<parentId>/").concat(entry.collectionPrefix, "/").concat(key, "')."),
|
|
8983
|
+
code: 'INVALID_ARGUMENT'
|
|
8984
|
+
});
|
|
8985
|
+
}
|
|
8986
|
+
result = "".concat(entry.collectionPrefix, "/").concat(key);
|
|
8987
|
+
}
|
|
8988
|
+
}
|
|
8989
|
+
return result;
|
|
8990
|
+
}
|
|
8991
|
+
/**
|
|
8992
|
+
* Synthetic per-model `get` sub-command appended to every model's command tree.
|
|
8993
|
+
*
|
|
8994
|
+
* The parent `model <name>` already fixes the `modelType`. The command shape varies by whether
|
|
8995
|
+
* the model is root-level (no parent) or a subcollection — only root models can address documents
|
|
8996
|
+
* by bare doc id, so subcollection models keep the `<key>` positional (full `prefix/id` required):
|
|
8997
|
+
*
|
|
8998
|
+
* - **Root model with a wired manifest entry** — `get <id-or-key>` accepts either a bare doc id
|
|
8999
|
+
* (expanded to `<collectionPrefix>/<id>` via {@link resolvePerModelGetKey}) or a full
|
|
9000
|
+
* `<prefix>/<id>` key.
|
|
9001
|
+
* - **Subcollection model with a wired manifest entry** — `get <key>` requires the full
|
|
9002
|
+
* `<parentPrefix>/<parentId>/<childPrefix>/<childId>` path. Bare doc ids are rejected with a
|
|
9003
|
+
* clear error because the parent path cannot be reconstructed from the id alone.
|
|
9004
|
+
* - **No wired model manifest** — falls back to `get <key>`; the key is forwarded verbatim and
|
|
9005
|
+
* the backend will reject anything that is not a full `prefix/id` key.
|
|
9006
|
+
*
|
|
9007
|
+
* @param model - The persisted model type owning this `get` subcommand.
|
|
9008
|
+
* @param manifest - The generated model manifest used by {@link resolvePerModelGetKey} to expand
|
|
9009
|
+
* bare doc ids into full keys for top-level models and to pick the command shape.
|
|
9010
|
+
* @returns The yargs `CommandModule` registered under the model's command tree.
|
|
9011
|
+
*/ function buildPerModelGetCommand(model, manifest) {
|
|
9012
|
+
var entry = manifest === null || manifest === void 0 ? void 0 : manifest.find(function(e) {
|
|
9013
|
+
return e.modelType === model;
|
|
9014
|
+
});
|
|
9015
|
+
var isRootModel = entry != null && !entry.parentIdentityConst;
|
|
9016
|
+
var positionalName = isRootModel ? 'idOrKey' : 'key';
|
|
9017
|
+
var placeholder = isRootModel ? '<id-or-key>' : '<key>';
|
|
9018
|
+
var positionalDescribe = isRootModel ? "Firestore key for the ".concat(model, " document — bare doc id (resolved to `").concat(entry.collectionPrefix, "/<id>`) or full `prefix/id`.") : "Firestore key for the ".concat(model, " document (full `prefix/id` — bare doc id is not supported").concat(entry ? ' for this subcollection model' : '', ").");
|
|
9019
|
+
var commandDescribe = isRootModel ? "Read a single ".concat(model, " document by id or key.") : "Read a single ".concat(model, " document by key.");
|
|
8959
9020
|
return {
|
|
8960
|
-
command:
|
|
8961
|
-
describe:
|
|
9021
|
+
command: "get ".concat(placeholder),
|
|
9022
|
+
describe: commandDescribe,
|
|
8962
9023
|
builder: function builder(yargs) {
|
|
8963
|
-
return yargs.positional(
|
|
9024
|
+
return yargs.positional(positionalName, {
|
|
8964
9025
|
type: 'string',
|
|
8965
|
-
describe:
|
|
9026
|
+
describe: positionalDescribe
|
|
8966
9027
|
});
|
|
8967
9028
|
},
|
|
8968
9029
|
handler: function handler(argv) {
|
|
8969
9030
|
return _async_to_generator$1(function() {
|
|
8970
|
-
var ctx, key, result, e;
|
|
9031
|
+
var ctx, raw, key, resolvedKey, result, e;
|
|
8971
9032
|
return _ts_generator$1(this, function(_state) {
|
|
8972
9033
|
switch(_state.label){
|
|
8973
9034
|
case 0:
|
|
@@ -8978,16 +9039,18 @@ function buildModelCommand(model, entries, context) {
|
|
|
8978
9039
|
3
|
|
8979
9040
|
]);
|
|
8980
9041
|
ctx = requireCliContext();
|
|
8981
|
-
|
|
9042
|
+
raw = argv[positionalName];
|
|
9043
|
+
key = typeof raw === 'string' ? raw.trim() : '';
|
|
8982
9044
|
if (key.length === 0) {
|
|
8983
9045
|
throw new CliError({
|
|
8984
|
-
message: "get: missing required
|
|
9046
|
+
message: "get: missing required ".concat(placeholder, " positional for model '").concat(model, "'."),
|
|
8985
9047
|
code: 'INVALID_ARGUMENT'
|
|
8986
9048
|
});
|
|
8987
9049
|
}
|
|
9050
|
+
resolvedKey = resolvePerModelGetKey(model, key, manifest);
|
|
8988
9051
|
return [
|
|
8989
9052
|
4,
|
|
8990
|
-
ctx.getModel(model,
|
|
9053
|
+
ctx.getModel(model, resolvedKey)
|
|
8991
9054
|
];
|
|
8992
9055
|
case 1:
|
|
8993
9056
|
result = _state.sent();
|
|
@@ -10045,6 +10108,7 @@ exports.requireCliContext = requireCliContext;
|
|
|
10045
10108
|
exports.resolveActiveEnvName = resolveActiveEnvName;
|
|
10046
10109
|
exports.resolveCliModel = resolveCliModel;
|
|
10047
10110
|
exports.resolveOutputConfig = resolveOutputConfig;
|
|
10111
|
+
exports.resolvePerModelGetKey = resolvePerModelGetKey;
|
|
10048
10112
|
exports.revokeToken = revokeToken;
|
|
10049
10113
|
exports.runCli = runCli;
|
|
10050
10114
|
exports.runPaginatedList = runPaginatedList;
|
package/index.esm.js
CHANGED
|
@@ -8938,7 +8938,7 @@ function buildModelCommand(model, entries, context) {
|
|
|
8938
8938
|
}
|
|
8939
8939
|
}
|
|
8940
8940
|
}
|
|
8941
|
-
yargs.command(buildPerModelGetCommand(model));
|
|
8941
|
+
yargs.command(buildPerModelGetCommand(model, context.modelManifest));
|
|
8942
8942
|
hideGlobalOptions(yargs, context.hideOnFocus);
|
|
8943
8943
|
return yargs.demandCommand(1, 'Please specify an action.');
|
|
8944
8944
|
},
|
|
@@ -8948,24 +8948,85 @@ function buildModelCommand(model, entries, context) {
|
|
|
8948
8948
|
};
|
|
8949
8949
|
}
|
|
8950
8950
|
/**
|
|
8951
|
-
*
|
|
8951
|
+
* Resolves a per-model `get` positional into the full Firestore key the backend expects.
|
|
8952
8952
|
*
|
|
8953
|
-
* The
|
|
8954
|
-
*
|
|
8955
|
-
*
|
|
8956
|
-
|
|
8953
|
+
* The backend's `ModelApiController.getOne` only accepts full `prefix/id` keys, so a bare doc id
|
|
8954
|
+
* has to be expanded before the HTTP call. The expansion is only safe for top-level (root) models
|
|
8955
|
+
* whose `collectionPrefix` is enough to address the document — subcollection models also need the
|
|
8956
|
+
* parent prefix/id and cannot be reconstructed from a bare id alone.
|
|
8957
|
+
*
|
|
8958
|
+
* Rules:
|
|
8959
|
+
* 1. Keys containing `/` are treated as full keys and passed through verbatim.
|
|
8960
|
+
* 2. Bare ids on a top-level model resolve to `<collectionPrefix>/<id>` via the manifest.
|
|
8961
|
+
* 3. Bare ids on a subcollection model throw — the parent path is required.
|
|
8962
|
+
* 4. When the manifest is not wired, bare ids pass through unchanged (preserves the old behavior
|
|
8963
|
+
* so the CLI still works without `modelManifest` even though the backend will reject the call).
|
|
8964
|
+
*
|
|
8965
|
+
* @param model - The persisted model type (e.g. `profile`).
|
|
8966
|
+
* @param key - The trimmed `<key>` positional from yargs — full `prefix/id` or bare doc id.
|
|
8967
|
+
* @param manifest - The generated model manifest used to look up the model's `collectionPrefix`
|
|
8968
|
+
* and `parentIdentityConst`. When omitted, the key passes through unchanged.
|
|
8969
|
+
* @returns The resolved Firestore model key ready for `context.getModel(model, key)`.
|
|
8970
|
+
* @__NO_SIDE_EFFECTS__
|
|
8971
|
+
*/ function resolvePerModelGetKey(model, key, manifest) {
|
|
8972
|
+
var result = key;
|
|
8973
|
+
if (!key.includes('/')) {
|
|
8974
|
+
var entry = manifest === null || manifest === void 0 ? void 0 : manifest.find(function(e) {
|
|
8975
|
+
return e.modelType === model;
|
|
8976
|
+
});
|
|
8977
|
+
if (entry) {
|
|
8978
|
+
if (entry.parentIdentityConst) {
|
|
8979
|
+
throw new CliError({
|
|
8980
|
+
message: "get: model '".concat(model, "' is a subcollection — bare doc id '").concat(key, "' is ambiguous without the parent path. Provide a full key (e.g. '<parentPrefix>/<parentId>/").concat(entry.collectionPrefix, "/").concat(key, "')."),
|
|
8981
|
+
code: 'INVALID_ARGUMENT'
|
|
8982
|
+
});
|
|
8983
|
+
}
|
|
8984
|
+
result = "".concat(entry.collectionPrefix, "/").concat(key);
|
|
8985
|
+
}
|
|
8986
|
+
}
|
|
8987
|
+
return result;
|
|
8988
|
+
}
|
|
8989
|
+
/**
|
|
8990
|
+
* Synthetic per-model `get` sub-command appended to every model's command tree.
|
|
8991
|
+
*
|
|
8992
|
+
* The parent `model <name>` already fixes the `modelType`. The command shape varies by whether
|
|
8993
|
+
* the model is root-level (no parent) or a subcollection — only root models can address documents
|
|
8994
|
+
* by bare doc id, so subcollection models keep the `<key>` positional (full `prefix/id` required):
|
|
8995
|
+
*
|
|
8996
|
+
* - **Root model with a wired manifest entry** — `get <id-or-key>` accepts either a bare doc id
|
|
8997
|
+
* (expanded to `<collectionPrefix>/<id>` via {@link resolvePerModelGetKey}) or a full
|
|
8998
|
+
* `<prefix>/<id>` key.
|
|
8999
|
+
* - **Subcollection model with a wired manifest entry** — `get <key>` requires the full
|
|
9000
|
+
* `<parentPrefix>/<parentId>/<childPrefix>/<childId>` path. Bare doc ids are rejected with a
|
|
9001
|
+
* clear error because the parent path cannot be reconstructed from the id alone.
|
|
9002
|
+
* - **No wired model manifest** — falls back to `get <key>`; the key is forwarded verbatim and
|
|
9003
|
+
* the backend will reject anything that is not a full `prefix/id` key.
|
|
9004
|
+
*
|
|
9005
|
+
* @param model - The persisted model type owning this `get` subcommand.
|
|
9006
|
+
* @param manifest - The generated model manifest used by {@link resolvePerModelGetKey} to expand
|
|
9007
|
+
* bare doc ids into full keys for top-level models and to pick the command shape.
|
|
9008
|
+
* @returns The yargs `CommandModule` registered under the model's command tree.
|
|
9009
|
+
*/ function buildPerModelGetCommand(model, manifest) {
|
|
9010
|
+
var entry = manifest === null || manifest === void 0 ? void 0 : manifest.find(function(e) {
|
|
9011
|
+
return e.modelType === model;
|
|
9012
|
+
});
|
|
9013
|
+
var isRootModel = entry != null && !entry.parentIdentityConst;
|
|
9014
|
+
var positionalName = isRootModel ? 'idOrKey' : 'key';
|
|
9015
|
+
var placeholder = isRootModel ? '<id-or-key>' : '<key>';
|
|
9016
|
+
var positionalDescribe = isRootModel ? "Firestore key for the ".concat(model, " document — bare doc id (resolved to `").concat(entry.collectionPrefix, "/<id>`) or full `prefix/id`.") : "Firestore key for the ".concat(model, " document (full `prefix/id` — bare doc id is not supported").concat(entry ? ' for this subcollection model' : '', ").");
|
|
9017
|
+
var commandDescribe = isRootModel ? "Read a single ".concat(model, " document by id or key.") : "Read a single ".concat(model, " document by key.");
|
|
8957
9018
|
return {
|
|
8958
|
-
command:
|
|
8959
|
-
describe:
|
|
9019
|
+
command: "get ".concat(placeholder),
|
|
9020
|
+
describe: commandDescribe,
|
|
8960
9021
|
builder: function builder(yargs) {
|
|
8961
|
-
return yargs.positional(
|
|
9022
|
+
return yargs.positional(positionalName, {
|
|
8962
9023
|
type: 'string',
|
|
8963
|
-
describe:
|
|
9024
|
+
describe: positionalDescribe
|
|
8964
9025
|
});
|
|
8965
9026
|
},
|
|
8966
9027
|
handler: function handler(argv) {
|
|
8967
9028
|
return _async_to_generator$1(function() {
|
|
8968
|
-
var ctx, key, result, e;
|
|
9029
|
+
var ctx, raw, key, resolvedKey, result, e;
|
|
8969
9030
|
return _ts_generator$1(this, function(_state) {
|
|
8970
9031
|
switch(_state.label){
|
|
8971
9032
|
case 0:
|
|
@@ -8976,16 +9037,18 @@ function buildModelCommand(model, entries, context) {
|
|
|
8976
9037
|
3
|
|
8977
9038
|
]);
|
|
8978
9039
|
ctx = requireCliContext();
|
|
8979
|
-
|
|
9040
|
+
raw = argv[positionalName];
|
|
9041
|
+
key = typeof raw === 'string' ? raw.trim() : '';
|
|
8980
9042
|
if (key.length === 0) {
|
|
8981
9043
|
throw new CliError({
|
|
8982
|
-
message: "get: missing required
|
|
9044
|
+
message: "get: missing required ".concat(placeholder, " positional for model '").concat(model, "'."),
|
|
8983
9045
|
code: 'INVALID_ARGUMENT'
|
|
8984
9046
|
});
|
|
8985
9047
|
}
|
|
9048
|
+
resolvedKey = resolvePerModelGetKey(model, key, manifest);
|
|
8986
9049
|
return [
|
|
8987
9050
|
4,
|
|
8988
|
-
ctx.getModel(model,
|
|
9051
|
+
ctx.getModel(model, resolvedKey)
|
|
8989
9052
|
];
|
|
8990
9053
|
case 1:
|
|
8991
9054
|
result = _state.sent();
|
|
@@ -9953,4 +10016,4 @@ function printPaginatedOutput(input) {
|
|
|
9953
10016
|
})();
|
|
9954
10017
|
}
|
|
9955
10018
|
|
|
9956
|
-
export { CALL_MODEL_API_PATH, CliError, DEFAULT_CLI_OIDC_SCOPES, DEFAULT_CLI_REDIRECT_URI, DEFAULT_CLI_SECRET_PATTERNS, DEFAULT_MANIFEST_HELP_DATA_FORMAT, DEFAULT_MANIFEST_HELP_MODE, DEFAULT_MANIFEST_MODEL_COMMAND_NAME, DEFAULT_MODEL_DECODE_COMMAND_NAME, DEFAULT_MODEL_INFO_COMMAND_NAME, DUMP_MERGE_MODES, DUMP_OUTPUT_MODES, MAX_MODEL_ACCESS_MULTI_READ_KEYS, MODEL_WRITE_OIDC_SCOPES, MULTIPLE_PAGES_OUTPUT_MODES, PROMPT_CANCELLED_ERROR_CODE, STANDARD_GLOBAL_OPTION_NAMES, applyEnvVarOverrides, buildAuthorizationUrl, buildCliPaths, buildDumpFilePath, buildErrorOutput, buildManifestCommands, buildModelDecodeCommand, buildModelInfoCommand, buildOidcDiscoveryCandidates, callModelOverHttp, callPassthroughCommand, configureCliErrorMapper, configureCliSecretPatterns, configureOutputOptions, createAuthCommand, createAuthMiddleware, createCallModelCommand, createCli, createCliContext, createCliTokenCacheStore, createContextSlot, createDoctorCommand, createEnvCommand, createOutputCommand, createOutputMiddleware, decodeFirestoreModelKey, defaultDoctorChecks, detectDataHelpFormat, detectHelpMode, discoverOidcMetadata, dumpTimestamp, exchangeAuthorizationCode, expandModelKeys, fetchUserInfo, filterReadOnlyModelScopes, findCliEnvDefault, findCliModelManifestEntry, generateOAuthState, generatePkceMaterial, getCliContext, getCommand, getManyCommand, getModelOverHttp, getMultipleModelsOverHttp, getOutputOptions, isCliEnvConfigComplete, isTokenExpired, loadCliConfig, maskSecret, mergeCliConfig, mergeCliEnvWithDefault, mergeOutputConfig, openStreamingDump, outputError, outputResult, parseGetArgs, parseGetManyArgs, parsePastedRedirect, pickFields, promptLine, refreshAccessToken, renderDecodedKey, renderModelManifestEntry, renderModelManifestFields, renderModelManifestList, requireCliContext, resolveActiveEnvName, resolveCliModel, resolveOutputConfig, revokeToken, runCli, runPaginatedList, sanitizeString, saveCliConfig, setCliContext, withCallModelArgs, withEnv, withMultiplePages, withOutput, wrapCommandHandler };
|
|
10019
|
+
export { CALL_MODEL_API_PATH, CliError, DEFAULT_CLI_OIDC_SCOPES, DEFAULT_CLI_REDIRECT_URI, DEFAULT_CLI_SECRET_PATTERNS, DEFAULT_MANIFEST_HELP_DATA_FORMAT, DEFAULT_MANIFEST_HELP_MODE, DEFAULT_MANIFEST_MODEL_COMMAND_NAME, DEFAULT_MODEL_DECODE_COMMAND_NAME, DEFAULT_MODEL_INFO_COMMAND_NAME, DUMP_MERGE_MODES, DUMP_OUTPUT_MODES, MAX_MODEL_ACCESS_MULTI_READ_KEYS, MODEL_WRITE_OIDC_SCOPES, MULTIPLE_PAGES_OUTPUT_MODES, PROMPT_CANCELLED_ERROR_CODE, STANDARD_GLOBAL_OPTION_NAMES, applyEnvVarOverrides, buildAuthorizationUrl, buildCliPaths, buildDumpFilePath, buildErrorOutput, buildManifestCommands, buildModelDecodeCommand, buildModelInfoCommand, buildOidcDiscoveryCandidates, callModelOverHttp, callPassthroughCommand, configureCliErrorMapper, configureCliSecretPatterns, configureOutputOptions, createAuthCommand, createAuthMiddleware, createCallModelCommand, createCli, createCliContext, createCliTokenCacheStore, createContextSlot, createDoctorCommand, createEnvCommand, createOutputCommand, createOutputMiddleware, decodeFirestoreModelKey, defaultDoctorChecks, detectDataHelpFormat, detectHelpMode, discoverOidcMetadata, dumpTimestamp, exchangeAuthorizationCode, expandModelKeys, fetchUserInfo, filterReadOnlyModelScopes, findCliEnvDefault, findCliModelManifestEntry, generateOAuthState, generatePkceMaterial, getCliContext, getCommand, getManyCommand, getModelOverHttp, getMultipleModelsOverHttp, getOutputOptions, isCliEnvConfigComplete, isTokenExpired, loadCliConfig, maskSecret, mergeCliConfig, mergeCliEnvWithDefault, mergeOutputConfig, openStreamingDump, outputError, outputResult, parseGetArgs, parseGetManyArgs, parsePastedRedirect, pickFields, promptLine, refreshAccessToken, renderDecodedKey, renderModelManifestEntry, renderModelManifestFields, renderModelManifestList, requireCliContext, resolveActiveEnvName, resolveCliModel, resolveOutputConfig, resolvePerModelGetKey, revokeToken, runCli, runPaginatedList, sanitizeString, saveCliConfig, setCliContext, withCallModelArgs, withEnv, withMultiplePages, withOutput, wrapCommandHandler };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli",
|
|
3
|
-
"version": "13.11.
|
|
3
|
+
"version": "13.11.10",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"bin": {
|
|
6
6
|
"dbx-cli-generate-firebase-api-manifest": "firebase-api-manifest/main.js"
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@dereekb/date": "13.11.
|
|
28
|
-
"@dereekb/firebase": "13.11.
|
|
29
|
-
"@dereekb/nestjs": "13.11.
|
|
30
|
-
"@dereekb/util": "13.11.
|
|
27
|
+
"@dereekb/date": "13.11.10",
|
|
28
|
+
"@dereekb/firebase": "13.11.10",
|
|
29
|
+
"@dereekb/nestjs": "13.11.10",
|
|
30
|
+
"@dereekb/util": "13.11.10",
|
|
31
31
|
"arktype": "^2.2.0",
|
|
32
32
|
"yargs": "^18.0.0"
|
|
33
33
|
},
|
|
@@ -142,3 +142,26 @@ export declare function detectDataHelpFormat(argv?: readonly string[]): Manifest
|
|
|
142
142
|
* @returns The detected mode, or {@link DEFAULT_MANIFEST_HELP_MODE}.
|
|
143
143
|
*/
|
|
144
144
|
export declare function detectHelpMode(argv?: readonly string[]): ManifestHelpMode;
|
|
145
|
+
/**
|
|
146
|
+
* Resolves a per-model `get` positional into the full Firestore key the backend expects.
|
|
147
|
+
*
|
|
148
|
+
* The backend's `ModelApiController.getOne` only accepts full `prefix/id` keys, so a bare doc id
|
|
149
|
+
* has to be expanded before the HTTP call. The expansion is only safe for top-level (root) models
|
|
150
|
+
* whose `collectionPrefix` is enough to address the document — subcollection models also need the
|
|
151
|
+
* parent prefix/id and cannot be reconstructed from a bare id alone.
|
|
152
|
+
*
|
|
153
|
+
* Rules:
|
|
154
|
+
* 1. Keys containing `/` are treated as full keys and passed through verbatim.
|
|
155
|
+
* 2. Bare ids on a top-level model resolve to `<collectionPrefix>/<id>` via the manifest.
|
|
156
|
+
* 3. Bare ids on a subcollection model throw — the parent path is required.
|
|
157
|
+
* 4. When the manifest is not wired, bare ids pass through unchanged (preserves the old behavior
|
|
158
|
+
* so the CLI still works without `modelManifest` even though the backend will reject the call).
|
|
159
|
+
*
|
|
160
|
+
* @param model - The persisted model type (e.g. `profile`).
|
|
161
|
+
* @param key - The trimmed `<key>` positional from yargs — full `prefix/id` or bare doc id.
|
|
162
|
+
* @param manifest - The generated model manifest used to look up the model's `collectionPrefix`
|
|
163
|
+
* and `parentIdentityConst`. When omitted, the key passes through unchanged.
|
|
164
|
+
* @returns The resolved Firestore model key ready for `context.getModel(model, key)`.
|
|
165
|
+
* @__NO_SIDE_EFFECTS__
|
|
166
|
+
*/
|
|
167
|
+
export declare function resolvePerModelGetKey(model: string, key: string, manifest: CliModelManifest | undefined): string;
|