Skip to content

Conversation

@rjrudin
Copy link
Contributor

@rjrudin rjrudin commented Nov 25, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 25, 2025 22:57
@github-actions
Copy link

github-actions bot commented Nov 25, 2025

Copyright Validation Results
Total: 3 | Passed: 3 | Failed: 0 | Skipped: 0 | at: 2025-11-26 13:19:14 UTC | commit: a5442e3

✅ Valid Files

  • marklogic.d.ts
  • test-typescript/dbclient-convenience-runtime.test.ts
  • test-typescript/dbclient-setLogger-setAuthToken-compile.test.ts

✅ All files have valid copyright headers!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds TypeScript support for two client-level methods: setLogger and setAuthToken. It includes both compile-time type checking tests and runtime validation tests to ensure the methods work correctly in TypeScript environments.

Key Changes

  • Added compile-time type checking tests for setLogger (with logger object and level string) and setAuthToken
  • Added runtime validation tests for setLogger with both logger object and level string configurations

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

File Description
test-typescript/dbclient-setLogger-setAuthToken-compile.test.ts New file containing compile-time type checking tests for setLogger and setAuthToken methods
test-typescript/dbclient-convenience-runtime.test.ts Added runtime validation tests for setLogger with level string and logger object

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


import type { DatabaseClient } from 'marklogic';

const marklogic = require('../lib/marklogic.js');
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixing import type with require is inconsistent. Consider using import for the module on line 10 instead of require, or remove the type-only import and use type assertions instead. This ensures consistency in import style throughout the file.

Suggested change
const marklogic = require('../lib/marklogic.js');
import * as marklogic from '../lib/marklogic.js';

Copilot uses AI. Check for mistakes.
});



Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Remove excessive blank lines. There should be at most one blank line between test cases for consistency with the rest of the file.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines 164 to 178
it('should use setLogger with a level string', async function() {
// Set logger to 'info' level
client.setLogger('info');

// Verify client is still functional after setting logger
const result = await client.probe(testUri).result();
result.should.have.property('exists');
result.should.have.property('uri');
});
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test verifies that the client remains functional after calling setLogger, but doesn't validate that the logger is actually being used or that log messages are being produced. Consider capturing log output or verifying logger behavior to ensure setLogger actually configures logging correctly.

Copilot uses AI. Check for mistakes.
Comment on lines 174 to 202
it('should use setLogger with a logger object', async function() {
// Create a simple logger object
const testLogger = {
debug: (msg: string) => console.log('DEBUG:', msg),
info: (msg: string) => console.log('INFO:', msg),
warn: (msg: string) => console.log('WARN:', msg),
error: (msg: string) => console.log('ERROR:', msg)
};

// Set logger with object
client.setLogger(testLogger, false);

// Verify client is still functional after setting logger
const result = await client.probe(testUri).result();
result.should.have.property('exists');
result.should.have.property('uri');
});
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test verifies that the client remains functional after calling setLogger with a custom logger object, but doesn't validate that the custom logger is actually being invoked. Consider tracking whether the logger methods are called to ensure setLogger properly integrates the custom logger.

Copilot uses AI. Check for mistakes.
@rjrudin rjrudin force-pushed the feature/25617-ts-dbclient branch from f9dfe16 to 3e40374 Compare November 26, 2025 00:35
@rjrudin rjrudin force-pushed the feature/25617-ts-dbclient branch from 3e40374 to a5442e3 Compare November 26, 2025 13:18
@rjrudin rjrudin merged commit c0f74fc into develop Nov 26, 2025
6 checks passed
@rjrudin rjrudin deleted the feature/25617-ts-dbclient branch November 26, 2025 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants