@iyio/common
Advanced tools
Comparing version 0.0.10 to 0.0.11
{ | ||
"name": "@iyio/common", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -12,3 +12,3 @@ import { IAuthProvider } from "./auth-types"; | ||
export declare const apiBaseUrlParam: import("./scope-types").CallableTypeDef<string>; | ||
export declare const http: import("./scope-types").CallableTypeDef<HttpClient>; | ||
export declare const httpClient: import("./scope-types").CallableTypeDef<HttpClient>; | ||
export declare const IHttpRequestSignerType: import("./scope-types").TypeDef<IHttpRequestSigner>; | ||
@@ -23,4 +23,4 @@ export declare const IHttpFetcherType: import("./scope-types").TypeDef<HttpFetcher>; | ||
export declare const JwtProviderType: import("./scope-types").TypeDef<JwtProvider>; | ||
export declare const sqlService: import("./scope-types").CallableTypeDef<ISqlClient>; | ||
export declare const storeService: import("./scope-types").CallableTypeDef<RouterStore<any>>; | ||
export declare const sqlClient: import("./scope-types").CallableTypeDef<ISqlClient>; | ||
export declare const rootStore: import("./scope-types").CallableTypeDef<RouterStore<any>>; | ||
export declare const IStoreType: import("./scope-types").TypeDef<IStore<any> | StoreProvider<any>>; | ||
@@ -27,0 +27,0 @@ export declare const authService: import("./scope-types").CallableTypeDef<AuthService>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IAuthProviderType = exports.currentUser = exports.authService = exports.IStoreType = exports.storeService = exports.sqlService = exports.JwtProviderType = exports.httpRetryDelayMsParam = exports.httpMaxRetriesParam = exports.httpLogResponsesParam = exports.httpLogRequestsParam = exports.httpBaseUrlPrefixParam = exports.httpBaseUrlMapParam = exports.IHttpFetcherType = exports.IHttpRequestSignerType = exports.http = exports.apiBaseUrlParam = void 0; | ||
exports.IAuthProviderType = exports.currentUser = exports.authService = exports.IStoreType = exports.rootStore = exports.sqlClient = exports.JwtProviderType = exports.httpRetryDelayMsParam = exports.httpMaxRetriesParam = exports.httpLogResponsesParam = exports.httpLogRequestsParam = exports.httpBaseUrlPrefixParam = exports.httpBaseUrlMapParam = exports.IHttpFetcherType = exports.IHttpRequestSignerType = exports.httpClient = exports.apiBaseUrlParam = void 0; | ||
const AuthService_1 = require("./AuthService"); | ||
@@ -13,3 +13,3 @@ const HttpClient_1 = require("./HttpClient"); | ||
// HTTP | ||
exports.http = (0, scope_lib_1.defineService)('http', scope => HttpClient_1.HttpClient.fromScope(scope)); | ||
exports.httpClient = (0, scope_lib_1.defineClient)('httpClient', scope => HttpClient_1.HttpClient.fromScope(scope)); | ||
exports.IHttpRequestSignerType = (0, scope_lib_1.defineType)('IHttpRequestSignerType'); | ||
@@ -26,5 +26,5 @@ exports.IHttpFetcherType = (0, scope_lib_1.defineType)('IHttpFetcherType', () => new HttpDefaultFetcher_1.HttpDefaultFetcher()); | ||
// SQL | ||
exports.sqlService = (0, scope_lib_1.defineService)('sqlService'); | ||
exports.sqlClient = (0, scope_lib_1.defineClient)('sqlService'); | ||
// Store | ||
exports.storeService = (0, scope_lib_1.defineService)("storeService", scope => new RouterStore_1.RouterStore(scope)); | ||
exports.rootStore = (0, scope_lib_1.defineService)("storeService", scope => new RouterStore_1.RouterStore(scope)); | ||
exports.IStoreType = (0, scope_lib_1.defineType)("IStoreType"); | ||
@@ -31,0 +31,0 @@ // Auth |
@@ -26,3 +26,3 @@ "use strict"; | ||
providers: scope.to(_types_common_1.IAuthProviderType), | ||
store: scope.require(_types_common_1.storeService) | ||
store: scope.require(_types_common_1.rootStore) | ||
}); | ||
@@ -29,0 +29,0 @@ } |
@@ -17,3 +17,3 @@ import { CancelToken } from "./CancelToken"; | ||
*/ | ||
defineService<T>(name: string, defaultProvider?: TypeProvider<T> | TypeProviderOptions<T>): CallableTypeDef<T>; | ||
defineCallableType<T>(name: string, defaultProvider?: TypeProvider<T> | TypeProviderOptions<T>): CallableTypeDef<T>; | ||
/** | ||
@@ -82,3 +82,5 @@ * Defines a type with an observable value | ||
export declare const defineType: <T>(name: string, defaultProvider?: TypeProvider<T> | TypeProviderOptions<T> | undefined) => TypeDef<T>; | ||
export declare const defineCallableType: <T>(name: string, defaultProvider?: TypeProvider<T> | TypeProviderOptions<T> | undefined) => CallableTypeDef<T>; | ||
export declare const defineService: <T>(name: string, defaultProvider?: TypeProvider<T> | TypeProviderOptions<T> | undefined) => CallableTypeDef<T>; | ||
export declare const defineClient: <T>(name: string, defaultProvider?: TypeProvider<T> | TypeProviderOptions<T> | undefined) => CallableTypeDef<T>; | ||
interface defineObservableOverloads { | ||
@@ -85,0 +87,0 @@ <T>(name: string, defaultValue: TypeProvider<T>): ObservableTypeDef<T>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EnvParamProvider = exports.requireParam = exports.getParam = exports.defineBoolParam = exports.defineNumberParam = exports.defineStringParam = exports.defineParam = exports.defineReadonlyObservable = exports.defineObservable = exports.defineService = exports.defineType = exports.initRootScope = exports.rootScope = exports.createScope = exports.isTypeDef = void 0; | ||
exports.EnvParamProvider = exports.requireParam = exports.getParam = exports.defineBoolParam = exports.defineNumberParam = exports.defineStringParam = exports.defineParam = exports.defineReadonlyObservable = exports.defineObservable = exports.defineClient = exports.defineService = exports.defineCallableType = exports.defineType = exports.initRootScope = exports.rootScope = exports.createScope = exports.isTypeDef = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -311,3 +311,3 @@ const rxjs_1 = require("rxjs"); | ||
const defineType = (name, defaultProvider) => (_defineType({ name, defaultProvider })); | ||
const defineService = (name, defaultProvider) => (_defineCallableType({ name, defaultProvider })); | ||
const defineCallableType = (name, defaultProvider) => (_defineCallableType({ name, defaultProvider })); | ||
const defineObservable = (name, defaultValue) => _defineCallableType({ | ||
@@ -465,3 +465,3 @@ name, | ||
defineType, | ||
defineService, | ||
defineCallableType, | ||
defineObservable, | ||
@@ -566,4 +566,8 @@ defineReadonlyObservable, | ||
exports.defineType = defineType; | ||
const defineService = (name, defaultProvider) => exports.rootScope.defineService(name, defaultProvider); | ||
const defineCallableType = (name, defaultProvider) => exports.rootScope.defineCallableType(name, defaultProvider); | ||
exports.defineCallableType = defineCallableType; | ||
const defineService = (name, defaultProvider) => exports.rootScope.defineCallableType(name, defaultProvider); | ||
exports.defineService = defineService; | ||
const defineClient = (name, defaultProvider) => exports.rootScope.defineCallableType(name, defaultProvider); | ||
exports.defineClient = defineClient; | ||
exports.defineObservable = ((name, defaultValue) => (exports.rootScope.defineObservable(name, defaultValue))); | ||
@@ -570,0 +574,0 @@ exports.defineReadonlyObservable = ((name, setter, defaultValue) => (exports.rootScope.defineReadonlyObservable(name, setter, defaultValue))); |
@@ -33,1 +33,6 @@ import { NoId } from "./common-types"; | ||
} | ||
export interface SqlExecCommand { | ||
sql: string; | ||
includeResultMetadata?: boolean; | ||
noLogResult?: boolean; | ||
} |
@@ -29,4 +29,4 @@ "use strict"; | ||
const testMountedStoreAsync = (scope, basePath, route) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
const rootStore = (0, _types_common_1.storeService)(scope); | ||
rootStore.mountRoute(route); | ||
const root = (0, _types_common_1.rootStore)(scope); | ||
root.mountRoute(route); | ||
const sourceItem = (0, exports.generateRandomTestStoreItem)(); | ||
@@ -38,12 +38,12 @@ if (basePath.endsWith('/')) { | ||
const realKey = `${basePath}/${sourceItem.id}`; | ||
let item = yield rootStore.getAsync(missingKey); | ||
let item = yield root.getAsync(missingKey); | ||
if (item !== undefined) { | ||
throw new Error(`An item should have not been returned for missing key - ${missingKey}`); | ||
} | ||
item = yield rootStore.getAsync(realKey); | ||
item = yield root.getAsync(realKey); | ||
if (item !== undefined) { | ||
throw new Error(`An item should not exists at ${realKey} yet`); | ||
} | ||
yield rootStore.putAsync(realKey, sourceItem); | ||
item = yield rootStore.getAsync(realKey); | ||
yield root.putAsync(realKey, sourceItem); | ||
item = yield root.getAsync(realKey); | ||
if (!(0, object_1.deepCompare)(sourceItem, item)) { | ||
@@ -56,4 +56,4 @@ throw new Error('Returned item should be the same as source item - ' + JSON.stringify({ sourceItem, item }, null, 4)); | ||
else { | ||
yield rootStore.deleteAsync(realKey); | ||
item = yield rootStore.getAsync(realKey); | ||
yield root.deleteAsync(realKey); | ||
item = yield root.getAsync(realKey); | ||
if (item !== undefined) { | ||
@@ -60,0 +60,0 @@ throw new Error(`Item at ${realKey} should have been deleted`); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
328561
164
5458
0