Skip to content

Commit 104a1c5

Browse files
committed
npm run apidocs for validateAdminArgs
1 parent fd61f1a commit 104a1c5

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

etc/firebase-admin.data-connect.api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,11 @@ export interface OperationOptions {
7575
impersonate?: ImpersonateAuthenticated | ImpersonateUnauthenticated;
7676
}
7777

78+
// @public
79+
export function validateAdminArgs<Variables extends object>(connectorConfig: ConnectorConfig, dcOrVarsOrOptions?: DataConnect | Variables | OperationOptions, varsOrOptions?: Variables | OperationOptions, options?: OperationOptions, hasVars?: boolean, validateVars?: boolean): {
80+
dc: DataConnect;
81+
vars: Variables;
82+
options: OperationOptions;
83+
};
84+
7885
```

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/data-connect/validateAdminArgs.ts

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,34 @@
1818
import { getDataConnect } from './index';
1919
import { DataConnect } from './data-connect';
2020
import { ConnectorConfig, OperationOptions } from './data-connect-api';
21-
import { DATA_CONNECT_ERROR_CODE_MAPPING, FirebaseDataConnectError } from './data-connect-api-client-internal';
22-
23-
24-
interface ParsedAdminArgs<Variables> {
25-
dc: DataConnect;
26-
vars: Variables;
27-
options: OperationOptions
28-
}
21+
import {
22+
DATA_CONNECT_ERROR_CODE_MAPPING,
23+
FirebaseDataConnectError,
24+
} from './data-connect-api-client-internal';
2925

3026
/**
31-
* The generated Admin SDK will allow the user to pass in variables, a Data Connect
27+
* The generated Admin SDK will allow the user to pass in variables, a Data Connect
3228
* instance, or operation options. The only required argument is the variables,
33-
* which are only required when the operation has at least one required variable.
29+
* which are only required when the operation has at least one required variable.
3430
* Otherwise, all arguments are optional. This function validates the variables
3531
* and returns back the DataConnect instance, variables, and options based on the
3632
* arguments passed in.
37-
* @param connectorConfig DataConnect connector config
38-
* @param dcOrVarsOrOptions the first argument provided to a generated admin function
39-
* @param varsOrOptions the second argument provided to a generated admin function
40-
* @param options the third argument provided to a generated admin function
41-
* @param hasVars boolean parameter indicating whether the operation has variables
42-
* @param validateVars boolean parameter indicating whether we should expect to find a value for realVars
33+
* @param connectorConfig - DataConnect connector config
34+
* @param dcOrVarsOrOptions - the first argument provided to a generated admin function
35+
* @param varsOrOptions - the second argument provided to a generated admin function
36+
* @param options - the third argument provided to a generated admin function
37+
* @param hasVars - boolean parameter indicating whether the operation has variables
38+
* @param validateVars - boolean parameter indicating whether we should expect to find a value for realVars
4339
* @returns parsed DataConnect, Variables, and Options for the operation
44-
* @internal
4540
*/
4641
export function validateAdminArgs<Variables extends object>(
4742
connectorConfig: ConnectorConfig,
4843
dcOrVarsOrOptions?: DataConnect | Variables | OperationOptions,
4944
varsOrOptions?: Variables | OperationOptions,
5045
options?: OperationOptions,
5146
hasVars?: boolean,
52-
validateVars?: boolean,
53-
): ParsedAdminArgs<Variables> {
47+
validateVars?: boolean
48+
): { dc: DataConnect; vars: Variables; options: OperationOptions; } {
5449
let dcInstance: DataConnect;
5550
let realVars: Variables;
5651
let realOptions: OperationOptions;
@@ -76,7 +71,10 @@ export function validateAdminArgs<Variables extends object>(
7671
}
7772

7873
if (!dcInstance || (!realVars && validateVars)) {
79-
throw new FirebaseDataConnectError(DATA_CONNECT_ERROR_CODE_MAPPING.INVALID_ARGUMENT, 'Variables required.');
74+
throw new FirebaseDataConnectError(
75+
DATA_CONNECT_ERROR_CODE_MAPPING.INVALID_ARGUMENT,
76+
'Variables required.'
77+
);
8078
}
8179
return { dc: dcInstance, vars: realVars, options: realOptions };
82-
}
80+
}

0 commit comments

Comments
 (0)