@spica-devkit/identity 0.0.0-PLACEHOLDER
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4028 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4022 -0
- package/dist/index.mjs.map +1 -0
- package/dist/src/identity.d.ts +16 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/interface.d.ts +38 -0
- package/package.json +20 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Identity, IdentityInitialization, ApikeyInitialization, IndexResult, LoginWithStrategyResponse } from "./interface";
|
|
2
|
+
import { Strategy } from "./interface";
|
|
3
|
+
export declare function initialize(options: ApikeyInitialization | IdentityInitialization): void;
|
|
4
|
+
export declare function verifyToken(token: string, baseUrl?: string): Promise<unknown>;
|
|
5
|
+
export declare function login(identifier: string, password: string, tokenLifeSpan?: number): Promise<string>;
|
|
6
|
+
export declare function loginWithStrategy(id: string): Promise<LoginWithStrategyResponse>;
|
|
7
|
+
export declare function getStrategies(): Promise<Strategy[]>;
|
|
8
|
+
export declare function get(id: string): Promise<Identity>;
|
|
9
|
+
export declare function getAll(queryParams?: object): Promise<Identity[] | IndexResult<Identity>>;
|
|
10
|
+
export declare function insert(identity: Identity): Promise<Identity>;
|
|
11
|
+
export declare function update(id: string, identity: Identity): Promise<Identity>;
|
|
12
|
+
export declare function remove(id: string): Promise<any>;
|
|
13
|
+
export declare namespace policy {
|
|
14
|
+
function attach(identityId: string, policyIds?: string[]): Promise<string[]>;
|
|
15
|
+
function detach(identityId: string, policyIds?: string[]): Promise<string[]>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export interface Identity {
|
|
3
|
+
_id?: string;
|
|
4
|
+
identifier: string;
|
|
5
|
+
password: string;
|
|
6
|
+
policies?: string[];
|
|
7
|
+
attributes?: object;
|
|
8
|
+
}
|
|
9
|
+
export interface Strategy {
|
|
10
|
+
_id: string;
|
|
11
|
+
type: string;
|
|
12
|
+
name: string;
|
|
13
|
+
title: string;
|
|
14
|
+
}
|
|
15
|
+
export interface LoginWithStrategyResponse {
|
|
16
|
+
url: string;
|
|
17
|
+
token: Observable<string>;
|
|
18
|
+
}
|
|
19
|
+
interface InitializeOptions {
|
|
20
|
+
publicUrl?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ApikeyInitialization extends InitializeOptions {
|
|
23
|
+
apikey: string;
|
|
24
|
+
}
|
|
25
|
+
export interface IdentityInitialization extends InitializeOptions {
|
|
26
|
+
identity: string;
|
|
27
|
+
}
|
|
28
|
+
export interface InitializationResult {
|
|
29
|
+
authorization: string;
|
|
30
|
+
publicUrl: string;
|
|
31
|
+
}
|
|
32
|
+
export interface IndexResult<T> {
|
|
33
|
+
meta: {
|
|
34
|
+
total: number;
|
|
35
|
+
};
|
|
36
|
+
data: T[];
|
|
37
|
+
}
|
|
38
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spica-devkit/identity",
|
|
3
|
+
"license": "AGPLv3",
|
|
4
|
+
"version": "0.0.0-PLACEHOLDER",
|
|
5
|
+
"description": "Identity package for Spica.",
|
|
6
|
+
"author": "spica",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"spica",
|
|
9
|
+
"devkit"
|
|
10
|
+
],
|
|
11
|
+
"main": "dist/index",
|
|
12
|
+
"module": "dist/index.mjs",
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
14
|
+
"typings": "dist/index.d.ts",
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"axios": "^0.21.1",
|
|
18
|
+
"rxjs": "^6.6.3"
|
|
19
|
+
}
|
|
20
|
+
}
|