Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
939291a
Add v1 of transformer redesign
kingston Oct 18, 2025
c3c280d
Rename relation helper
kingston Oct 19, 2025
fb992dd
Try v2 of nested helpers
kingston Oct 20, 2025
57bd2f9
Remove uniques
kingston Oct 20, 2025
027b8f4
Try out first iteration with user-data-service
kingston Oct 21, 2025
792f012
Add file tests
kingston Oct 21, 2025
9915ac5
Fix up naming of function
kingston Oct 22, 2025
e2f7fdb
Catch scenario where no proper where is returned
kingston Oct 23, 2025
314cd47
Clean up nested definitions by auto-adding connects
kingston Oct 26, 2025
d9f28c1
Fix type error with define operations
kingston Oct 27, 2025
24768aa
Merge branch 'main' into kingston/eng-786-exploration-data-transforme…
kingston Oct 27, 2025
0afb77c
Remove unused files
kingston Oct 27, 2025
5b906c8
Update jsdocs for data-operaitons
kingston Oct 27, 2025
7391b29
Add data-utils generator to the fastify backend
kingston Oct 27, 2025
c316a3a
Incorporate file-field into generator
kingston Oct 27, 2025
d1aaf66
Fix imports
kingston Oct 27, 2025
950a16e
Fix up file category and remove index.ts
kingston Oct 28, 2025
913e939
Export imports schema by default
kingston Oct 30, 2025
1d5cfdd
Add support for generation of scalar fields
kingston Oct 30, 2025
421a9cf
Regenerate todo-with-auth0
kingston Oct 30, 2025
91c4d6c
Add case utilities
kingston Oct 31, 2025
2322b61
Add changeset for utils
kingston Oct 31, 2025
c968bfb
Add initial implementation of data-create service generator
kingston Oct 31, 2025
6fd0caa
Fix test errors
kingston Oct 31, 2025
c816d71
Fix up define operation typings for create operation
kingston Oct 31, 2025
8eda4b6
Add buildData relation helpers
kingston Nov 4, 2025
f6eaefa
Add support for nested field generators
kingston Nov 9, 2025
6a67ff6
Fix up ordering and trigger regeneration
kingston Nov 9, 2025
e1209b4
Merge branch 'main' into kingston/eng-786-exploration-data-transforme…
kingston Nov 9, 2025
3598f9a
Add support for file model
kingston Nov 9, 2025
5075880
Add update and delete operations to data service
kingston Nov 9, 2025
b931d83
Fix fields with defaults
kingston Nov 9, 2025
7ac7b2b
Fix test typings
kingston Nov 9, 2025
5901536
Fix up field generation
kingston Nov 9, 2025
882d3eb
Strip out prisma password transformer
kingston Nov 9, 2025
c785a7c
Make compileField required
kingston Nov 9, 2025
bf45e02
Switch mutations to use new data service
kingston Nov 9, 2025
a04b447
Support new format for mutations
kingston Nov 12, 2025
42e3d1f
Re-generate graphql
kingston Nov 12, 2025
5780eb3
Regenerate blog-with-auth
kingston Nov 12, 2025
d037a54
Clean up deleted files
kingston Nov 12, 2025
cb4fd4e
Fix up getWhereUnique functions
kingston Nov 12, 2025
cc5fa54
Set max workers to 1
kingston Nov 18, 2025
e7d3433
Implement callbacks to operations for better tracing
kingston Nov 19, 2025
912f49b
Fix linting errors and add changeset
kingston Nov 19, 2025
23d1061
Strip out old data handling code
kingston Nov 19, 2025
c360904
Update blog with auth and tests
kingston Nov 19, 2025
1590199
Fix define operations delete operation
kingston Nov 19, 2025
46c280d
Fix knip issues
kingston Nov 19, 2025
e224dec
Fix up knip
kingston Nov 19, 2025
0eabfb0
Respond to PR feedback
kingston Nov 19, 2025
54c8d54
Fix e2e error and linting
kingston Nov 19, 2025
37708c5
Fix result of delete operation
kingston Nov 19, 2025
47feaa1
Fix types for ModelQuery where there is no include
kingston Nov 19, 2025
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 case utilities
  • Loading branch information
kingston committed Oct 31, 2025
commit 91c4d6ca18590db3e867ea212f6b60cfb1508cd3
39 changes: 39 additions & 0 deletions packages/utils/src/string/case.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Lowercase the first character of a string, leaving the remainder unchanged.
*
* - Returns the input unchanged when it's an empty string
* - Non-alphabetic first characters are returned as-is
*
* @param str - The input string
* @returns The string with the first character lowercased
* @example
* lowercaseFirstChar('Hello') // 'hello'
* lowercaseFirstChar('hello') // 'hello'
* lowercaseFirstChar('1World') // '1World'
*/
export function lowercaseFirstChar(str: string): string {
if (str.length === 0) {
return str;
}
return str.charAt(0).toLowerCase() + str.slice(1);
}

/**
* Uppercase the first character of a string, leaving the remainder unchanged.
*
* - Returns the input unchanged when it's an empty string
* - Non-alphabetic first characters are returned as-is
*
* @param str - The input string
* @returns The string with the first character uppercased
* @example
* uppercaseFirstChar('hello') // 'Hello'
* uppercaseFirstChar('Hello') // 'Hello'
* uppercaseFirstChar('#tag') // '#tag'
*/
export function uppercaseFirstChar(str: string): string {
if (str.length === 0) {
return str;
}
return str.charAt(0).toUpperCase() + str.slice(1);
}
74 changes: 74 additions & 0 deletions packages/utils/src/string/case.unit.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { describe, expect, it } from 'vitest';

import { lowercaseFirstChar, uppercaseFirstChar } from './case.js';

describe('case utilities', () => {
describe('lowercaseFirstChar', () => {
it('lowercases the first character of a normal word', () => {
// Arrange
const input = 'HelloWorld';

// Act
const result = lowercaseFirstChar(input);

// Assert
expect(result).toBe('helloWorld');
});

it('returns the same string if already lowercased first char', () => {
const input = 'helloWorld';
const result = lowercaseFirstChar(input);
expect(result).toBe('helloWorld');
});

it('handles empty string', () => {
const input = '';
const result = lowercaseFirstChar(input);
expect(result).toBe('');
});

it('leaves non-alphabetic first characters unchanged', () => {
const input = '1World';
const result = lowercaseFirstChar(input);
expect(result).toBe('1World');
});

it('handles unicode characters (emoji) at start', () => {
const input = '😀Smile';
const result = lowercaseFirstChar(input);
expect(result).toBe('😀Smile');
});
});

describe('uppercaseFirstChar', () => {
it('uppercases the first character of a normal word', () => {
const input = 'helloWorld';
const result = uppercaseFirstChar(input);
expect(result).toBe('HelloWorld');
});

it('returns the same string if already uppercased first char', () => {
const input = 'HelloWorld';
const result = uppercaseFirstChar(input);
expect(result).toBe('HelloWorld');
});

it('handles empty string', () => {
const input = '';
const result = uppercaseFirstChar(input);
expect(result).toBe('');
});

it('leaves non-alphabetic first characters unchanged', () => {
const input = '#tag';
const result = uppercaseFirstChar(input);
expect(result).toBe('#tag');
});

it('handles unicode characters (emoji) at start', () => {
const input = '😀smile';
const result = uppercaseFirstChar(input);
expect(result).toBe('😀smile');
});
});
});
1 change: 1 addition & 0 deletions packages/utils/src/string/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './case.js';
export * from './convert-case-with-prefix.js';
export * from './find-closest-match.js';
export * from './quot.js';
Expand Down