@omnibase/core-js 0.1.3 → 0.1.4
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/auth/index.cjs +18 -0
- package/dist/auth/index.d.cts +103 -0
- package/dist/auth/index.d.ts +103 -0
- package/dist/auth/index.js +0 -0
- package/dist/tenants/index.d.cts +10 -3
- package/dist/tenants/index.d.ts +10 -3
- package/package.json +2 -5
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/auth/index.ts
|
|
17
|
+
var auth_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(auth_exports);
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { LoginFlow as LoginFlow$1, RecoveryFlow as RecoveryFlow$1, VerificationFlow as VerificationFlow$1, RegistrationFlow as RegistrationFlow$1, SettingsFlow as SettingsFlow$1, SessionAuthenticationMethod, AuthenticatorAssuranceLevel, SessionDevice, Identity } from '@ory/client-fetch';
|
|
2
|
+
|
|
3
|
+
type FlowType = LoginFlow | RecoveryFlow | VerificationFlow | RegistrationFlow | SettingsFlow;
|
|
4
|
+
/**
|
|
5
|
+
* This object represents a login flow. A login flow is initiated at the "Initiate Login API / Browser Flow" endpoint by a client.
|
|
6
|
+
*
|
|
7
|
+
* Once a login flow is completed successfully, a session cookie or session token will be issued.
|
|
8
|
+
*/
|
|
9
|
+
type LoginFlow = LoginFlow$1;
|
|
10
|
+
/**
|
|
11
|
+
* This flow is used when an identity wants to recover their account.
|
|
12
|
+
*/
|
|
13
|
+
type RecoveryFlow = RecoveryFlow$1;
|
|
14
|
+
/**
|
|
15
|
+
* Used to verify an out-of-band communication channel such as an email address or a phone number.
|
|
16
|
+
*/
|
|
17
|
+
type VerificationFlow = VerificationFlow$1;
|
|
18
|
+
/**
|
|
19
|
+
* Used when a user is registering an account
|
|
20
|
+
*/
|
|
21
|
+
type RegistrationFlow = RegistrationFlow$1;
|
|
22
|
+
/**
|
|
23
|
+
* This flow is used when an identity wants to update settings (e.g. profile data, passwords, ...) in a selfservice manner.
|
|
24
|
+
*/
|
|
25
|
+
type SettingsFlow = SettingsFlow$1;
|
|
26
|
+
/**
|
|
27
|
+
* A Session
|
|
28
|
+
* @export
|
|
29
|
+
* @interface Session
|
|
30
|
+
*/
|
|
31
|
+
type Session = {
|
|
32
|
+
/**
|
|
33
|
+
* Active state. If false the session is no longer active.
|
|
34
|
+
* @type {boolean}
|
|
35
|
+
* @memberof Session
|
|
36
|
+
*/
|
|
37
|
+
active?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The Session Authentication Timestamp
|
|
40
|
+
*
|
|
41
|
+
* When this session was authenticated at. If multi-factor authentication was used this
|
|
42
|
+
* is the time when the last factor was authenticated (e.g. the TOTP code challenge was completed).
|
|
43
|
+
* @type {Date}
|
|
44
|
+
* @memberof Session
|
|
45
|
+
*/
|
|
46
|
+
authenticated_at?: Date;
|
|
47
|
+
/**
|
|
48
|
+
* A list of authenticators which were used to authenticate the session.
|
|
49
|
+
* @type {Array<SessionAuthenticationMethod>}
|
|
50
|
+
* @memberof Session
|
|
51
|
+
*/
|
|
52
|
+
authentication_methods?: Array<SessionAuthenticationMethod>;
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @type {AuthenticatorAssuranceLevel}
|
|
56
|
+
* @memberof Session
|
|
57
|
+
*/
|
|
58
|
+
authenticator_assurance_level?: AuthenticatorAssuranceLevel;
|
|
59
|
+
/**
|
|
60
|
+
* Devices has history of all endpoints where the session was used
|
|
61
|
+
* @type {Array<SessionDevice>}
|
|
62
|
+
* @memberof Session
|
|
63
|
+
*/
|
|
64
|
+
devices?: Array<SessionDevice>;
|
|
65
|
+
/**
|
|
66
|
+
* The Session Expiry
|
|
67
|
+
*
|
|
68
|
+
* When this session expires at.
|
|
69
|
+
* @type {Date}
|
|
70
|
+
* @memberof Session
|
|
71
|
+
*/
|
|
72
|
+
expires_at?: Date;
|
|
73
|
+
/**
|
|
74
|
+
* Session ID
|
|
75
|
+
* @type {string}
|
|
76
|
+
* @memberof Session
|
|
77
|
+
*/
|
|
78
|
+
id: string;
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
* @type {Identity}
|
|
82
|
+
* @memberof Session
|
|
83
|
+
*/
|
|
84
|
+
identity?: Identity;
|
|
85
|
+
/**
|
|
86
|
+
* The Session Issuance Timestamp
|
|
87
|
+
*
|
|
88
|
+
* When this session was issued at. Usually equal or close to `authenticated_at`.
|
|
89
|
+
* @type {Date}
|
|
90
|
+
* @memberof Session
|
|
91
|
+
*/
|
|
92
|
+
issued_at?: Date;
|
|
93
|
+
/**
|
|
94
|
+
* Tokenized is the tokenized (e.g. JWT) version of the session.
|
|
95
|
+
*
|
|
96
|
+
* It is only set when the `tokenize_as` query parameter was set to a valid tokenize template during calls to `/session/whoami`.
|
|
97
|
+
* @type {string}
|
|
98
|
+
* @memberof Session
|
|
99
|
+
*/
|
|
100
|
+
tokenized?: string;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export type { FlowType, LoginFlow, RecoveryFlow, RegistrationFlow, Session, SettingsFlow, VerificationFlow };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { LoginFlow as LoginFlow$1, RecoveryFlow as RecoveryFlow$1, VerificationFlow as VerificationFlow$1, RegistrationFlow as RegistrationFlow$1, SettingsFlow as SettingsFlow$1, SessionAuthenticationMethod, AuthenticatorAssuranceLevel, SessionDevice, Identity } from '@ory/client-fetch';
|
|
2
|
+
|
|
3
|
+
type FlowType = LoginFlow | RecoveryFlow | VerificationFlow | RegistrationFlow | SettingsFlow;
|
|
4
|
+
/**
|
|
5
|
+
* This object represents a login flow. A login flow is initiated at the "Initiate Login API / Browser Flow" endpoint by a client.
|
|
6
|
+
*
|
|
7
|
+
* Once a login flow is completed successfully, a session cookie or session token will be issued.
|
|
8
|
+
*/
|
|
9
|
+
type LoginFlow = LoginFlow$1;
|
|
10
|
+
/**
|
|
11
|
+
* This flow is used when an identity wants to recover their account.
|
|
12
|
+
*/
|
|
13
|
+
type RecoveryFlow = RecoveryFlow$1;
|
|
14
|
+
/**
|
|
15
|
+
* Used to verify an out-of-band communication channel such as an email address or a phone number.
|
|
16
|
+
*/
|
|
17
|
+
type VerificationFlow = VerificationFlow$1;
|
|
18
|
+
/**
|
|
19
|
+
* Used when a user is registering an account
|
|
20
|
+
*/
|
|
21
|
+
type RegistrationFlow = RegistrationFlow$1;
|
|
22
|
+
/**
|
|
23
|
+
* This flow is used when an identity wants to update settings (e.g. profile data, passwords, ...) in a selfservice manner.
|
|
24
|
+
*/
|
|
25
|
+
type SettingsFlow = SettingsFlow$1;
|
|
26
|
+
/**
|
|
27
|
+
* A Session
|
|
28
|
+
* @export
|
|
29
|
+
* @interface Session
|
|
30
|
+
*/
|
|
31
|
+
type Session = {
|
|
32
|
+
/**
|
|
33
|
+
* Active state. If false the session is no longer active.
|
|
34
|
+
* @type {boolean}
|
|
35
|
+
* @memberof Session
|
|
36
|
+
*/
|
|
37
|
+
active?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The Session Authentication Timestamp
|
|
40
|
+
*
|
|
41
|
+
* When this session was authenticated at. If multi-factor authentication was used this
|
|
42
|
+
* is the time when the last factor was authenticated (e.g. the TOTP code challenge was completed).
|
|
43
|
+
* @type {Date}
|
|
44
|
+
* @memberof Session
|
|
45
|
+
*/
|
|
46
|
+
authenticated_at?: Date;
|
|
47
|
+
/**
|
|
48
|
+
* A list of authenticators which were used to authenticate the session.
|
|
49
|
+
* @type {Array<SessionAuthenticationMethod>}
|
|
50
|
+
* @memberof Session
|
|
51
|
+
*/
|
|
52
|
+
authentication_methods?: Array<SessionAuthenticationMethod>;
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @type {AuthenticatorAssuranceLevel}
|
|
56
|
+
* @memberof Session
|
|
57
|
+
*/
|
|
58
|
+
authenticator_assurance_level?: AuthenticatorAssuranceLevel;
|
|
59
|
+
/**
|
|
60
|
+
* Devices has history of all endpoints where the session was used
|
|
61
|
+
* @type {Array<SessionDevice>}
|
|
62
|
+
* @memberof Session
|
|
63
|
+
*/
|
|
64
|
+
devices?: Array<SessionDevice>;
|
|
65
|
+
/**
|
|
66
|
+
* The Session Expiry
|
|
67
|
+
*
|
|
68
|
+
* When this session expires at.
|
|
69
|
+
* @type {Date}
|
|
70
|
+
* @memberof Session
|
|
71
|
+
*/
|
|
72
|
+
expires_at?: Date;
|
|
73
|
+
/**
|
|
74
|
+
* Session ID
|
|
75
|
+
* @type {string}
|
|
76
|
+
* @memberof Session
|
|
77
|
+
*/
|
|
78
|
+
id: string;
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
* @type {Identity}
|
|
82
|
+
* @memberof Session
|
|
83
|
+
*/
|
|
84
|
+
identity?: Identity;
|
|
85
|
+
/**
|
|
86
|
+
* The Session Issuance Timestamp
|
|
87
|
+
*
|
|
88
|
+
* When this session was issued at. Usually equal or close to `authenticated_at`.
|
|
89
|
+
* @type {Date}
|
|
90
|
+
* @memberof Session
|
|
91
|
+
*/
|
|
92
|
+
issued_at?: Date;
|
|
93
|
+
/**
|
|
94
|
+
* Tokenized is the tokenized (e.g. JWT) version of the session.
|
|
95
|
+
*
|
|
96
|
+
* It is only set when the `tokenize_as` query parameter was set to a valid tokenize template during calls to `/session/whoami`.
|
|
97
|
+
* @type {string}
|
|
98
|
+
* @memberof Session
|
|
99
|
+
*/
|
|
100
|
+
tokenized?: string;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export type { FlowType, LoginFlow, RecoveryFlow, RegistrationFlow, Session, SettingsFlow, VerificationFlow };
|
|
File without changes
|
package/dist/tenants/index.d.cts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ApiResponse } from '../index.cjs';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Return type of the `acceptTenantInvite` function
|
|
5
3
|
*/
|
|
@@ -100,6 +98,15 @@ type DeleteTenantResponse = ApiResponse<{
|
|
|
100
98
|
*/
|
|
101
99
|
declare function deleteTenant(tenantId: string): Promise<DeleteTenantResponse>;
|
|
102
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Base API Response structure for API
|
|
103
|
+
*/
|
|
104
|
+
type ApiResponse<T> = {
|
|
105
|
+
data?: T;
|
|
106
|
+
status: number;
|
|
107
|
+
error?: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
103
110
|
/**
|
|
104
111
|
* Return type of the `switchActiveTenant` function
|
|
105
112
|
*/
|
|
@@ -114,4 +121,4 @@ type SwitchActiveTenantResponse = ApiResponse<{
|
|
|
114
121
|
*/
|
|
115
122
|
declare function switchActiveTenant(tenantId: string): Promise<SwitchActiveTenantResponse>;
|
|
116
123
|
|
|
117
|
-
export { type AcceptTenantInviteResponse, ApiResponse, type CreateTenantRequest, type CreateTenantResponse, type CreateTenantUserInviteRequest, type CreateTenantUserInviteResponse, type DeleteTenantResponse, type SwitchActiveTenantResponse, type Tenant, type TenantInvite, acceptTenantInvite, createTenant, createTenantUserInvite, deleteTenant, switchActiveTenant };
|
|
124
|
+
export { type AcceptTenantInviteResponse, type ApiResponse, type CreateTenantRequest, type CreateTenantResponse, type CreateTenantUserInviteRequest, type CreateTenantUserInviteResponse, type DeleteTenantResponse, type SwitchActiveTenantResponse, type Tenant, type TenantInvite, acceptTenantInvite, createTenant, createTenantUserInvite, deleteTenant, switchActiveTenant };
|
package/dist/tenants/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ApiResponse } from '../index.js';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Return type of the `acceptTenantInvite` function
|
|
5
3
|
*/
|
|
@@ -100,6 +98,15 @@ type DeleteTenantResponse = ApiResponse<{
|
|
|
100
98
|
*/
|
|
101
99
|
declare function deleteTenant(tenantId: string): Promise<DeleteTenantResponse>;
|
|
102
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Base API Response structure for API
|
|
103
|
+
*/
|
|
104
|
+
type ApiResponse<T> = {
|
|
105
|
+
data?: T;
|
|
106
|
+
status: number;
|
|
107
|
+
error?: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
103
110
|
/**
|
|
104
111
|
* Return type of the `switchActiveTenant` function
|
|
105
112
|
*/
|
|
@@ -114,4 +121,4 @@ type SwitchActiveTenantResponse = ApiResponse<{
|
|
|
114
121
|
*/
|
|
115
122
|
declare function switchActiveTenant(tenantId: string): Promise<SwitchActiveTenantResponse>;
|
|
116
123
|
|
|
117
|
-
export { type AcceptTenantInviteResponse, ApiResponse, type CreateTenantRequest, type CreateTenantResponse, type CreateTenantUserInviteRequest, type CreateTenantUserInviteResponse, type DeleteTenantResponse, type SwitchActiveTenantResponse, type Tenant, type TenantInvite, acceptTenantInvite, createTenant, createTenantUserInvite, deleteTenant, switchActiveTenant };
|
|
124
|
+
export { type AcceptTenantInviteResponse, type ApiResponse, type CreateTenantRequest, type CreateTenantResponse, type CreateTenantUserInviteRequest, type CreateTenantUserInviteResponse, type DeleteTenantResponse, type SwitchActiveTenantResponse, type Tenant, type TenantInvite, acceptTenantInvite, createTenant, createTenantUserInvite, deleteTenant, switchActiveTenant };
|
package/package.json
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnibase/core-js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "OmniBase core Javascript SDK - framework agnostic",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*"
|
|
7
7
|
],
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "tsup src/
|
|
10
|
+
"build": "tsup src/database/index.ts src/tenants/index.ts src/auth/index.ts --format cjs,esm --dts",
|
|
11
11
|
"prepublishOnly": "npm run build"
|
|
12
12
|
},
|
|
13
13
|
"exports": {
|
|
14
|
-
".": {
|
|
15
|
-
"types": "./dist/index.d.ts"
|
|
16
|
-
},
|
|
17
14
|
"./auth": {
|
|
18
15
|
"types": "./dist/auth/index.d.ts"
|
|
19
16
|
},
|