@smallstack/common
Advanced tools
Comparing version 0.7.39 to 0.7.40
import { Collection, DataBridge } from "../index"; | ||
import { TokenService } from "../interfaces/TokenService"; | ||
import { APISyncOptions } from "./APISyncOptions"; | ||
import { CollectionsService } from "./CollectionsService"; | ||
@@ -9,2 +8,3 @@ import { MongoDBAllowDenyOptions, MongoDBCollection } from "./MongoDBCollection"; | ||
import { Typesystem } from "./Typesystem"; | ||
import { APIRequestOptions } from "./APIRequestOptions"; | ||
export declare abstract class BaseCollection<ModelClass extends SmallstackModel> implements Collection<ModelClass> { | ||
@@ -23,3 +23,3 @@ protected collectionsService: CollectionsService; | ||
*/ | ||
syncViaJSONAPI(url: string, options?: APISyncOptions): Promise<void>; | ||
syncViaJSONAPI(url: string, options?: APIRequestOptions): Promise<void>; | ||
/** | ||
@@ -26,0 +26,0 @@ * extracts all foreign IDs and subscribes to the foreign documents. afterwards you can be sure that all necessary foreign documents have been synced |
import { MongoDBAllowDenyOptions, MongoDBCollection } from "./MongoDBCollection"; | ||
import { QueryOptions } from "./QueryOptions"; | ||
import { SmallstackModel } from "./SmallstackModel"; | ||
import { APISyncOptions } from "./APISyncOptions"; | ||
import { APIRequestOptions } from "./APIRequestOptions"; | ||
export interface Collection<ModelClass extends SmallstackModel> { | ||
@@ -13,3 +13,3 @@ /** | ||
*/ | ||
syncViaJSONAPI(url: string, options?: APISyncOptions): Promise<void>; | ||
syncViaJSONAPI(url: string, options?: APIRequestOptions): Promise<void>; | ||
/** | ||
@@ -16,0 +16,0 @@ * extracts all foreign IDs and subscribes to the foreign documents. afterwards you can be sure that all necessary foreign documents have been synced |
@@ -1,2 +0,3 @@ | ||
import { APISyncOptions } from "./APISyncOptions"; | ||
import { APIPaginationResult } from "../index"; | ||
import { APIRequestOptions } from "./APIRequestOptions"; | ||
import { Collection } from "./Collection"; | ||
@@ -7,5 +8,6 @@ import { MongoDBCursor } from "./MongoDBCursor"; | ||
import { SmallstackModel } from "./SmallstackModel"; | ||
import { TypeServiceQuery } from "./Type"; | ||
export declare class DefaultQueryObject<ModelClass extends SmallstackModel> implements QueryObject<ModelClass> { | ||
private selector; | ||
private subscriptionName; | ||
private serviceQuery; | ||
private queryOptions; | ||
@@ -20,3 +22,4 @@ private parameters; | ||
private configurationService; | ||
create(selector: any, subscriptionName: string, queryOptions: QueryOptions, parameters: any, sorting: any, collection: Collection<ModelClass>): QueryObject<ModelClass>; | ||
private dataBridge; | ||
create(selector: any, serviceQuery: TypeServiceQuery, queryOptions: QueryOptions, parameters: any, sorting: any, collection: Collection<ModelClass>): QueryObject<ModelClass>; | ||
getSelector(): any; | ||
@@ -28,3 +31,4 @@ getCursor(): MongoDBCursor<ModelClass>; | ||
subscribe(): Promise<QueryObject<ModelClass>>; | ||
syncViaJSONAPI(options?: APISyncOptions): Promise<QueryObject<ModelClass>>; | ||
syncViaJSONAPI(options?: APIRequestOptions): Promise<QueryObject<ModelClass>>; | ||
httpCall(options?: APIRequestOptions): Promise<APIPaginationResult<ModelClass>>; | ||
expand(foreignKeys: string[]): Promise<void>; | ||
@@ -31,0 +35,0 @@ getCount(): Promise<number>; |
@@ -1,2 +0,2 @@ | ||
import { APISyncOptions } from "./APISyncOptions"; | ||
import { APIRequestOptions } from "./APIRequestOptions"; | ||
import { Collection } from "./Collection"; | ||
@@ -6,4 +6,6 @@ import { MongoDBCursor } from "./MongoDBCursor"; | ||
import { SmallstackModel } from "./SmallstackModel"; | ||
import { APIListResponse } from "../api/APIResponses"; | ||
import { TypeServiceQuery } from "./Type"; | ||
export interface QueryObject<ModelClass extends SmallstackModel> { | ||
create(selector: any, subscriptionName: string, queryOptions: QueryOptions, parameters: any, sorting: any, collection: Collection<ModelClass>): QueryObject<ModelClass>; | ||
create(selector: any, serviceQuery: TypeServiceQuery, queryOptions: QueryOptions, parameters: any, sorting: any, collection: Collection<ModelClass>): QueryObject<ModelClass>; | ||
getSelector(): any; | ||
@@ -22,3 +24,4 @@ getCursor(): MongoDBCursor<ModelClass>; | ||
*/ | ||
syncViaJSONAPI(options?: APISyncOptions): Promise<QueryObject<ModelClass>>; | ||
syncViaJSONAPI(options?: APIRequestOptions): Promise<QueryObject<ModelClass>>; | ||
httpCall(options?: APIRequestOptions): Promise<APIListResponse<ModelClass>>; | ||
expand(foreignKeys: string[]): Promise<void>; | ||
@@ -25,0 +28,0 @@ getCount(): Promise<number>; |
import { QueryOptions } from "./data/QueryOptions"; | ||
export interface HTTPCallOptions { | ||
[key: string]: any; | ||
headers?: { | ||
[key: string]: string; | ||
"x-smallstack-token": string; | ||
}; | ||
body?: any; | ||
} | ||
export interface DataBridge { | ||
httpCall(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD", url: string, options?: any): Promise<any>; | ||
httpCall(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD", url: string, options?: HTTPCallOptions): Promise<any>; | ||
ddpCall(methodName: string, parameters: any): Promise<any>; | ||
@@ -5,0 +13,0 @@ ddpSubscribe(publicationName: string, parameters: any, options: QueryOptions, callbackFns: { |
@@ -36,3 +36,3 @@ export * from "./InitLevelService"; | ||
export * from "./data/TypesystemUtils"; | ||
export * from "./data/APISyncOptions"; | ||
export * from "./data/APIRequestOptions"; | ||
export * from "./data/TypesystemInitOptions"; | ||
@@ -48,1 +48,2 @@ export * from "./data/TypeValidator"; | ||
export * from "./api/APIParams"; | ||
export * from "./workflow/DefaultEvents"; |
@@ -35,2 +35,3 @@ export declare enum PadDirection { | ||
static getApiURL(collectionName: string, queryName: string): string; | ||
static objectToURLParams(obj: any): string; | ||
} |
{ | ||
"name": "@smallstack/common", | ||
"version": "0.7.39", | ||
"version": "0.7.40", | ||
"description": "common functionality for smallstack projects", | ||
@@ -5,0 +5,0 @@ "main": "dist/bundle/smallstack_common.umd.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
424355
84
2217