-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Use
OperationalContext.Schema
for resolving subschemas
- Loading branch information
Showing
6 changed files
with
491 additions
and
91 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
109 changes: 109 additions & 0 deletions
109
lib/app/helper_datasource/schema_operational_context.js
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,109 @@ | ||
/** | ||
* The Schema OperationalContext class | ||
* | ||
* @constructor | ||
* | ||
* @author Jelle De Loecker <jelle@elevenways.be> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
*/ | ||
const SchemaContext = Function.inherits('Alchemy.OperationalContext.DatasourceOperationalContext', 'Schema'); | ||
|
||
/** | ||
* Set the path to the schema we want | ||
* | ||
* @author Jelle De Loecker <jelle@elevenways.be> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @param {Object} string | ||
*/ | ||
SchemaContext.setContextProperty('sub_schema_path'); | ||
|
||
/** | ||
* Current association info | ||
* | ||
* @author Jelle De Loecker <jelle@elevenways.be> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @param {Object} association | ||
*/ | ||
SchemaContext.setContextProperty('association'); | ||
|
||
/** | ||
* The path to a value, a property name | ||
* | ||
* @author Jelle De Loecker <jelle@elevenways.be> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @param {string} value_property_name | ||
*/ | ||
SchemaContext.setContextProperty('value_property_name'); | ||
|
||
/** | ||
* The current local value | ||
* | ||
* @author Jelle De Loecker <jelle@elevenways.be> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @param {string} value_property_name | ||
*/ | ||
SchemaContext.setContextProperty('local_value'); | ||
|
||
/** | ||
* The remote model name (for remote schema resolution) | ||
* | ||
* @author Jelle De Loecker <jelle@elevenways.be> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @param {string} remote_model_name | ||
*/ | ||
SchemaContext.setContextProperty('remote_model_name'); | ||
|
||
/** | ||
* The remote foreign key (for remote schema resolution) | ||
* | ||
* @author Jelle De Loecker <jelle@elevenways.be> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @param {string} remote_foreign_key | ||
*/ | ||
SchemaContext.setContextProperty('remote_foreign_key'); | ||
|
||
/** | ||
* The external field (for remote schema resolution) | ||
* | ||
* @author Jelle De Loecker <jelle@elevenways.be> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @param {Alchemy.Field.Schema} external_field | ||
*/ | ||
SchemaContext.setContextProperty('external_field'); | ||
|
||
/** | ||
* "Our field name", from the perspective of `resolveRemoteSchemaRequest` | ||
* | ||
* @author Jelle De Loecker <jelle@elevenways.be> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @param {Alchemy.Field.Schema} our_field_name | ||
*/ | ||
SchemaContext.setContextProperty('our_field_name'); | ||
|
||
/** | ||
* "Our field value", from the perspective of `resolveRemoteSchemaRequest` | ||
* | ||
* @author Jelle De Loecker <jelle@elevenways.be> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @param {*} our_field_value | ||
*/ | ||
SchemaContext.setContextProperty('our_field_value'); |
Oops, something went wrong.