@supertokens-plugins/rownd-nodejs 0.2.0 → 0.2.1
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.mts +136 -0
- package/dist/index.d.ts +136 -0
- package/dist/index.js +1109 -0
- package/dist/index.mjs +1095 -0
- package/package.json +1 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import * as supertokens_node from 'supertokens-node';
|
|
2
|
+
import * as _shared_js from '@shared/js';
|
|
3
|
+
import { JSONObject, SuperTokensPlugin } from 'supertokens-node/types';
|
|
4
|
+
|
|
5
|
+
interface RowndPluginConfig {
|
|
6
|
+
rowndAppKey: string;
|
|
7
|
+
rowndAppSecret: string;
|
|
8
|
+
enableDebugLogs?: boolean;
|
|
9
|
+
telemetry?: RowndTelemetryConfig;
|
|
10
|
+
}
|
|
11
|
+
type RowndTelemetryEvent = {
|
|
12
|
+
outcome: "success";
|
|
13
|
+
durationMs: number;
|
|
14
|
+
tenantId?: string;
|
|
15
|
+
rowndUserId?: string;
|
|
16
|
+
superTokensUserId?: string;
|
|
17
|
+
} | {
|
|
18
|
+
outcome: "error";
|
|
19
|
+
durationMs: number;
|
|
20
|
+
tenantId?: string;
|
|
21
|
+
rowndUserId?: string;
|
|
22
|
+
superTokensUserId?: string;
|
|
23
|
+
error: {
|
|
24
|
+
message: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
interface RowndTelemetryClient {
|
|
29
|
+
recordEvent: (event: RowndTelemetryEvent) => Promise<void> | void;
|
|
30
|
+
}
|
|
31
|
+
type RowndTelemetryConfig = {
|
|
32
|
+
provider: "opentelemetry";
|
|
33
|
+
} | {
|
|
34
|
+
provider: "axiom";
|
|
35
|
+
token: string;
|
|
36
|
+
dataset: string;
|
|
37
|
+
url?: string;
|
|
38
|
+
} | {
|
|
39
|
+
provider: "custom";
|
|
40
|
+
factory: () => RowndTelemetryClient;
|
|
41
|
+
};
|
|
42
|
+
interface RowndUser {
|
|
43
|
+
state: string;
|
|
44
|
+
auth_level: string;
|
|
45
|
+
data: {
|
|
46
|
+
user_id: string;
|
|
47
|
+
email?: string;
|
|
48
|
+
phone_number?: string;
|
|
49
|
+
google_id?: string;
|
|
50
|
+
apple_id?: string;
|
|
51
|
+
first_name?: string;
|
|
52
|
+
last_name?: string;
|
|
53
|
+
};
|
|
54
|
+
attributes?: Record<string, string>;
|
|
55
|
+
verified_data: {
|
|
56
|
+
email?: string;
|
|
57
|
+
phone_number?: string;
|
|
58
|
+
google_id?: string;
|
|
59
|
+
apple_id?: string;
|
|
60
|
+
};
|
|
61
|
+
groups?: string[];
|
|
62
|
+
meta?: {
|
|
63
|
+
created?: string;
|
|
64
|
+
modified?: string;
|
|
65
|
+
first_sign_in?: string;
|
|
66
|
+
last_sign_in?: string;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
interface MigrationResponse {
|
|
70
|
+
status: "OK" | "ERROR";
|
|
71
|
+
message?: string;
|
|
72
|
+
}
|
|
73
|
+
interface RowndPluginNormalisedConfig {
|
|
74
|
+
rowndAppKey: string;
|
|
75
|
+
rowndAppSecret: string;
|
|
76
|
+
enableDebugLogs?: boolean;
|
|
77
|
+
telemetry?: RowndTelemetryConfig;
|
|
78
|
+
}
|
|
79
|
+
interface SuperTokensUserImport {
|
|
80
|
+
externalUserId: string;
|
|
81
|
+
timeJoined?: number;
|
|
82
|
+
userMetadata: JSONObject;
|
|
83
|
+
loginMethods: ({
|
|
84
|
+
recipeId: "emailpassword";
|
|
85
|
+
email: string;
|
|
86
|
+
passwordHash: string;
|
|
87
|
+
isVerified: boolean;
|
|
88
|
+
} | {
|
|
89
|
+
recipeId: "thirdparty";
|
|
90
|
+
thirdPartyId: string;
|
|
91
|
+
thirdPartyUserId: string;
|
|
92
|
+
email: string;
|
|
93
|
+
isVerified: boolean;
|
|
94
|
+
} | {
|
|
95
|
+
recipeId: "passwordless";
|
|
96
|
+
email?: string;
|
|
97
|
+
phoneNumber?: string;
|
|
98
|
+
isVerified: boolean;
|
|
99
|
+
})[];
|
|
100
|
+
}
|
|
101
|
+
interface IRowndClient {
|
|
102
|
+
validateToken: (token: string) => Promise<{
|
|
103
|
+
user_id: string;
|
|
104
|
+
}>;
|
|
105
|
+
fetchUserInfo: (opts: {
|
|
106
|
+
user_id: string;
|
|
107
|
+
app_id?: string;
|
|
108
|
+
}) => Promise<RowndUser | undefined>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare const init: (config: RowndPluginConfig & {
|
|
112
|
+
override?: ((oI: _shared_js.OverridableFunctions<{}>) => _shared_js.OverridableFunctions<{}>) | undefined;
|
|
113
|
+
}) => SuperTokensPlugin;
|
|
114
|
+
|
|
115
|
+
declare const PLUGIN_ID = "supertokens-plugin-rownd";
|
|
116
|
+
declare const PLUGIN_SDK_VERSION: string[];
|
|
117
|
+
declare const HANDLE_BASE_PATH = "/plugin/rownd";
|
|
118
|
+
declare const PUBLIC_TENANT_ID = "public";
|
|
119
|
+
|
|
120
|
+
declare const ROWND_PLUGIN_ERROR_MESSAGES: {
|
|
121
|
+
readonly MISSING_AUTHORIZATION_HEADER: "Missing authorization header";
|
|
122
|
+
readonly INVALID_TOKEN: "Invalid token";
|
|
123
|
+
readonly ROWND_USER_NOT_FOUND: "User not found in Rownd";
|
|
124
|
+
};
|
|
125
|
+
type RowndPluginErrorType = keyof typeof ROWND_PLUGIN_ERROR_MESSAGES;
|
|
126
|
+
declare class RowndPluginError extends Error {
|
|
127
|
+
constructor(type: RowndPluginErrorType);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare const _default: {
|
|
131
|
+
init: (config: RowndPluginConfig & {
|
|
132
|
+
override?: ((oI: _shared_js.OverridableFunctions<{}>) => _shared_js.OverridableFunctions<{}>) | undefined;
|
|
133
|
+
}) => supertokens_node.SuperTokensPlugin;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export { HANDLE_BASE_PATH, type IRowndClient, type MigrationResponse, PLUGIN_ID, PLUGIN_SDK_VERSION, PUBLIC_TENANT_ID, ROWND_PLUGIN_ERROR_MESSAGES, type RowndPluginConfig, RowndPluginError, type RowndPluginErrorType, type RowndPluginNormalisedConfig, type RowndTelemetryClient, type RowndTelemetryConfig, type RowndTelemetryEvent, type RowndUser, type SuperTokensUserImport, _default as default, init };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import * as supertokens_node from 'supertokens-node';
|
|
2
|
+
import * as _shared_js from '@shared/js';
|
|
3
|
+
import { JSONObject, SuperTokensPlugin } from 'supertokens-node/types';
|
|
4
|
+
|
|
5
|
+
interface RowndPluginConfig {
|
|
6
|
+
rowndAppKey: string;
|
|
7
|
+
rowndAppSecret: string;
|
|
8
|
+
enableDebugLogs?: boolean;
|
|
9
|
+
telemetry?: RowndTelemetryConfig;
|
|
10
|
+
}
|
|
11
|
+
type RowndTelemetryEvent = {
|
|
12
|
+
outcome: "success";
|
|
13
|
+
durationMs: number;
|
|
14
|
+
tenantId?: string;
|
|
15
|
+
rowndUserId?: string;
|
|
16
|
+
superTokensUserId?: string;
|
|
17
|
+
} | {
|
|
18
|
+
outcome: "error";
|
|
19
|
+
durationMs: number;
|
|
20
|
+
tenantId?: string;
|
|
21
|
+
rowndUserId?: string;
|
|
22
|
+
superTokensUserId?: string;
|
|
23
|
+
error: {
|
|
24
|
+
message: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
interface RowndTelemetryClient {
|
|
29
|
+
recordEvent: (event: RowndTelemetryEvent) => Promise<void> | void;
|
|
30
|
+
}
|
|
31
|
+
type RowndTelemetryConfig = {
|
|
32
|
+
provider: "opentelemetry";
|
|
33
|
+
} | {
|
|
34
|
+
provider: "axiom";
|
|
35
|
+
token: string;
|
|
36
|
+
dataset: string;
|
|
37
|
+
url?: string;
|
|
38
|
+
} | {
|
|
39
|
+
provider: "custom";
|
|
40
|
+
factory: () => RowndTelemetryClient;
|
|
41
|
+
};
|
|
42
|
+
interface RowndUser {
|
|
43
|
+
state: string;
|
|
44
|
+
auth_level: string;
|
|
45
|
+
data: {
|
|
46
|
+
user_id: string;
|
|
47
|
+
email?: string;
|
|
48
|
+
phone_number?: string;
|
|
49
|
+
google_id?: string;
|
|
50
|
+
apple_id?: string;
|
|
51
|
+
first_name?: string;
|
|
52
|
+
last_name?: string;
|
|
53
|
+
};
|
|
54
|
+
attributes?: Record<string, string>;
|
|
55
|
+
verified_data: {
|
|
56
|
+
email?: string;
|
|
57
|
+
phone_number?: string;
|
|
58
|
+
google_id?: string;
|
|
59
|
+
apple_id?: string;
|
|
60
|
+
};
|
|
61
|
+
groups?: string[];
|
|
62
|
+
meta?: {
|
|
63
|
+
created?: string;
|
|
64
|
+
modified?: string;
|
|
65
|
+
first_sign_in?: string;
|
|
66
|
+
last_sign_in?: string;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
interface MigrationResponse {
|
|
70
|
+
status: "OK" | "ERROR";
|
|
71
|
+
message?: string;
|
|
72
|
+
}
|
|
73
|
+
interface RowndPluginNormalisedConfig {
|
|
74
|
+
rowndAppKey: string;
|
|
75
|
+
rowndAppSecret: string;
|
|
76
|
+
enableDebugLogs?: boolean;
|
|
77
|
+
telemetry?: RowndTelemetryConfig;
|
|
78
|
+
}
|
|
79
|
+
interface SuperTokensUserImport {
|
|
80
|
+
externalUserId: string;
|
|
81
|
+
timeJoined?: number;
|
|
82
|
+
userMetadata: JSONObject;
|
|
83
|
+
loginMethods: ({
|
|
84
|
+
recipeId: "emailpassword";
|
|
85
|
+
email: string;
|
|
86
|
+
passwordHash: string;
|
|
87
|
+
isVerified: boolean;
|
|
88
|
+
} | {
|
|
89
|
+
recipeId: "thirdparty";
|
|
90
|
+
thirdPartyId: string;
|
|
91
|
+
thirdPartyUserId: string;
|
|
92
|
+
email: string;
|
|
93
|
+
isVerified: boolean;
|
|
94
|
+
} | {
|
|
95
|
+
recipeId: "passwordless";
|
|
96
|
+
email?: string;
|
|
97
|
+
phoneNumber?: string;
|
|
98
|
+
isVerified: boolean;
|
|
99
|
+
})[];
|
|
100
|
+
}
|
|
101
|
+
interface IRowndClient {
|
|
102
|
+
validateToken: (token: string) => Promise<{
|
|
103
|
+
user_id: string;
|
|
104
|
+
}>;
|
|
105
|
+
fetchUserInfo: (opts: {
|
|
106
|
+
user_id: string;
|
|
107
|
+
app_id?: string;
|
|
108
|
+
}) => Promise<RowndUser | undefined>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare const init: (config: RowndPluginConfig & {
|
|
112
|
+
override?: ((oI: _shared_js.OverridableFunctions<{}>) => _shared_js.OverridableFunctions<{}>) | undefined;
|
|
113
|
+
}) => SuperTokensPlugin;
|
|
114
|
+
|
|
115
|
+
declare const PLUGIN_ID = "supertokens-plugin-rownd";
|
|
116
|
+
declare const PLUGIN_SDK_VERSION: string[];
|
|
117
|
+
declare const HANDLE_BASE_PATH = "/plugin/rownd";
|
|
118
|
+
declare const PUBLIC_TENANT_ID = "public";
|
|
119
|
+
|
|
120
|
+
declare const ROWND_PLUGIN_ERROR_MESSAGES: {
|
|
121
|
+
readonly MISSING_AUTHORIZATION_HEADER: "Missing authorization header";
|
|
122
|
+
readonly INVALID_TOKEN: "Invalid token";
|
|
123
|
+
readonly ROWND_USER_NOT_FOUND: "User not found in Rownd";
|
|
124
|
+
};
|
|
125
|
+
type RowndPluginErrorType = keyof typeof ROWND_PLUGIN_ERROR_MESSAGES;
|
|
126
|
+
declare class RowndPluginError extends Error {
|
|
127
|
+
constructor(type: RowndPluginErrorType);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare const _default: {
|
|
131
|
+
init: (config: RowndPluginConfig & {
|
|
132
|
+
override?: ((oI: _shared_js.OverridableFunctions<{}>) => _shared_js.OverridableFunctions<{}>) | undefined;
|
|
133
|
+
}) => supertokens_node.SuperTokensPlugin;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export { HANDLE_BASE_PATH, type IRowndClient, type MigrationResponse, PLUGIN_ID, PLUGIN_SDK_VERSION, PUBLIC_TENANT_ID, ROWND_PLUGIN_ERROR_MESSAGES, type RowndPluginConfig, RowndPluginError, type RowndPluginErrorType, type RowndPluginNormalisedConfig, type RowndTelemetryClient, type RowndTelemetryConfig, type RowndTelemetryEvent, type RowndUser, type SuperTokensUserImport, _default as default, init };
|