@celljs/ta-host 4.13.1 → 4.14.0
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/README.en.md +1 -0
- package/README.md +1 -0
- package/esm/node/host-protocol.d.ts +17 -1
- package/esm/node/host-protocol.js +1 -0
- package/esm/node/index.d.ts +2 -0
- package/esm/node/index.js +2 -0
- package/esm/node/package-hosts.d.ts +2 -1
- package/esm/node/package-hosts.js +6 -2
- package/esm/node/presence-book.d.ts +38 -0
- package/esm/node/presence-book.js +159 -0
- package/esm/node/presence-server-impl.d.ts +13 -0
- package/esm/node/presence-server-impl.js +45 -0
- package/esm/node/rooms-bridge.d.ts +6 -1
- package/esm/node/rooms-bridge.js +21 -3
- package/esm/node/session-list-feed.js +2 -1
- package/esm/node/sign-in/access-server-impl.d.ts +5 -1
- package/esm/node/sign-in/access-server-impl.js +22 -1
- package/esm/node/sign-in/sign-in-flow.d.ts +14 -1
- package/esm/node/sign-in/sign-in-flow.js +24 -7
- package/esm/node/sign-in/sign-in-provider.d.ts +40 -1
- package/esm/node/sign-in/sign-in-provider.js +120 -0
- package/esm/node/sign-in/ta-sign-in.d.ts +9 -3
- package/esm/node/sign-in/ta-sign-in.js +32 -4
- package/esm/node/ta-server-impl.d.ts +7 -0
- package/esm/node/ta-server-impl.js +44 -7
- package/esm/node/ta-session-registry.d.ts +10 -3
- package/esm/node/ta-session-registry.js +29 -3
- package/esm/node/ta-session.d.ts +2 -0
- package/esm/node/ta-session.js +6 -0
- package/esm/node/team/host-team.d.ts +2 -1
- package/esm/node/team/host-team.js +10 -1
- package/esm/node/team/index.d.ts +1 -0
- package/esm/node/team/index.js +1 -0
- package/esm/node/team/member-accounts.d.ts +13 -0
- package/esm/node/team/member-accounts.js +37 -0
- package/esm/node/team/team-calls.d.ts +2 -1
- package/esm/node/team/team-calls.js +7 -0
- package/esm/node/team/team-gate.js +1 -1
- package/esm/node/team/team-protocol.d.ts +5 -1
- package/esm/node/team/team-protocol.js +2 -0
- package/lib/node/host-protocol.d.ts +17 -1
- package/lib/node/host-protocol.js +2 -1
- package/lib/node/index.d.ts +2 -0
- package/lib/node/index.js +2 -0
- package/lib/node/package-hosts.d.ts +2 -1
- package/lib/node/package-hosts.js +5 -1
- package/lib/node/presence-book.d.ts +39 -0
- package/lib/node/presence-book.js +162 -0
- package/lib/node/presence-server-impl.d.ts +14 -0
- package/lib/node/presence-server-impl.js +48 -0
- package/lib/node/rooms-bridge.d.ts +6 -1
- package/lib/node/rooms-bridge.js +20 -2
- package/lib/node/session-list-feed.js +2 -1
- package/lib/node/sign-in/access-server-impl.d.ts +5 -1
- package/lib/node/sign-in/access-server-impl.js +21 -0
- package/lib/node/sign-in/sign-in-flow.d.ts +14 -1
- package/lib/node/sign-in/sign-in-flow.js +24 -7
- package/lib/node/sign-in/sign-in-provider.d.ts +40 -1
- package/lib/node/sign-in/sign-in-provider.js +120 -0
- package/lib/node/sign-in/ta-sign-in.d.ts +9 -3
- package/lib/node/sign-in/ta-sign-in.js +32 -4
- package/lib/node/ta-server-impl.d.ts +7 -0
- package/lib/node/ta-server-impl.js +43 -6
- package/lib/node/ta-session-registry.d.ts +10 -3
- package/lib/node/ta-session-registry.js +27 -1
- package/lib/node/ta-session.d.ts +2 -0
- package/lib/node/ta-session.js +6 -0
- package/lib/node/team/host-team.d.ts +2 -1
- package/lib/node/team/host-team.js +9 -0
- package/lib/node/team/index.d.ts +1 -0
- package/lib/node/team/index.js +1 -0
- package/lib/node/team/member-accounts.d.ts +14 -0
- package/lib/node/team/member-accounts.js +40 -0
- package/lib/node/team/team-calls.d.ts +2 -1
- package/lib/node/team/team-calls.js +7 -0
- package/lib/node/team/team-gate.js +1 -1
- package/lib/node/team/team-protocol.d.ts +5 -1
- package/lib/node/team/team-protocol.js +3 -1
- package/package.json +12 -12
|
@@ -14,6 +14,8 @@ const core_1 = require("@celljs/core");
|
|
|
14
14
|
const rpc_1 = require("@celljs/rpc");
|
|
15
15
|
const node_1 = require("@celljs/rpc/lib/node");
|
|
16
16
|
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
17
|
+
const relay_team_1 = require("@celljs/ta-relay/lib/common/relay-team");
|
|
18
|
+
const relay_bridge_1 = require("../relay-bridge");
|
|
17
19
|
const ta_access_1 = require("../ta-access");
|
|
18
20
|
const ta_errors_1 = require("../ta-errors");
|
|
19
21
|
const access_store_1 = require("./access-store");
|
|
@@ -21,6 +23,21 @@ const ta_sign_in_1 = require("./ta-sign-in");
|
|
|
21
23
|
const ACCOUNT = /^[a-z][a-z0-9-]*:\S+$/;
|
|
22
24
|
/** Who may sign in with an account, for anyone in; a browser that loses its sign-in is cut off at once. */
|
|
23
25
|
let TaAccessServerImpl = class TaAccessServerImpl {
|
|
26
|
+
async getSignInConfig() {
|
|
27
|
+
const join = `${this.relay.relayFor('devices').replace(/\/+$/, '')}${relay_team_1.RELAY_JOIN_PATH}`;
|
|
28
|
+
const serve = this.signIn.publicUrl ? `${this.signIn.publicUrl}${ta_protocol_1.TA_SIGN_IN_PATH}/<provider>/callback` : undefined;
|
|
29
|
+
return { providers: this.signIn.setups(), callbacks: { join, ...(serve ? { serve } : {}) } };
|
|
30
|
+
}
|
|
31
|
+
setSignInProvider(id, fields) {
|
|
32
|
+
return ta_errors_1.TaErrors.guard(async () => {
|
|
33
|
+
try {
|
|
34
|
+
this.signIn.setProvider(id, fields && typeof fields === 'object' ? fields : null);
|
|
35
|
+
}
|
|
36
|
+
catch (failure) {
|
|
37
|
+
throw ta_errors_1.TaErrors.invalidArgument(failure instanceof Error ? failure.message : String(failure), 'Give the id and the secret the provider gave.');
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
24
41
|
async getAccess() {
|
|
25
42
|
var _a;
|
|
26
43
|
const providers = this.signIn.providers.map(({ id, name }) => ({ id, name }));
|
|
@@ -79,6 +96,10 @@ __decorate([
|
|
|
79
96
|
(0, core_1.Autowired)(node_1.RpcConnectionManager),
|
|
80
97
|
__metadata("design:type", Object)
|
|
81
98
|
], TaAccessServerImpl.prototype, "connections", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, core_1.Autowired)({ id: relay_bridge_1.RELAY_BRIDGE, detached: true }),
|
|
101
|
+
__metadata("design:type", Function)
|
|
102
|
+
], TaAccessServerImpl.prototype, "relay", void 0);
|
|
82
103
|
exports.TaAccessServerImpl = TaAccessServerImpl = __decorate([
|
|
83
104
|
(0, rpc_1.Rpc)(ta_protocol_1.TaAccessServer)
|
|
84
105
|
], TaAccessServerImpl);
|
|
@@ -9,6 +9,8 @@ interface Pending {
|
|
|
9
9
|
redirectUri: string;
|
|
10
10
|
/** Lets the account in: started by someone already in. */
|
|
11
11
|
bind: boolean;
|
|
12
|
+
/** Only says who signed in (TaHostAccounts.verify): lets no one into ta serve. */
|
|
13
|
+
verify?: true;
|
|
12
14
|
at: number;
|
|
13
15
|
}
|
|
14
16
|
export type SignInResult = {
|
|
@@ -36,7 +38,7 @@ export declare namespace SignInUtil {
|
|
|
36
38
|
* gateway (`ta gateway`) use it alike.
|
|
37
39
|
*/
|
|
38
40
|
export declare class SignInFlow {
|
|
39
|
-
|
|
41
|
+
providers: SignInProvider[];
|
|
40
42
|
readonly store: AccessStore;
|
|
41
43
|
readonly publicUrl?: string | undefined;
|
|
42
44
|
constructor(providers: SignInProvider[], store: AccessStore, publicUrl?: string | undefined);
|
|
@@ -53,6 +55,17 @@ export declare class SignInFlow {
|
|
|
53
55
|
url: string;
|
|
54
56
|
state: string;
|
|
55
57
|
}>;
|
|
58
|
+
/** A sign-in that only says who it is ({@link verify}), coming back to `redirectUri`: the page of a relay, say. */
|
|
59
|
+
startVerify(providerId: string, redirectUri: string, now?: number): Promise<{
|
|
60
|
+
url: string;
|
|
61
|
+
state: string;
|
|
62
|
+
}>;
|
|
63
|
+
/** The account of a sign-in of {@link startVerify}: no token, nothing let in. */
|
|
64
|
+
verify(state: string, code: string, now?: number): Promise<SignInAccount>;
|
|
65
|
+
protected begin(providerId: string, redirectUri: string, kind: Pick<Pending, 'bind' | 'verify'>, now: number): Promise<{
|
|
66
|
+
url: string;
|
|
67
|
+
state: string;
|
|
68
|
+
}>;
|
|
56
69
|
/** The browser came back from the provider with a code: in with a token of its own, or told to wait. */
|
|
57
70
|
finish(providerId: string, state: string, code: string, device?: string, now?: number): Promise<SignInResult>;
|
|
58
71
|
protected prune(now: number): void;
|
|
@@ -60,15 +60,33 @@ class SignInFlow {
|
|
|
60
60
|
}
|
|
61
61
|
/** Where the browser goes, and the state that comes back with it. */
|
|
62
62
|
async start(providerId, origin, bind, now = Date.now()) {
|
|
63
|
-
const provider = this.provider(providerId);
|
|
64
|
-
if (!provider) {
|
|
65
|
-
throw new sign_in_provider_1.SignInError(`No provider ${providerId}`);
|
|
66
|
-
}
|
|
67
63
|
this.prune(now);
|
|
68
64
|
const binding = bind ? this.binds.get(bind) : undefined;
|
|
69
65
|
if (bind) {
|
|
70
66
|
this.binds.delete(bind);
|
|
71
67
|
}
|
|
68
|
+
return this.begin(providerId, SignInUtil.redirectUri(origin, providerId), { bind: (binding === null || binding === void 0 ? void 0 : binding.provider) === providerId }, now);
|
|
69
|
+
}
|
|
70
|
+
/** A sign-in that only says who it is ({@link verify}), coming back to `redirectUri`: the page of a relay, say. */
|
|
71
|
+
startVerify(providerId, redirectUri, now = Date.now()) {
|
|
72
|
+
this.prune(now);
|
|
73
|
+
return this.begin(providerId, redirectUri, { bind: false, verify: true }, now);
|
|
74
|
+
}
|
|
75
|
+
/** The account of a sign-in of {@link startVerify}: no token, nothing let in. */
|
|
76
|
+
async verify(state, code, now = Date.now()) {
|
|
77
|
+
const pending = this.pending.get(state);
|
|
78
|
+
this.pending.delete(state);
|
|
79
|
+
const provider = pending && this.provider(pending.provider);
|
|
80
|
+
if (!(pending === null || pending === void 0 ? void 0 : pending.verify) || !provider || now - pending.at > PENDING_TTL_MS) {
|
|
81
|
+
throw new sign_in_provider_1.SignInError('The sign-in expired or was not started here');
|
|
82
|
+
}
|
|
83
|
+
return provider.account({ code, redirectUri: pending.redirectUri, verifier: pending.verifier });
|
|
84
|
+
}
|
|
85
|
+
async begin(providerId, redirectUri, kind, now) {
|
|
86
|
+
const provider = this.provider(providerId);
|
|
87
|
+
if (!provider) {
|
|
88
|
+
throw new sign_in_provider_1.SignInError(`No provider ${providerId}`);
|
|
89
|
+
}
|
|
72
90
|
// The oldest goes first: a flood of starts takes no more memory, and costs only sign-ins as old.
|
|
73
91
|
for (const oldest of this.pending.keys()) {
|
|
74
92
|
if (this.pending.size < exports.MAX_PENDING_SIGN_INS) {
|
|
@@ -78,8 +96,7 @@ class SignInFlow {
|
|
|
78
96
|
}
|
|
79
97
|
const state = (0, node_crypto_1.randomBytes)(18).toString('base64url');
|
|
80
98
|
const { verifier, challenge } = SignInUtil.pkce();
|
|
81
|
-
|
|
82
|
-
this.pending.set(state, { provider: provider.id, verifier, redirectUri, bind: (binding === null || binding === void 0 ? void 0 : binding.provider) === provider.id, at: now });
|
|
99
|
+
this.pending.set(state, { provider: provider.id, verifier, redirectUri, ...kind, at: now });
|
|
83
100
|
return { url: await provider.authorizeUrl({ redirectUri, state, challenge }), state };
|
|
84
101
|
}
|
|
85
102
|
/** The browser came back from the provider with a code: in with a token of its own, or told to wait. */
|
|
@@ -87,7 +104,7 @@ class SignInFlow {
|
|
|
87
104
|
const pending = this.pending.get(state);
|
|
88
105
|
this.pending.delete(state);
|
|
89
106
|
const provider = this.provider(providerId);
|
|
90
|
-
if (!pending || !provider || pending.provider !== providerId || now - pending.at > PENDING_TTL_MS) {
|
|
107
|
+
if (!pending || pending.verify || !provider || pending.provider !== providerId || now - pending.at > PENDING_TTL_MS) {
|
|
91
108
|
throw new sign_in_provider_1.SignInError('The sign-in expired or was not started here');
|
|
92
109
|
}
|
|
93
110
|
const account = await provider.account({ code, redirectUri: pending.redirectUri, verifier: pending.verifier });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TaSignInProvider } from '@celljs/ta-protocol';
|
|
1
|
+
import type { TaSignInKind, TaSignInProvider, TaSignInSetup } from '@celljs/ta-protocol';
|
|
2
2
|
/** Who signed in, as the provider says: `id` is the account as TA_ALLOWED_USERS names it (`github:<login>`). */
|
|
3
3
|
export interface SignInAccount {
|
|
4
4
|
id: string;
|
|
@@ -126,6 +126,45 @@ export declare class WeChatSignIn implements SignInProvider {
|
|
|
126
126
|
export declare namespace SignInProviders {
|
|
127
127
|
/** TA_PUBLIC_URL without its trailing `/`. */
|
|
128
128
|
function publicUrl(env: Record<string, string | undefined>): string | undefined;
|
|
129
|
+
/** Each kind of provider: its name, its fields in sign-in.json with the variable of the environment of each, and its secret's. */
|
|
130
|
+
const KINDS: readonly {
|
|
131
|
+
id: TaSignInKind;
|
|
132
|
+
name: string;
|
|
133
|
+
fields: Record<string, string>;
|
|
134
|
+
required: string[];
|
|
135
|
+
secret: [string, string];
|
|
136
|
+
}[];
|
|
137
|
+
/** How each kind is set up, by the environment first, then sign-in.json; no secret in it. */
|
|
138
|
+
function setups(env: Record<string, string | undefined>, config: Config | undefined): TaSignInSetup[];
|
|
139
|
+
/**
|
|
140
|
+
* sign-in.json with a kind set up anew (`null`: taken out): the fields given, trimmed; an empty secret keeps the
|
|
141
|
+
* one kept. Throws for a kind it does not know, or one without what it needs.
|
|
142
|
+
*/
|
|
143
|
+
function withProvider(config: Config | undefined, id: string, input: Record<string, unknown> | null): Config;
|
|
144
|
+
/** sign-in.json of the agent directory: the same providers as the environment, for a Ta not started from a shell. */
|
|
145
|
+
interface Config {
|
|
146
|
+
github?: {
|
|
147
|
+
clientId?: string;
|
|
148
|
+
clientSecret?: string;
|
|
149
|
+
url?: string;
|
|
150
|
+
};
|
|
151
|
+
google?: {
|
|
152
|
+
clientId?: string;
|
|
153
|
+
clientSecret?: string;
|
|
154
|
+
};
|
|
155
|
+
wechat?: {
|
|
156
|
+
appId?: string;
|
|
157
|
+
appSecret?: string;
|
|
158
|
+
};
|
|
159
|
+
oidc?: {
|
|
160
|
+
issuer?: string;
|
|
161
|
+
clientId?: string;
|
|
162
|
+
clientSecret?: string;
|
|
163
|
+
name?: string;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/** The environment's variables that sign-in.json stands for: what the environment sets wins. */
|
|
167
|
+
function withConfig(env: Record<string, string | undefined>, config: Config | undefined): Record<string, string | undefined>;
|
|
129
168
|
/**
|
|
130
169
|
* The providers the operator configured in the environment of ta serve: a provider is offered when it
|
|
131
170
|
* has its id and its secret.
|
|
@@ -202,6 +202,126 @@ var SignInProviders;
|
|
|
202
202
|
return ((_a = env.TA_PUBLIC_URL) === null || _a === void 0 ? void 0 : _a.trim().replace(/\/+$/, '')) || undefined;
|
|
203
203
|
}
|
|
204
204
|
SignInProviders.publicUrl = publicUrl;
|
|
205
|
+
/** Each kind of provider: its name, its fields in sign-in.json with the variable of the environment of each, and its secret's. */
|
|
206
|
+
SignInProviders.KINDS = [
|
|
207
|
+
{
|
|
208
|
+
id: 'github',
|
|
209
|
+
name: 'GitHub',
|
|
210
|
+
fields: { clientId: 'TA_GITHUB_CLIENT_ID', url: 'TA_GITHUB_URL' },
|
|
211
|
+
required: ['clientId'],
|
|
212
|
+
secret: ['clientSecret', 'TA_GITHUB_CLIENT_SECRET'],
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
id: 'google',
|
|
216
|
+
name: 'Google',
|
|
217
|
+
fields: { clientId: 'TA_GOOGLE_CLIENT_ID' },
|
|
218
|
+
required: ['clientId'],
|
|
219
|
+
secret: ['clientSecret', 'TA_GOOGLE_CLIENT_SECRET'],
|
|
220
|
+
},
|
|
221
|
+
{ id: 'wechat', name: 'WeChat', fields: { appId: 'TA_WECHAT_APP_ID' }, required: ['appId'], secret: ['appSecret', 'TA_WECHAT_APP_SECRET'] },
|
|
222
|
+
{
|
|
223
|
+
id: 'oidc',
|
|
224
|
+
name: 'SSO',
|
|
225
|
+
fields: { issuer: 'TA_OIDC_ISSUER', clientId: 'TA_OIDC_CLIENT_ID', name: 'TA_OIDC_NAME' },
|
|
226
|
+
required: ['issuer', 'clientId'],
|
|
227
|
+
secret: ['clientSecret', 'TA_OIDC_CLIENT_SECRET'],
|
|
228
|
+
},
|
|
229
|
+
];
|
|
230
|
+
/** How each kind is set up, by the environment first, then sign-in.json; no secret in it. */
|
|
231
|
+
function setups(env, config) {
|
|
232
|
+
return SignInProviders.KINDS.map(kind => {
|
|
233
|
+
var _a;
|
|
234
|
+
const file = ((_a = config === null || config === void 0 ? void 0 : config[kind.id]) !== null && _a !== void 0 ? _a : {});
|
|
235
|
+
const fromEnv = !!env[kind.secret[1]] || Object.values(kind.fields).some(key => !!env[key]);
|
|
236
|
+
const value = (field) => (fromEnv ? env[kind.fields[field]] : typeof file[field] === 'string' ? file[field] : undefined);
|
|
237
|
+
const fields = {};
|
|
238
|
+
for (const field of Object.keys(kind.fields)) {
|
|
239
|
+
const one = value(field);
|
|
240
|
+
if (one) {
|
|
241
|
+
fields[field] = one;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
const secret = fromEnv ? !!env[kind.secret[1]] : typeof file[kind.secret[0]] === 'string' && !!file[kind.secret[0]];
|
|
245
|
+
const configured = secret && kind.required.every(field => !!fields[field]);
|
|
246
|
+
const any = fromEnv || Object.keys(fields).length > 0 || secret;
|
|
247
|
+
return {
|
|
248
|
+
id: kind.id,
|
|
249
|
+
name: kind.id === 'oidc' && fields.name ? fields.name : kind.name,
|
|
250
|
+
configured,
|
|
251
|
+
...(any ? { source: fromEnv ? 'env' : 'file' } : {}),
|
|
252
|
+
fields,
|
|
253
|
+
secret,
|
|
254
|
+
};
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
SignInProviders.setups = setups;
|
|
258
|
+
/**
|
|
259
|
+
* sign-in.json with a kind set up anew (`null`: taken out): the fields given, trimmed; an empty secret keeps the
|
|
260
|
+
* one kept. Throws for a kind it does not know, or one without what it needs.
|
|
261
|
+
*/
|
|
262
|
+
function withProvider(config, id, input) {
|
|
263
|
+
var _a;
|
|
264
|
+
const kind = SignInProviders.KINDS.find(one => one.id === id);
|
|
265
|
+
if (!kind) {
|
|
266
|
+
throw new SignInError(`No such way to sign in: ${id}`);
|
|
267
|
+
}
|
|
268
|
+
const next = { ...(config !== null && config !== void 0 ? config : {}) };
|
|
269
|
+
if (!input) {
|
|
270
|
+
delete next[kind.id];
|
|
271
|
+
return next;
|
|
272
|
+
}
|
|
273
|
+
const kept = ((_a = next[kind.id]) !== null && _a !== void 0 ? _a : {});
|
|
274
|
+
const one = {};
|
|
275
|
+
for (const field of Object.keys(kind.fields)) {
|
|
276
|
+
const value = typeof input[field] === 'string' ? input[field].trim().slice(0, 500) : '';
|
|
277
|
+
if (value) {
|
|
278
|
+
one[field] = value;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
const secret = typeof input[kind.secret[0]] === 'string' ? input[kind.secret[0]].trim().slice(0, 500) : '';
|
|
282
|
+
const keptSecret = typeof kept[kind.secret[0]] === 'string' ? kept[kind.secret[0]] : '';
|
|
283
|
+
if (secret || keptSecret) {
|
|
284
|
+
one[kind.secret[0]] = secret || keptSecret;
|
|
285
|
+
}
|
|
286
|
+
const missing = [...kind.required, kind.secret[0]].filter(field => !one[field]);
|
|
287
|
+
if (missing.length) {
|
|
288
|
+
throw new SignInError(`${kind.name} needs ${missing.join(', ')}`);
|
|
289
|
+
}
|
|
290
|
+
if (one.issuer && !/^https:\/\//.test(one.issuer) && !/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?(\/|$)/.test(one.issuer)) {
|
|
291
|
+
throw new SignInError('The issuer is an https address.');
|
|
292
|
+
}
|
|
293
|
+
if (one.url && !/^https?:\/\//.test(one.url)) {
|
|
294
|
+
throw new SignInError('The address of GitHub Enterprise is an http(s) address.');
|
|
295
|
+
}
|
|
296
|
+
next[kind.id] = one;
|
|
297
|
+
return next;
|
|
298
|
+
}
|
|
299
|
+
SignInProviders.withProvider = withProvider;
|
|
300
|
+
/** The environment's variables that sign-in.json stands for: what the environment sets wins. */
|
|
301
|
+
function withConfig(env, config) {
|
|
302
|
+
const { github, google, wechat, oidc } = config !== null && config !== void 0 ? config : {};
|
|
303
|
+
const file = {
|
|
304
|
+
TA_GITHUB_CLIENT_ID: github === null || github === void 0 ? void 0 : github.clientId,
|
|
305
|
+
TA_GITHUB_CLIENT_SECRET: github === null || github === void 0 ? void 0 : github.clientSecret,
|
|
306
|
+
TA_GITHUB_URL: github === null || github === void 0 ? void 0 : github.url,
|
|
307
|
+
TA_GOOGLE_CLIENT_ID: google === null || google === void 0 ? void 0 : google.clientId,
|
|
308
|
+
TA_GOOGLE_CLIENT_SECRET: google === null || google === void 0 ? void 0 : google.clientSecret,
|
|
309
|
+
TA_WECHAT_APP_ID: wechat === null || wechat === void 0 ? void 0 : wechat.appId,
|
|
310
|
+
TA_WECHAT_APP_SECRET: wechat === null || wechat === void 0 ? void 0 : wechat.appSecret,
|
|
311
|
+
TA_OIDC_ISSUER: oidc === null || oidc === void 0 ? void 0 : oidc.issuer,
|
|
312
|
+
TA_OIDC_CLIENT_ID: oidc === null || oidc === void 0 ? void 0 : oidc.clientId,
|
|
313
|
+
TA_OIDC_CLIENT_SECRET: oidc === null || oidc === void 0 ? void 0 : oidc.clientSecret,
|
|
314
|
+
TA_OIDC_NAME: oidc === null || oidc === void 0 ? void 0 : oidc.name,
|
|
315
|
+
};
|
|
316
|
+
const merged = { ...env };
|
|
317
|
+
for (const [key, value] of Object.entries(file)) {
|
|
318
|
+
if (typeof value === 'string' && value && !env[key]) {
|
|
319
|
+
merged[key] = value;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return merged;
|
|
323
|
+
}
|
|
324
|
+
SignInProviders.withConfig = withConfig;
|
|
205
325
|
/**
|
|
206
326
|
* The providers the operator configured in the environment of ta serve: a provider is offered when it
|
|
207
327
|
* has its id and its secret.
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import type { TaSignInKind, TaSignInSetup } from '@celljs/ta-protocol';
|
|
1
2
|
import { SignInFlow } from './sign-in-flow';
|
|
2
3
|
export declare const TA_SIGN_IN: unique symbol;
|
|
3
4
|
/**
|
|
4
|
-
* Signing in to ta serve with an account, besides its token. The providers come from the environment
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Signing in to ta serve with an account, besides its token. The providers come from the environment, then
|
|
6
|
+
* sign-in.json of the agent directory (SignInProviders.withConfig), which Settings, Access writes (setProvider) and
|
|
7
|
+
* which is read again then; who may sign in from TA_ALLOWED_USERS and the accounts added in the web client
|
|
8
|
+
* (AccessStore). Someone else who signs in is told to wait, and shows up as a request. Those asking to come in by a
|
|
9
|
+
* link sign in with the same providers to say who they are (TaHostAccounts), which lets them into nothing.
|
|
7
10
|
*/
|
|
8
11
|
export declare class TaSignIn extends SignInFlow {
|
|
9
12
|
constructor();
|
|
13
|
+
setups(): TaSignInSetup[];
|
|
14
|
+
/** Sets a kind up in sign-in.json (readable by the user alone), offered at once; not one the environment sets. */
|
|
15
|
+
setProvider(id: TaSignInKind, fields: Record<string, unknown> | null): void;
|
|
10
16
|
}
|
|
11
17
|
//# sourceMappingURL=ta-sign-in.d.ts.map
|
|
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.TaSignIn = exports.TA_SIGN_IN = void 0;
|
|
13
|
+
const node_fs_1 = require("node:fs");
|
|
13
14
|
const node_path_1 = require("node:path");
|
|
14
15
|
const core_1 = require("@celljs/core");
|
|
15
16
|
const ta_brand_1 = require("@celljs/ta-harness/lib/node/ta-brand");
|
|
@@ -17,14 +18,41 @@ const access_store_1 = require("./access-store");
|
|
|
17
18
|
const sign_in_flow_1 = require("./sign-in-flow");
|
|
18
19
|
const sign_in_provider_1 = require("./sign-in-provider");
|
|
19
20
|
exports.TA_SIGN_IN = Symbol('TaSignIn');
|
|
21
|
+
function file() {
|
|
22
|
+
return (0, node_path_1.join)(ta_brand_1.TaBrand.agentDir(), 'sign-in.json');
|
|
23
|
+
}
|
|
24
|
+
/** sign-in.json of the agent directory (SignInProviders.Config); none when it is not there or not JSON. */
|
|
25
|
+
function config() {
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse((0, node_fs_1.readFileSync)(file(), 'utf8'));
|
|
28
|
+
}
|
|
29
|
+
catch (_a) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
20
33
|
/**
|
|
21
|
-
* Signing in to ta serve with an account, besides its token. The providers come from the environment
|
|
22
|
-
*
|
|
23
|
-
*
|
|
34
|
+
* Signing in to ta serve with an account, besides its token. The providers come from the environment, then
|
|
35
|
+
* sign-in.json of the agent directory (SignInProviders.withConfig), which Settings, Access writes (setProvider) and
|
|
36
|
+
* which is read again then; who may sign in from TA_ALLOWED_USERS and the accounts added in the web client
|
|
37
|
+
* (AccessStore). Someone else who signs in is told to wait, and shows up as a request. Those asking to come in by a
|
|
38
|
+
* link sign in with the same providers to say who they are (TaHostAccounts), which lets them into nothing.
|
|
24
39
|
*/
|
|
25
40
|
let TaSignIn = class TaSignIn extends sign_in_flow_1.SignInFlow {
|
|
26
41
|
constructor() {
|
|
27
|
-
super(sign_in_provider_1.SignInProviders.fromEnv(process.env), new access_store_1.AccessStore((0, node_path_1.join)(ta_brand_1.TaBrand.agentDir(), 'access.json'), access_store_1.AccessUtil.parseList(process.env.TA_ALLOWED_USERS)), sign_in_provider_1.SignInProviders.publicUrl(process.env));
|
|
42
|
+
super(sign_in_provider_1.SignInProviders.fromEnv(sign_in_provider_1.SignInProviders.withConfig(process.env, config())), new access_store_1.AccessStore((0, node_path_1.join)(ta_brand_1.TaBrand.agentDir(), 'access.json'), access_store_1.AccessUtil.parseList(process.env.TA_ALLOWED_USERS)), sign_in_provider_1.SignInProviders.publicUrl(process.env));
|
|
43
|
+
}
|
|
44
|
+
setups() {
|
|
45
|
+
return sign_in_provider_1.SignInProviders.setups(process.env, config());
|
|
46
|
+
}
|
|
47
|
+
/** Sets a kind up in sign-in.json (readable by the user alone), offered at once; not one the environment sets. */
|
|
48
|
+
setProvider(id, fields) {
|
|
49
|
+
var _a;
|
|
50
|
+
if (((_a = this.setups().find(one => one.id === id)) === null || _a === void 0 ? void 0 : _a.source) === 'env') {
|
|
51
|
+
throw new Error(`${id} is set up by the environment of ta serve, not here.`);
|
|
52
|
+
}
|
|
53
|
+
const next = sign_in_provider_1.SignInProviders.withProvider(config(), id, fields);
|
|
54
|
+
(0, node_fs_1.writeFileSync)(file(), `${JSON.stringify(next, null, 2)}\n`, { mode: 0o600 });
|
|
55
|
+
this.providers = sign_in_provider_1.SignInProviders.fromEnv(sign_in_provider_1.SignInProviders.withConfig(process.env, next));
|
|
28
56
|
}
|
|
29
57
|
};
|
|
30
58
|
exports.TaSignIn = TaSignIn;
|
|
@@ -38,6 +38,13 @@ export declare class TaServerImpl implements TaServer {
|
|
|
38
38
|
prompt(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
39
39
|
steer(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
40
40
|
followUp(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
41
|
+
/**
|
|
42
|
+
* A message as written by who sends it (TaMessageAuthor): the line of one let in, never one a page wrote. The
|
|
43
|
+
* owner's has none, as before anyone was let in.
|
|
44
|
+
*/
|
|
45
|
+
protected signed(input: TaPromptInput): TaPromptInput;
|
|
46
|
+
/** Whether the principal of this call may take back a waiting message: the owner any, another only their own. */
|
|
47
|
+
protected mayTakeBack(text: string): boolean;
|
|
41
48
|
/** Logs how long the run took to end here: with the times the box keeps (stop.times of @celljs/ta-web), where a slow stop went. */
|
|
42
49
|
abort(sessionId: string): Promise<void>;
|
|
43
50
|
clearQueue(sessionId: string): Promise<TaCommandResult<'clear_queue'>>;
|
|
@@ -70,7 +70,7 @@ let TaServerImpl = class TaServerImpl {
|
|
|
70
70
|
return this.guard(() => this.sessions.close(sessionId));
|
|
71
71
|
}
|
|
72
72
|
async listSessions() {
|
|
73
|
-
return this.
|
|
73
|
+
return this.sessions.infos(node_1.RpcContext.connection());
|
|
74
74
|
}
|
|
75
75
|
async watchSessions() {
|
|
76
76
|
return this.sessions.watch(node_1.RpcContext.requireConnection());
|
|
@@ -115,16 +115,35 @@ let TaServerImpl = class TaServerImpl {
|
|
|
115
115
|
prompt(sessionId, input) {
|
|
116
116
|
return this.on(sessionId, session => {
|
|
117
117
|
this.runs.prompted(sessionId);
|
|
118
|
-
return session.prompt(input);
|
|
118
|
+
return session.prompt(this.signed(input));
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
steer(sessionId, input) {
|
|
122
122
|
this.runs.prompted(sessionId);
|
|
123
|
-
return this.on(sessionId, session => session.steer(input));
|
|
123
|
+
return this.on(sessionId, session => session.steer(this.signed(input)));
|
|
124
124
|
}
|
|
125
125
|
followUp(sessionId, input) {
|
|
126
126
|
this.runs.prompted(sessionId);
|
|
127
|
-
return this.on(sessionId, session => session.followUp(input));
|
|
127
|
+
return this.on(sessionId, session => session.followUp(this.signed(input)));
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A message as written by who sends it (TaMessageAuthor): the line of one let in, never one a page wrote. The
|
|
131
|
+
* owner's has none, as before anyone was let in.
|
|
132
|
+
*/
|
|
133
|
+
signed(input) {
|
|
134
|
+
if (typeof (input === null || input === void 0 ? void 0 : input.message) !== 'string') {
|
|
135
|
+
return input;
|
|
136
|
+
}
|
|
137
|
+
const principal = this.principals.current();
|
|
138
|
+
const member = principal === ta_protocol_1.TA_OWNER ? undefined : this.authority.describe(principal);
|
|
139
|
+
const message = member ? ta_protocol_1.TaMessageAuthor.mark(input.message, principal, member.name) : ta_protocol_1.TaMessageAuthor.strip(input.message);
|
|
140
|
+
return message === input.message ? input : { ...input, message };
|
|
141
|
+
}
|
|
142
|
+
/** Whether the principal of this call may take back a waiting message: the owner any, another only their own. */
|
|
143
|
+
mayTakeBack(text) {
|
|
144
|
+
var _a;
|
|
145
|
+
const principal = this.principals.current();
|
|
146
|
+
return principal === ta_protocol_1.TA_OWNER || ((_a = ta_protocol_1.TaMessageAuthor.of(text)) === null || _a === void 0 ? void 0 : _a.id) === principal;
|
|
128
147
|
}
|
|
129
148
|
/** Logs how long the run took to end here: with the times the box keeps (stop.times of @celljs/ta-web), where a slow stop went. */
|
|
130
149
|
async abort(sessionId) {
|
|
@@ -133,10 +152,28 @@ let TaServerImpl = class TaServerImpl {
|
|
|
133
152
|
console.log(`[${new Date().toISOString()}] ta serve: stopped ${sessionId.slice(0, 8)} in ${Date.now() - start} ms`);
|
|
134
153
|
}
|
|
135
154
|
clearQueue(sessionId) {
|
|
136
|
-
return this.on(sessionId,
|
|
155
|
+
return this.on(sessionId, session => {
|
|
156
|
+
if (this.principals.current() === ta_protocol_1.TA_OWNER) {
|
|
157
|
+
return session.pi.clearQueue();
|
|
158
|
+
}
|
|
159
|
+
// One let in takes back their own, the others' stay.
|
|
160
|
+
const taken = { steering: [], followUp: [] };
|
|
161
|
+
for (const kind of ['steering', 'followUp']) {
|
|
162
|
+
const texts = session.queued(kind);
|
|
163
|
+
for (let index = texts.length - 1; index >= 0; index--) {
|
|
164
|
+
if (this.mayTakeBack(texts[index]) && session.removeQueued(kind, index)) {
|
|
165
|
+
taken[kind].unshift(texts[index]);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return taken;
|
|
170
|
+
});
|
|
137
171
|
}
|
|
138
172
|
removeQueued(sessionId, kind, index) {
|
|
139
|
-
return this.on(sessionId, session =>
|
|
173
|
+
return this.on(sessionId, session => {
|
|
174
|
+
const text = session.queued(kind)[index];
|
|
175
|
+
return text !== undefined && this.mayTakeBack(text) && session.removeQueued(kind, index);
|
|
176
|
+
});
|
|
140
177
|
}
|
|
141
178
|
newSession(sessionId, parentSession) {
|
|
142
179
|
return this.authored(sessionId, ({ runtime }) => runtime.newSession(parentSession ? { parentSession } : undefined));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { RpcConnection } from '@celljs/rpc/lib/node';
|
|
2
|
-
import type
|
|
2
|
+
import { type TaEvent, type TaOpenSessionOptions, type TaSessionInfo } from '@celljs/ta-protocol';
|
|
3
3
|
import { ClientChannel } from './client-channel';
|
|
4
|
-
import { type TaHostOptions, TaSessionFactory, TaSessionRegistry } from './host-protocol';
|
|
4
|
+
import { type TaHostOptions, TaPresenceBook, TaSessionFactory, TaSessionRegistry } from './host-protocol';
|
|
5
5
|
import { TaSessionHandles } from './session-handles';
|
|
6
6
|
import { SessionListFeed } from './session-list-feed';
|
|
7
7
|
import type { TaSession } from './ta-session';
|
|
8
|
-
import { TaVisibility } from './team/team-protocol';
|
|
8
|
+
import { TaPrincipals, TaVisibility } from './team/team-protocol';
|
|
9
9
|
/**
|
|
10
10
|
* The open sessions. A session's id outlives its memory: closed while idle or by a restart, it opens again
|
|
11
11
|
* from its file under the same id at the next call (TaSessionHandles), so clients never see it go.
|
|
@@ -25,6 +25,10 @@ export declare class DefaultTaSessionRegistry implements TaSessionRegistry {
|
|
|
25
25
|
protected readonly waking: Map<string, Promise<TaSession>>;
|
|
26
26
|
/** What each connection may see of the list (docs/design/ta-team.md): all of it for the owner's. */
|
|
27
27
|
protected readonly visibility: TaVisibility;
|
|
28
|
+
protected readonly principals: TaPrincipals;
|
|
29
|
+
/** Who else is at each conversation: what each connection is told of the others (TaSessionInfo.people). */
|
|
30
|
+
protected readonly presence: TaPresenceBook;
|
|
31
|
+
protected presenceWatched: boolean;
|
|
28
32
|
protected readonly feed: SessionListFeed;
|
|
29
33
|
locate(sessionId: string): {
|
|
30
34
|
sessionFile?: string;
|
|
@@ -34,7 +38,10 @@ export declare class DefaultTaSessionRegistry implements TaSessionRegistry {
|
|
|
34
38
|
require(sessionId: string): TaSession;
|
|
35
39
|
resolve(sessionId: string): Promise<TaSession>;
|
|
36
40
|
list(): TaSession[];
|
|
41
|
+
infos(connection: RpcConnection | undefined): TaSessionInfo[];
|
|
37
42
|
watch(connection: RpcConnection): TaSessionInfo[];
|
|
43
|
+
/** Each with the others at it, as the principal of `connection` is told: never themselves. */
|
|
44
|
+
protected withPeople(connection: RpcConnection | undefined, list: TaSessionInfo[]): TaSessionInfo[];
|
|
38
45
|
get watching(): number;
|
|
39
46
|
get watchedAt(): number;
|
|
40
47
|
onSessionEvent(listener: (session: TaSession, event: TaEvent) => void): () => void;
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.DefaultTaSessionRegistry = void 0;
|
|
13
13
|
const node_fs_1 = require("node:fs");
|
|
14
14
|
const core_1 = require("@celljs/core");
|
|
15
|
+
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
15
16
|
const client_channel_1 = require("./client-channel");
|
|
16
17
|
const host_protocol_1 = require("./host-protocol");
|
|
17
18
|
const session_handles_1 = require("./session-handles");
|
|
@@ -33,7 +34,8 @@ let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
|
33
34
|
this.closing = new Map();
|
|
34
35
|
/** Sessions opening again under their ids: the calls that come meanwhile wait for the same. */
|
|
35
36
|
this.waking = new Map();
|
|
36
|
-
this.
|
|
37
|
+
this.presenceWatched = false;
|
|
38
|
+
this.feed = new session_list_feed_1.SessionListFeed(() => this.list().map(session => session.info()), undefined, (connection, list) => this.withPeople(connection, this.visibility.sessions(connection, list)));
|
|
37
39
|
}
|
|
38
40
|
locate(sessionId) {
|
|
39
41
|
const session = this.sessions.get(sessionId);
|
|
@@ -80,9 +82,25 @@ let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
|
80
82
|
list() {
|
|
81
83
|
return [...this.sessions.values()];
|
|
82
84
|
}
|
|
85
|
+
infos(connection) {
|
|
86
|
+
return this.withPeople(connection, this.visibility.sessions(connection, this.list().map(session => session.info())));
|
|
87
|
+
}
|
|
83
88
|
watch(connection) {
|
|
89
|
+
// Once a page watches, every component is made: who is where tells the lists again as it changes.
|
|
90
|
+
if (!this.presenceWatched) {
|
|
91
|
+
this.presenceWatched = true;
|
|
92
|
+
this.presence.onChange(() => this.feed.changed());
|
|
93
|
+
}
|
|
84
94
|
return this.feed.watch(connection);
|
|
85
95
|
}
|
|
96
|
+
/** Each with the others at it, as the principal of `connection` is told: never themselves. */
|
|
97
|
+
withPeople(connection, list) {
|
|
98
|
+
const principal = connection ? this.principals.of(connection) : ta_protocol_1.TA_OWNER;
|
|
99
|
+
return list.map(info => {
|
|
100
|
+
const people = this.presence.people(info.sessionId, principal, info.isStreaming);
|
|
101
|
+
return people ? { ...info, people } : info;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
86
104
|
get watching() {
|
|
87
105
|
return this.feed.watching;
|
|
88
106
|
}
|
|
@@ -188,6 +206,14 @@ __decorate([
|
|
|
188
206
|
(0, core_1.Autowired)({ id: team_protocol_1.TaVisibility, detached: true }),
|
|
189
207
|
__metadata("design:type", Object)
|
|
190
208
|
], DefaultTaSessionRegistry.prototype, "visibility", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
(0, core_1.Autowired)({ id: team_protocol_1.TaPrincipals, detached: true }),
|
|
211
|
+
__metadata("design:type", Object)
|
|
212
|
+
], DefaultTaSessionRegistry.prototype, "principals", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
(0, core_1.Autowired)({ id: host_protocol_1.TaPresenceBook, detached: true }),
|
|
215
|
+
__metadata("design:type", Object)
|
|
216
|
+
], DefaultTaSessionRegistry.prototype, "presence", void 0);
|
|
191
217
|
exports.DefaultTaSessionRegistry = DefaultTaSessionRegistry = __decorate([
|
|
192
218
|
(0, core_1.Component)(host_protocol_1.TaSessionRegistry)
|
|
193
219
|
], DefaultTaSessionRegistry);
|
package/lib/node/ta-session.d.ts
CHANGED
|
@@ -75,6 +75,8 @@ export declare class TaSession {
|
|
|
75
75
|
* Takes one waiting message out of the queue. pi only clears the whole of it, so this reaches into its
|
|
76
76
|
* two lists: the texts it shows and the messages its agent will take, which keep their images.
|
|
77
77
|
*/
|
|
78
|
+
/** The texts of the messages waiting, of one kind, in their order. */
|
|
79
|
+
queued(kind: 'steering' | 'followUp'): readonly string[];
|
|
78
80
|
removeQueued(kind: 'steering' | 'followUp', index: number): boolean;
|
|
79
81
|
/** pi's runtime says nothing of a move in the tree: the clients are told to read the conversation again. */
|
|
80
82
|
navigateTree(targetId: string, options?: Parameters<AgentSession['navigateTree']>[1]): Promise<TaNavigateResult>;
|
package/lib/node/ta-session.js
CHANGED
|
@@ -160,6 +160,12 @@ class TaSession {
|
|
|
160
160
|
* Takes one waiting message out of the queue. pi only clears the whole of it, so this reaches into its
|
|
161
161
|
* two lists: the texts it shows and the messages its agent will take, which keep their images.
|
|
162
162
|
*/
|
|
163
|
+
/** The texts of the messages waiting, of one kind, in their order. */
|
|
164
|
+
queued(kind) {
|
|
165
|
+
var _a;
|
|
166
|
+
const pi = this.pi;
|
|
167
|
+
return [...((_a = (kind === 'steering' ? pi._steeringMessages : pi._followUpMessages)) !== null && _a !== void 0 ? _a : [])];
|
|
168
|
+
}
|
|
163
169
|
removeQueued(kind, index) {
|
|
164
170
|
const pi = this.pi;
|
|
165
171
|
const texts = kind === 'steering' ? pi._steeringMessages : pi._followUpMessages;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TaHostTeam } from '@celljs/ta-protocol';
|
|
2
|
-
import { TaAuthority, TaConnections, TaHostTeamProvider, TaMemberDevices, TaPackagePermissions, TaPrincipals, TaRunActors, TaSharedDataRegistry } from './team-protocol';
|
|
2
|
+
import { TaAuthority, TaConnections, TaHostTeamProvider, TaMemberAccounts, TaMemberDevices, TaPackagePermissions, TaPrincipals, TaRunActors, TaSharedDataRegistry } from './team-protocol';
|
|
3
3
|
/** The face of the parts of ta serve that let people in, as the server side of packages gets it (TaExtensionHost.team). */
|
|
4
4
|
export declare class DefaultTaHostTeamProvider implements TaHostTeamProvider {
|
|
5
5
|
protected readonly principals: TaPrincipals;
|
|
@@ -9,6 +9,7 @@ export declare class DefaultTaHostTeamProvider implements TaHostTeamProvider {
|
|
|
9
9
|
protected readonly permissions: TaPackagePermissions;
|
|
10
10
|
protected readonly devices: TaMemberDevices;
|
|
11
11
|
protected readonly connections: TaConnections;
|
|
12
|
+
protected readonly accounts: TaMemberAccounts;
|
|
12
13
|
readonly team: TaHostTeam;
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=host-team.d.ts.map
|
|
@@ -34,6 +34,11 @@ let DefaultTaHostTeamProvider = class DefaultTaHostTeamProvider {
|
|
|
34
34
|
pair: (principal, name, expiresAt) => this.devices.pair(principal, name, expiresAt),
|
|
35
35
|
unpair: deviceId => this.devices.unpair(deviceId),
|
|
36
36
|
devices: () => this.devices.list(),
|
|
37
|
+
accounts: {
|
|
38
|
+
providers: () => this.accounts.providers(),
|
|
39
|
+
start: (provider, redirectUri) => this.accounts.start(provider, redirectUri),
|
|
40
|
+
verify: (state, code) => this.accounts.verify(state, code),
|
|
41
|
+
},
|
|
37
42
|
};
|
|
38
43
|
}
|
|
39
44
|
};
|
|
@@ -66,6 +71,10 @@ __decorate([
|
|
|
66
71
|
(0, core_1.Autowired)(team_protocol_1.TaConnections),
|
|
67
72
|
__metadata("design:type", Object)
|
|
68
73
|
], DefaultTaHostTeamProvider.prototype, "connections", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, core_1.Autowired)(team_protocol_1.TaMemberAccounts),
|
|
76
|
+
__metadata("design:type", Object)
|
|
77
|
+
], DefaultTaHostTeamProvider.prototype, "accounts", void 0);
|
|
69
78
|
exports.DefaultTaHostTeamProvider = DefaultTaHostTeamProvider = __decorate([
|
|
70
79
|
(0, core_1.Component)(team_protocol_1.TaHostTeamProvider)
|
|
71
80
|
], DefaultTaHostTeamProvider);
|