Comparing version 1.0.103 to 1.0.104
@@ -6,8 +6,3 @@ export declare const orma_introspect: (db: string, fn: (s: { | ||
}) => Promise<import("./types/schema_types").DeepReadonlyObject<import("./introspector/introspector").OrmaSchemaMutable>>; | ||
export declare const orma_query: <Schema extends import("./types/schema_types").DeepReadonlyObject<import("./introspector/introspector").OrmaSchemaMutable>, Query extends import("./types/query/query_types").OrmaQuery<Schema>>(raw_query: Query, orma_schema_input: Schema, query_function: (sql_string: string[]) => Promise<Record<string, unknown>[][]>) => Promise<(import("./types/query/query_result_types").QueryResult<Schema, Query, never> & { | ||
$success: true; | ||
}) | { | ||
$success: false; | ||
errors: import("./helpers/error_handling").OrmaError[]; | ||
}>; | ||
export declare const orma_query: <Schema extends import("./types/schema_types").DeepReadonlyObject<import("./introspector/introspector").OrmaSchemaMutable>, Query extends import("./types/query/query_types").OrmaQuery<Schema>>(raw_query: Query, orma_schema_input: Schema, query_function: (sql_string: string[]) => Promise<Record<string, unknown>[][]>) => Promise<import("./types/query/query_result_types").QueryResult<Schema, Query, never>>; | ||
export declare const orma_mutate: (input_mutation: any, mysql_function: import("./mutate/mutate").mysql_fn, orma_schema: import("./types/schema_types").DeepReadonlyObject<import("./introspector/introspector").OrmaSchemaMutable>) => Promise<any>; |
@@ -7,2 +7,3 @@ "use strict"; | ||
const mutate_helpers_1 = require("../helpers/mutate_helpers"); | ||
const mutation_operations_1 = require("../statement_generation/mutation_operations"); | ||
const sort_database_rows = (mutation_pieces, queries, query_results, values_by_guid, orma_schema) => { | ||
@@ -49,3 +50,3 @@ if (query_results.length !== queries.length) { | ||
const database_index = database_indexes_by_entity[entity][identifying_key_index]; | ||
const database_row = (_a = database_index[JSON.stringify(identifying_keys.map(field => record[field]))]) !== null && _a !== void 0 ? _a : {}; | ||
const database_row = (_a = database_index[JSON.stringify(identifying_keys.map(field => (0, mutation_operations_1.get_resolved_mutation_value)(record, field, values_by_guid)))]) !== null && _a !== void 0 ? _a : {}; | ||
// if (!database_row) { | ||
@@ -52,0 +53,0 @@ // throw new Error( |
@@ -287,3 +287,4 @@ "use strict"; | ||
}); | ||
mocha_1.test.skip('works with guids as the identifying keys'); | ||
}); | ||
}); |
@@ -15,3 +15,6 @@ "use strict"; | ||
const where_clauses = identifying_keys.map(key => ({ | ||
$eq: [key, (0, escape_1.orma_escape)(record[key])], | ||
$eq: [ | ||
key, | ||
(0, escape_1.orma_escape)((0, mutation_operations_1.get_resolved_mutation_value)(record, key, values_by_guid)), | ||
], | ||
})); | ||
@@ -18,0 +21,0 @@ const where = where_clauses.length > 1 |
@@ -41,3 +41,4 @@ "use strict"; | ||
} | ||
return (0, exports.get_resolved_mutation_value)(record, field, values_by_guid); | ||
const resolved_value = (0, exports.get_resolved_mutation_value)(record, field, values_by_guid); | ||
return (resolved_value === null || resolved_value === void 0 ? void 0 : resolved_value.$guid) === undefined ? resolved_value : undefined; | ||
}; | ||
@@ -44,0 +45,0 @@ const get_resolved_mutation_value = (record, field, values_by_guid) => { |
@@ -24,3 +24,3 @@ "use strict"; | ||
const group_pieces = [...create_pieces, ...update_pieces]; | ||
const guid_query = (0, mutation_guid_query_1.get_guid_query)(group_pieces, entity, {}, orma_schema); | ||
const guid_query = (0, mutation_guid_query_1.get_guid_query)(group_pieces, entity, values_by_guid, orma_schema); | ||
return guid_query | ||
@@ -27,0 +27,0 @@ ? [ |
@@ -1,2 +0,1 @@ | ||
import { OrmaError } from '../helpers/error_handling'; | ||
import { QueryResult } from '../types/query/query_result_types'; | ||
@@ -10,9 +9,4 @@ import { OrmaQuery } from '../types/query/query_types'; | ||
export declare const orma_nester: (results: [string[], Record<string, unknown>[]][], query: any, orma_schema: OrmaSchema) => {}; | ||
export declare const orma_query: <Schema extends import("../types/schema_types").DeepReadonlyObject<import("../introspector/introspector").OrmaSchemaMutable>, Query extends OrmaQuery<Schema>>(raw_query: Query, orma_schema_input: Schema, query_function: (sql_string: string[]) => Promise<Record<string, unknown>[][]>) => Promise<(QueryResult<Schema, Query, never> & { | ||
$success: true; | ||
}) | { | ||
$success: false; | ||
errors: OrmaError[]; | ||
}>; | ||
export declare const orma_query: <Schema extends import("../types/schema_types").DeepReadonlyObject<import("../introspector/introspector").OrmaSchemaMutable>, Query extends OrmaQuery<Schema>>(raw_query: Query, orma_schema_input: Schema, query_function: (sql_string: string[]) => Promise<Record<string, unknown>[][]>) => Promise<QueryResult<Schema, Query, never>>; | ||
export declare const as_orma_schema: <Schema extends import("../types/schema_types").DeepReadonlyObject<import("../introspector/introspector").OrmaSchemaMutable>>(schema: Schema) => Schema; | ||
export declare const as_orma_query: <Schema extends import("../types/schema_types").DeepReadonlyObject<import("../introspector/introspector").OrmaSchemaMutable>, T extends DeepReadonly<OrmaQuery<Schema>>>(schema: Schema, query: T) => T; |
@@ -43,7 +43,5 @@ "use strict"; | ||
(0, __1.orma_query)(query, schema, async () => ({})).then(result => { | ||
if (result.$success) { | ||
result.my_products[0].id; | ||
result.my_products[0].images[0].my_url; | ||
} | ||
result.my_products[0].id; | ||
result.my_products[0].images[0].my_url; | ||
}); | ||
} |
{ | ||
"name": "orma", | ||
"version": "1.0.103", | ||
"version": "1.0.104", | ||
"description": "A declarative relational syncronous orm", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1204163
315
31916