Conversation
hiranya911
left a comment
There was a problem hiding this comment.
Looks pretty solid. My main points of feedback are:
- Remove anything that's not directly related to the getModel API from this PR.
- Add unit tests for the API client implementation.
|
|
||
| describe('admin.machineLearning', () => { | ||
| describe('getModel()', () => { | ||
| it('rejects with not-found when the Ruleset does not exist', () => { |
| }); | ||
|
|
||
| it('rejects with invalid-argument when the ModelId is invalid', () => { | ||
| return admin.machineLearning().getModel('abc') |
There was a problem hiding this comment.
Nit: Use something more explicit like invalid-model-id to be clear instead of abc.
| 'code', 'machine-learning/invalid-argument'); | ||
| }); | ||
|
|
||
| it('resolves with existing Model', () => { |
There was a problem hiding this comment.
Remove from this PR. Makes future additions easier to review.
| } | ||
|
|
||
| public listModels(options: {listFilter?: string, pageSize?: number, pageToken?: string}) { | ||
| throw new Error('NotImplemented'); |
There was a problem hiding this comment.
Please remove all the not-implemented stuff from this PR. Makes the future additions easier to review.
|
|
||
| import { PrefixedFirebaseError } from '../utils/error'; | ||
|
|
||
| export type MachineLearningErrorCode = |
There was a problem hiding this comment.
Remove any errors codes that you're not explicitly referencing for now. You can add them in the future PR if they become necessary.
There was a problem hiding this comment.
These are all possible to come back from the server.
| this.published = model.state?.published || false; | ||
| this.etag = model.etag; | ||
| if (model.modelHash) { | ||
| this.modelHash = model.modelHash; |
There was a problem hiding this comment.
If this is set conditionally, change the type declaration to be modelHash?. Both here in the class, and also in the d.ts file.
| @@ -0,0 +1,244 @@ | |||
| /*! | |||
There was a problem hiding this comment.
Also add unit tests for machine-learning-api-client.
hiranya911
left a comment
There was a problem hiding this comment.
LGTM with a couple of nits 👍
| } | ||
|
|
||
|
|
||
| private getUrl(): Promise<string> { |
There was a problem hiding this comment.
Nit: I'd recommend pushing helpers like this to the bottom of the class, so that more important functionality like getResouce appears first.
| }); | ||
| }); | ||
|
|
||
| it('should throw when a full platform error response is received', () => { |
There was a problem hiding this comment.
should reject
Here and other similar tests.
* Firebase ML Node.js SDK Structure (#778) * Firebase ML Node.js SDK Structure * added tests * Added GetModel functionality and tests (#781) * Added GetModel functionality and tests * Added DeleteModel functionality and tests (#782) * Added DeleteModel functionality and tests * Added CreateModel functionality and tests (#788) * Added CreateModel functionality and tests * Added UpdateModel, publishModel,and unpublishModel functionality + tests (#791) * Added UpdateModel, publishModel,and unpublishModel functionality plus tests * Added ListModels functionality for Firebase ML (#795) * Added ListModels functionality for Firebase ML * Firebase ML changed endpoint (#813) * Add ML APIs to docgen toc (#847) * Docstring fixes and additions (#848) * Docstring fixes and additions * A few edits * Ml merge (#851) * Custom Action for sending Tweets (#784) * Experimental custom Action for sending Tweets * Added license headers * Added README file * Updated package descriptions * Improve customClaims Typing (#768) * chore: Experimental release flow based on Actions (#780) * chore: Experimental release flow based on Actions * Added tarball verification step; Simplified CI trigger * Splitting staging and publish phases into separate jobs * Fleshed out the full workflow * Trigger RC build * chore: Migrated to ESlint (#790) * chore: Migrated to ESlint * Added licesne header * Enabling additional ESLint checks (#794) * chore: Enabling more ESLint checks and fixing errors (#797) * Fix compilation error in integration tests (#798) Introduced by #790 * Build integration tests during CI (and release) (#800) Note that this won't actually run them. Additionally, the *unit* tests are also built, impying that we're building them twice (once during this step, and possibly again when running the unit tests.) * Fix revokeRefreshTokens to round consistently with the other platforms. (#801) This also makes it consistent with the comments a few lines above, as well as the integration test. * feat(auth): Multi-factor Auth support with SMS for Google Cloud Identity Platform (#804) Defines multi-factor auth administrative APIs for Google Cloud Identity Platform. * Defines new MFA types in toc.yaml. (#807) * Removes special char from index.d.ts. (#808) This is causing errors in the reference generation process. * Defines MultiFactor{Create|Update}Settings interfaces. (#809) * Defines MultiFactor{Create|Update}Settings interfaces. * chore: Adding a .npmrc file to the root of the repo (#810) * chore: Adding a .npmrc file to the root of the repo * Removing the root-level .npmrc file * [chore] Release 8.10.0 (#811) * [chore] Release 8.10.0 (take 2) (#812) * Bump acorn from 6.1.1 to 6.4.1 (#815) Bumps [acorn](https://github.com/acornjs/acorn) from 6.1.1 to 6.4.1. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](acornjs/acorn@6.1.1...6.4.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixing Android notification options descriptions (#820) * Fixing doc bug that conflated sound and tag options for Android notifications. * Removing duplicate documentation for tag. * Adding tag details in the right place this time, hopefully. * chore: Splitting the index.d.ts file into smaller files (#751) * Splitting the index.d.ts file into smaller files * Database return type fixed * chore: Cleaning up package verification scripts (#822) * chore: Cleaning up package verification scripts * Added package metadata to test package.json file * fix(auth): Fixing UserImportRecord typings declaration (#835) * fix(auth): Fixing UserImportRecord typings declaration * Fixing more integration test compilation errors * Trigger CI * Removed redundant line * Bump minimist from 1.2.0 to 1.2.3 (#839) Bumps [minimist](https://github.com/substack/minimist) from 1.2.0 to 1.2.3. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.0...1.2.3) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * remerge conflict Co-authored-by: Hiranya Jayathilaka <hiranya911@gmail.com> Co-authored-by: William Sedlacek <wsedlacekc@gmail.com> Co-authored-by: rsgowman <rgowman@google.com> Co-authored-by: bojeil-google <bojeil-google@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: egilmorez <egilmore@google.com> * Added Firebase ML API requirements to Contributing doc (#853) Co-authored-by: Kevin Cheung <kevinthecheung@users.noreply.github.com> Co-authored-by: Hiranya Jayathilaka <hiranya911@gmail.com> Co-authored-by: William Sedlacek <wsedlacekc@gmail.com> Co-authored-by: rsgowman <rgowman@google.com> Co-authored-by: bojeil-google <bojeil-google@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: egilmorez <egilmore@google.com>
Added Firebase Machine Learning GetModel functionality and tests