-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: new capabilities file * feat: new capabilities property in the schema list * fix: fixed the types in mongo_schema_provider * feat: upsert insert implementation * feat: aggregate implementation * feat: enable query nested fields * feat: new supported ops and test * test: enable mongo tests on github cli * fix: updated mssql supported ops * refactor: some changes according to the review * test: new supported operations * test: spanner supported ops update
- Loading branch information
Showing
26 changed files
with
284 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
import { errors } from '@wix-velo/velo-external-db-commons' | ||
const { ItemAlreadyExists } = errors | ||
|
||
const notThrowingTranslateErrorCodes = (err: any) => { | ||
const extractItemIdFromError = (err: any) => err.message.split('"')[1] | ||
|
||
const notThrowingTranslateErrorCodes = (err: any, collectionName: string) => { | ||
switch (err.code) { | ||
case 11000: | ||
return new ItemAlreadyExists(`Item already exists: ${err.message}`) | ||
case 11000: | ||
return new ItemAlreadyExists(`Item already exists: ${err.message}`, collectionName, extractItemIdFromError(err)) | ||
default: | ||
return new Error (`default ${err.message}`) | ||
} | ||
} | ||
|
||
export const translateErrorCodes = (err: any) => { | ||
throw notThrowingTranslateErrorCodes(err) | ||
export const translateErrorCodes = (err: any, collectionName: string) => { | ||
throw notThrowingTranslateErrorCodes(err, collectionName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { AdapterOperators } from '@wix-velo/velo-external-db-commons' | ||
import { CollectionOperation, DataOperation, FieldType } from '@wix-velo/velo-external-db-types' | ||
|
||
const { query, count, queryReferenced, aggregate, } = DataOperation | ||
const { eq, ne, string_contains, string_begins, string_ends, gt, gte, lt, lte, include } = AdapterOperators | ||
|
||
export const ReadWriteOperations = Object.values(DataOperation) | ||
export const ReadOnlyOperations = [query, count, queryReferenced, aggregate] | ||
export const FieldTypes = Object.values(FieldType) | ||
export const CollectionOperations = Object.values(CollectionOperation) | ||
export const ColumnsCapabilities = { | ||
text: { sortable: true, columnQueryOperators: [eq, ne, string_contains, string_begins, string_ends, include, gt, gte, lt, lte] }, | ||
url: { sortable: true, columnQueryOperators: [eq, ne, string_contains, string_begins, string_ends, include, gt, gte, lt, lte] }, | ||
number: { sortable: true, columnQueryOperators: [eq, ne, gt, gte, lt, lte, include] }, | ||
boolean: { sortable: true, columnQueryOperators: [eq] }, | ||
image: { sortable: false, columnQueryOperators: [] }, | ||
object: { sortable: false, columnQueryOperators: [] }, | ||
datetime: { sortable: true, columnQueryOperators: [eq, ne, gt, gte, lt, lte] }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.