#6979 Add case insensitive operators for strings

Open RandyLarzabal Pseudo commit used to compare (4772e89...377acd0)
Missing base report.

Unable to compare commits because the base of the pull request did not upload a coverage report.

Changes found in between 4772e89...377acd0 (pseudo...base) which prevent comparing this pull request.

Showing 59 of 292 files from the diff.
Newly tracked file
packages/xr/src/XR.ts changed.
Other files ignored by Codecov
.gitignore has changed.
docs/Gemfile has changed.
docs/Gemfile.lock has changed.
package.json has changed.
CONTRIBUTING.md has changed.
scripts/build.js has changed.
NOTICE is new.
README.md has changed.

@@ -98,13 +98,21 @@
Loading
98 98
	): BlogOwnerModel;
99 99
}
100 100
101 +
declare class PersonModel {
102 +
	readonly id: string;
103 +
	readonly firstName: string;
104 +
	readonly lastName: string;
105 +
	readonly username?: string;
106 +
}
107 +
101 108
const {
102 109
	Author,
103 110
	Post,
104 111
	Comment,
105 112
	Blog,
106 113
	BlogOwner,
107 114
	PostAuthorJoin,
115 +
	Person,
108 116
	PostMetadata,
109 117
	Nested,
110 118
} = initSchema(newSchema) as {
@@ -114,6 +122,7 @@
Loading
114 122
	Blog: PersistentModelConstructor<BlogModel>;
115 123
	BlogOwner: PersistentModelConstructor<BlogOwnerModel>;
116 124
	PostAuthorJoin: PersistentModelConstructor<PostAuthorJoinModel>;
125 +
	Person: PersistentModelConstructor<PersonModel>;
117 126
	PostMetadata: NonModelTypeConstructor<PostMetadataType>;
118 127
	Nested: NonModelTypeConstructor<NestedType>;
119 128
};
@@ -125,6 +134,7 @@
Loading
125 134
	Blog,
126 135
	BlogOwner,
127 136
	PostAuthorJoin,
137 +
	Person,
128 138
	PostMetadata,
129 139
	Nested,
130 140
};

@@ -71,7 +71,6 @@
Loading
71 71
		logger.debug('PubSub Options', this._options);
72 72
		this._pluggables = [];
73 73
		this.subscribe = this.subscribe.bind(this);
74 -
		Amplify.register(this);
75 74
	}
76 75
77 76
	public getModuleName() {
@@ -152,6 +151,12 @@
Loading
152 151
		topics: string[] | string,
153 152
		options?: ProvidertOptions
154 153
	): Observable<any> {
154 +
		if (this._options && this._options.ssr) {
155 +
			throw new Error(
156 +
				'Subscriptions are not supported for Server-Side Rendering (SSR)'
157 +
			);
158 +
		}
159 +
155 160
		logger.debug('subscribe options', options);
156 161
157 162
		const providers = this.getProviders(options);
@@ -178,3 +183,4 @@
Loading
178 183
}
179 184
180 185
export const PubSub = new PubSubClass(null);
186 +
Amplify.register(PubSub);

@@ -12,7 +12,13 @@
Loading
12 12
 */
13 13
14 14
import * as React from 'react';
15 -
import { Amplify, I18n, ConsoleLogger as Logger, Hub } from '@aws-amplify/core';
15 +
import {
16 +
	Amplify,
17 +
	I18n,
18 +
	ConsoleLogger as Logger,
19 +
	Hub,
20 +
	isEmpty,
21 +
} from '@aws-amplify/core';
16 22
import { Auth } from '@aws-amplify/auth';
17 23
import { Greetings } from './Greetings';
18 24
import { SignIn } from './SignIn';
@@ -134,12 +140,29 @@
Loading
134 140
			});
135 141
	}
136 142
143 +
	checkContact(user, changeState) {
144 +
		if (!Auth || typeof Auth.verifiedContact !== 'function') {
145 +
			throw new Error(
146 +
				'No Auth module found, please ensure @aws-amplify/auth is imported'
147 +
			);
148 +
		}
149 +
		Auth.verifiedContact(user).then(data => {
150 +
			if (!isEmpty(data.verified)) {
151 +
				changeState('signedIn', user);
152 +
			} else {
153 +
				user = Object.assign(user, data);
154 +
				changeState('verifyContact', user);
155 +
			}
156 +
		});
157 +
	}
158 +
137 159
	onHubCapsule(capsule) {
138 160
		const { channel, payload, source } = capsule;
139 161
		if (channel === 'auth') {
140 162
			switch (payload.event) {
141 163
				case 'cognitoHostedUI':
142 -
					this.handleStateChange('signedIn', payload.data);
164 +
				case 'signIn':
165 +
					this.checkContact(payload.data, this.handleStateChange);
143 166
					break;
144 167
				case 'cognitoHostedUI_failure':
145 168
					this.handleStateChange('signIn', null);

@@ -16,6 +16,8 @@
Loading
16 16
	RelationshipType,
17 17
	RelationType,
18 18
	SchemaNamespace,
19 +
	SortPredicatesGroup,
20 +
	SortDirection,
19 21
} from './types';
20 22
21 23
export const exhaustiveCheck = (obj: never, throwOnError: boolean = true) => {
@@ -24,6 +26,10 @@
Loading
24 26
	}
25 27
};
26 28
29 +
export const isNullOrUndefined = (val: any): boolean => {
30 +
	return typeof val === 'undefined' || val === undefined || val === null;
31 +
};
32 +
27 33
export const validatePredicate = <T extends PersistentModel>(
28 34
	model: T,
29 35
	groupType: keyof PredicateGroups<T>,
@@ -101,6 +107,16 @@
Loading
101 107
			return (
102 108
				(<string>(<unknown>value)).indexOf(<string>(<unknown>operand)) === -1
103 109
			);
110 +
		case 'iBeginsWith':
111 +
			return (<string>(<unknown>value)).toLowerCase().startsWith((<string>(<unknown>operand)).toLowerCase());
112 +
		case 'iContains':
113 +
			return (
114 +
				(<string>(<unknown>value)).toLowerCase().indexOf((<string>(<unknown>operand)).toLowerCase()) > -1
115 +
			);
116 +
		case 'iNotContains':
117 +
			return (
118 +
				(<string>(<unknown>value)).toLowerCase().indexOf((<string>(<unknown>operand)).toLowerCase()) === -1
119 +
			);
104 120
		default:
105 121
			exhaustiveCheck(operator, false);
106 122
			return false;
@@ -402,3 +418,28 @@
Loading
402 418
		return Date.now();
403 419
	}
404 420
}
421 +
422 +
export function sortCompareFunction<T extends PersistentModel>(
423 +
	sortPredicates: SortPredicatesGroup<T>
424 +
) {
425 +
	return function compareFunction(a, b) {
426 +
		// enable multi-field sort by iterating over predicates until
427 +
		// a comparison returns -1 or 1
428 +
		for (const predicate of sortPredicates) {
429 +
			const { field, sortDirection } = predicate;
430 +
431 +
			// reverse result when direction is descending
432 +
			const sortMultiplier = sortDirection === SortDirection.ASCENDING ? 1 : -1;
433 +
434 +
			if (a[field] < b[field]) {
435 +
				return -1 * sortMultiplier;
436 +
			}
437 +
438 +
			if (a[field] > b[field]) {
439 +
				return 1 * sortMultiplier;
440 +
			}
441 +
		}
442 +
443 +
		return 0;
444 +
	};
445 +
}

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Unable to process changes.

No base report to compare against.

182 Commits

Hiding 2 contexual commits
+3
+3
+30
-30
-30
+30
-3
+30
-33
Hiding 1 contexual commits
+3
-30
+33
Hiding 1 contexual commits
+3
+2
+1
Hiding 1 contexual commits
+2
+30
-28
-30
+30
-1
-1
Hiding 2 contexual commits
+30
-30
-30
+30
+30
-30
-30
+30
+1
+30
-29
+19
+6
-30
+43
Hiding 1 contexual commits
+12
+11
+1
+6
+2
+30
-26
Hiding 2 contexual commits
+1 Files
+7
+7
-30
+30
+30
-30
-30
+30
+30
-30
+1
+1
Hiding 1 contexual commits
-30
+30
Hiding 2 contexual commits
+30
-30
+1
+6
-30
+25
Hiding 2 contexual commits
+30
-30
-30
+30
+1 Files
+68
+79
-11
Hiding 1 contexual commits
+30
-30
Hiding 5 contexual commits
Hiding 2 contexual commits
+10
+1
-29
+38
+1
+1
Hiding 1 contexual commits Hiding 6 contexual commits
+9
+4
+5
Hiding 5 contexual commits
+29
-29
Hiding 2 contexual commits
-1
-1
-29
+29
Hiding 2 contexual commits
+29
-29
Hiding 5 contexual commits
Hiding 1 contexual commits
+3 Files
+115
+74
-28
+69
Hiding 2 contexual commits
+29
-29
-29
+29
Hiding 1 contexual commits
+1
+1
+29
-29
-29
+29
Hiding 1 contexual commits
+29
-29
Hiding 1 contexual commits
-29
+29
+13
+29
-16
Hiding 1 contexual commits
+3
+3
-28
+28
+3
+3
+28
-28