-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
227 additions
and
20 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
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export * from './http-error-info'; | ||
export * from './http-request-info'; | ||
export * from './odata-query-options'; | ||
export * from './odata-query-result-dto'; |
18 changes: 18 additions & 0 deletions
18
projects/neuroglia/angular-rest-core/src/lib/models/odata-query-options.ts
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,18 @@ | ||
import { ModelConstructor } from '@neuroglia/common'; | ||
|
||
/** | ||
* Represents the options used to configure an OData query | ||
*/ | ||
export class ODataQueryOptions extends ModelConstructor { | ||
constructor(model?: any) { | ||
super(model); | ||
} | ||
|
||
$filter?: string | undefined; | ||
$orderBy?: string | undefined; | ||
$select?: string | undefined; | ||
$skip?: number | undefined; | ||
$top?: number | undefined; | ||
$count?: boolean | undefined; | ||
$expand?: string | undefined; | ||
} |
17 changes: 17 additions & 0 deletions
17
projects/neuroglia/angular-rest-core/src/lib/models/odata-query-result-dto.ts
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,17 @@ | ||
import { ModelConstructor } from '@neuroglia/common'; | ||
|
||
/** | ||
* The results of an OData query | ||
*/ | ||
export class ODataQueryResultDto<T> extends ModelConstructor { | ||
constructor(model?: any) { | ||
super(model); | ||
this.value = model.value ? model.value.map((m: any) => m as T) : []; | ||
this['@odata.context'] = model['@odata.context'] as string; | ||
this['@odata.count'] = model['@odata.count'] as number; | ||
} | ||
|
||
value: T[]; | ||
'@odata.context': string; | ||
'@odata.count': number; | ||
} |
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
6 changes: 6 additions & 0 deletions
6
projects/neuroglia/angular-signalr/src/lib/access-token-factory-token.ts
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,6 @@ | ||
import { InjectionToken } from '@angular/core'; | ||
|
||
/** A token to provide an `accessTokenFactory` (see SignalR IHttpConnectionOptions) */ | ||
export const ACCESS_TOKEN_FACTORY_TOKEN = new InjectionToken<string>( | ||
'internal-access-token-factory-a1e016d878d74104a94391ce6d908eee', | ||
); |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './angular-signalr.module'; | ||
export * from './signalr.service'; | ||
export * from './access-token-factory-token'; |
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
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 |
---|---|---|
@@ -1,8 +1,14 @@ | ||
/** | ||
* Returns a deep copy of the provided object | ||
* @param object the object to copy | ||
* @param replacer A function that transforms the results. | ||
* @param reviver A function that transforms the results. This function is called for each member of the object. | ||
* @returns A deep copy of the given object | ||
*/ | ||
export const deepCopy = (object: any): any => { | ||
return JSON.parse(JSON.stringify(object)); | ||
export const deepCopy = ( | ||
object: any, | ||
replacer?: (this: any, key: string, value: any) => any, | ||
reviver?: (this: any, key: string, value: any) => any, | ||
): any => { | ||
return JSON.parse(JSON.stringify(object, replacer), reviver); | ||
}; |
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
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
17 changes: 17 additions & 0 deletions
17
projects/neuroglia/common/src/lib/models/operation-result.ts
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,17 @@ | ||
import { ModelConstructor } from './model-constructor'; | ||
import { OperationError } from './operation-error'; | ||
|
||
export class OperationResult<T = any> extends ModelConstructor { | ||
constructor(model?: any) { | ||
super(model); | ||
if (model) { | ||
this.errors = model.errors ? model.errors.map((m: any) => new OperationError(m)) : []; | ||
} | ||
} | ||
|
||
code: string; | ||
errors: OperationError[]; | ||
returned: boolean; | ||
suceeded: boolean; | ||
data: T; | ||
} |
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
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