@plattar/sdk-core
Advanced tools
Comparing version
@@ -20,2 +20,6 @@ /** | ||
/** | ||
* shortcut for easier chained construction of Include Queries | ||
*/ | ||
include(...objects: Array<(typeof CoreObject<CoreObjectAttributes>) | string>): Array<string>; | ||
/** | ||
* Re-fills tis object instance with data from the api | ||
@@ -22,0 +26,0 @@ */ |
@@ -38,2 +38,13 @@ "use strict"; | ||
/** | ||
* shortcut for easier chained construction of Include Queries | ||
*/ | ||
include(...objects) { | ||
return objects.map((object) => { | ||
if (typeof object === 'string' || object instanceof String) { | ||
return object; | ||
} | ||
return `${this.type}.${object.type}`; | ||
}); | ||
} | ||
/** | ||
* Re-fills tis object instance with data from the api | ||
@@ -40,0 +51,0 @@ */ |
@@ -11,7 +11,7 @@ import { CoreObjectAttributes, type CoreObject } from './core-object'; | ||
*/ | ||
static register(objectInstance: typeof CoreObject): GlobalObjectPool; | ||
static register(objectInstance: typeof CoreObject<CoreObjectAttributes>): GlobalObjectPool; | ||
/** | ||
* Used by Reflective Constructors to re-generate objects from the API at runtime | ||
*/ | ||
static get(key: string): (typeof CoreObject) | null; | ||
static get(key: string): (typeof CoreObject<CoreObjectAttributes>) | null; | ||
/** | ||
@@ -18,0 +18,0 @@ * Generates a new instance of the object provided a key, otherwise returns null |
@@ -23,5 +23,5 @@ import { CoreObject, CoreObjectAttributes } from '../core-object'; | ||
fields(...fields: Array<keyof U>): this; | ||
include(...objects: Array<typeof CoreObject>): this; | ||
contains(operation?: QueryContainsOperator, ...objects: Array<typeof CoreObject>): this; | ||
deleted(...objects: Array<typeof CoreObject>): this; | ||
include(...objects: Array<(typeof CoreObject<CoreObjectAttributes>) | string>): this; | ||
contains(operation?: QueryContainsOperator, ...objects: Array<typeof CoreObject<CoreObjectAttributes>>): this; | ||
deleted(...objects: Array<typeof CoreObject<CoreObjectAttributes>>): this; | ||
sort(operation: QuerySortOperator, variable: keyof U): this; | ||
@@ -28,0 +28,0 @@ page(count: number, size: number): this; |
@@ -9,2 +9,3 @@ "use strict"; | ||
const filter_query_1 = require("./queries/filter-query"); | ||
const include_query_1 = require("./queries/include-query"); | ||
const pagination_query_1 = require("./queries/pagination-query"); | ||
@@ -49,2 +50,9 @@ const search_query_1 = require("./queries/search-query"); | ||
include(...objects) { | ||
const data = objects.map((object) => { | ||
if (typeof object === 'string' || object instanceof String) { | ||
return object; | ||
} | ||
return `${this.instance.type}.${object.type}`; | ||
}); | ||
this._queries.push(new include_query_1.IncludeQuery(data)); | ||
return this; | ||
@@ -51,0 +59,0 @@ } |
import { Query } from "./query"; | ||
export declare class IncludeQuery extends Query { | ||
private readonly objects; | ||
constructor(objects: Array<string>); | ||
toString(): string; | ||
} |
@@ -6,6 +6,19 @@ "use strict"; | ||
class IncludeQuery extends query_1.Query { | ||
objects; | ||
constructor(objects) { | ||
super(); | ||
this.objects = objects ? objects : []; | ||
} | ||
toString() { | ||
throw new Error("Method not implemented."); | ||
let retData = ','; | ||
if (this.objects.length > 0) { | ||
retData = `include=`; | ||
this.objects.forEach((object) => { | ||
retData += `${object},`; | ||
}); | ||
} | ||
// get rid of the last element | ||
return retData.slice(0, -1); | ||
} | ||
} | ||
exports.IncludeQuery = IncludeQuery; |
@@ -59,3 +59,3 @@ "use strict"; | ||
output += '\t}\n'; | ||
output += `}\nGlobalObjectPool.register(<any>${className});\n`; | ||
output += `}\nGlobalObjectPool.register(${className});\n`; | ||
return { | ||
@@ -62,0 +62,0 @@ name: schemaInstance.type.replaceAll('_', '-'), |
@@ -1,2 +0,2 @@ | ||
declare const _default: "1.163.4"; | ||
declare const _default: "1.163.5"; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = "1.163.4"; | ||
exports.default = "1.163.5"; |
{ | ||
"name": "@plattar/sdk-core", | ||
"version": "1.163.4", | ||
"version": "1.163.5", | ||
"description": "Core SDK Module for Generative SDK using API Core", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
47205
3.1%1174
3.35%