Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

See if run changes will work #1194

Closed
Closed
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
242d8f0
Add a unit test for commit as a non-tx
danieljbruce Sep 13, 2023
8a7b0ea
use linter
danieljbruce Nov 1, 2023
d0cd928
Write tests to capture current behavior of error
danieljbruce Nov 1, 2023
ed5a301
Add tests for passing a response
danieljbruce Nov 1, 2023
b3b13b4
run async close to working
danieljbruce Nov 1, 2023
85ec536
Add runAsync to promise excludes
danieljbruce Nov 1, 2023
d26ebd3
Remove space
danieljbruce Nov 1, 2023
2d13f56
Change to use this instead of self
danieljbruce Nov 1, 2023
3f66406
Eliminate unused comments
danieljbruce Nov 1, 2023
ff76a6d
Add two comments
danieljbruce Nov 1, 2023
d7806bd
Remove the commit test for this PR
danieljbruce Nov 1, 2023
01d7837
Clarify types throughout the function
danieljbruce Nov 1, 2023
dff3183
Add a bit more typing for clarity
danieljbruce Nov 1, 2023
f4e05bd
Change types used in the data client callback
danieljbruce Nov 2, 2023
6d50e94
run the linter
danieljbruce Nov 2, 2023
875bf4b
Add comments to clarify PR
danieljbruce Nov 2, 2023
ea80c65
Refactor the parsing logic out of run
danieljbruce Nov 2, 2023
14af87e
Change interface of request promise callback
danieljbruce Nov 2, 2023
ba363e0
Hide data completely
danieljbruce Nov 6, 2023
9f50cba
PR use if/else block
danieljbruce Nov 6, 2023
f96471d
Add comments to document the new functions
danieljbruce Nov 6, 2023
59ee72a
Update return type in docs
danieljbruce Nov 6, 2023
34e961e
Update the tests to include runAsync
danieljbruce Nov 6, 2023
38cd2ef
refactor: Break transaction.run into smaller pieces for use with asyn…
danieljbruce Nov 6, 2023
08fe164
Merge branch 'nodejs-transaction-change-run' of https://github.com/da…
danieljbruce Nov 6, 2023
ad39a90
Rename a function to be more descriptive
danieljbruce Nov 6, 2023
c129bd2
Modify comment
danieljbruce Nov 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a bit more typing for clarity
Add a type to the resolve function just to introduce more clarity
  • Loading branch information
danieljbruce committed Nov 1, 2023
commit dff31833a83ea1d0e9470e4aaf195eb758a2e0f7
10 changes: 6 additions & 4 deletions src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {AggregateQuery} from './aggregate';
// RequestPromiseReturnType should line up with the types in RequestCallback
interface RequestPromiseReturnType {
err?: Error | null;
resp: any;
resp: any; // TODO: Replace with google.datastore.v1.IBeginTransactionResponse and address downstream issues
}
interface RequestResolveFunction {
(callbackData: RequestPromiseReturnType): void;
Expand Down Expand Up @@ -572,9 +572,9 @@ class Transaction extends DatastoreRequest {
private async runAsync(
options: RunOptions
): Promise<RequestPromiseReturnType> {
const reqOpts = {
const reqOpts: RequestOptions = {
transactionOptions: {},
} as RequestOptions;
};

if (options.readOnly || this.readOnly) {
reqOpts.transactionOptions!.readOnly = {};
Expand All @@ -589,7 +589,9 @@ class Transaction extends DatastoreRequest {
if (options.transactionOptions) {
reqOpts.transactionOptions = options.transactionOptions;
}
const promiseFunction: RequestAsPromise = resolve => {
const promiseFunction: RequestAsPromise = (
resolve: RequestResolveFunction
) => {
this.request_(
{
client: 'DatastoreClient',
Expand Down
Loading