oorja 2.2.1 → 2.4.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/dist/commands/teletype/index.js +2 -2
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.js +3 -2
- package/dist/lib/connect/index.d.ts +4 -1
- package/dist/lib/connect/index.js +16 -0
- package/dist/lib/connect/types.d.ts +12 -2
- package/dist/lib/oorja/index.d.ts +2 -1
- package/dist/lib/oorja/index.js +4 -2
- package/dist/lib/teletype/auxiliary.d.ts +1 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -102,7 +102,7 @@ Will also allow participants to write to your terminal! Collaboration mode must
|
|
|
102
102
|
discardStdin: false,
|
|
103
103
|
}).start();
|
|
104
104
|
const now = new Date();
|
|
105
|
-
const { roomKey } = await oorja
|
|
105
|
+
const { roomKey, inviteCode } = await oorja
|
|
106
106
|
.createRoom({
|
|
107
107
|
roomName: `Teletype session - ${hostname()} @ ${now.getHours()}:${now.getMinutes().toString().padStart(2, '0')}`,
|
|
108
108
|
apps: {
|
|
@@ -127,7 +127,7 @@ Will also allow participants to write to your terminal! Collaboration mode must
|
|
|
127
127
|
return Promise.reject();
|
|
128
128
|
});
|
|
129
129
|
spinner.succeed(chalk.bold('Space created')).clear();
|
|
130
|
-
const link = oorja.linkForRoom(roomKey);
|
|
130
|
+
const link = oorja.linkForRoom(roomKey, inviteCode);
|
|
131
131
|
console.log(`\n${chalk.bold(chalk.blueBright(link))}\n`);
|
|
132
132
|
console.log(chalk.bold("^^ You'll be streaming here ^^"));
|
|
133
133
|
this.clearstdin();
|
package/dist/lib/config.d.ts
CHANGED
package/dist/lib/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
export const CLI_VERSION = 2.
|
|
4
|
+
export const CLI_VERSION = 2.8;
|
|
5
5
|
export class Config {
|
|
6
6
|
streamKeyAuth = false;
|
|
7
7
|
configPath;
|
|
@@ -38,7 +38,7 @@ export class Config {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
getEnv = () => {
|
|
41
|
-
return this.config['env']
|
|
41
|
+
return this.config['env'] || 'prod';
|
|
42
42
|
};
|
|
43
43
|
getAccessToken = () => {
|
|
44
44
|
return this.config[`${this.getEnv()}-access-token`] || '';
|
|
@@ -54,6 +54,7 @@ export const getConnectConfig = (env, region) => {
|
|
|
54
54
|
case 'local':
|
|
55
55
|
return 'localhost:4000';
|
|
56
56
|
case 'prod':
|
|
57
|
+
default:
|
|
57
58
|
return region ? `${region}.connect.oorja.io` : 'connect.oorja.io';
|
|
58
59
|
}
|
|
59
60
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { User, RoomApps, Room, CliManifest } from './types.js';
|
|
1
|
+
import { User, RoomApps, Room, CliManifest, NewRoomInviteResponse } from './types.js';
|
|
2
2
|
import { env } from '../config.js';
|
|
3
3
|
import { Channel } from 'phoenix';
|
|
4
4
|
export declare class ApiClientError extends Error {
|
|
@@ -16,6 +16,9 @@ export declare class ConnectClient {
|
|
|
16
16
|
fetchCliManifest: () => Promise<CliManifest>;
|
|
17
17
|
fetchSessionUser: (v2?: boolean) => Promise<User>;
|
|
18
18
|
createRoom: ({ roomName, apps }: CreateRoomOptions) => Promise<Room>;
|
|
19
|
+
createInviteCode: ({ roomId }: {
|
|
20
|
+
roomId: string;
|
|
21
|
+
}) => Promise<NewRoomInviteResponse>;
|
|
19
22
|
createAnonymousUser: () => Promise<string>;
|
|
20
23
|
fetchRoom: (roomId: string) => Promise<Room>;
|
|
21
24
|
establishSocket: () => Promise<void>;
|
|
@@ -100,6 +100,22 @@ export class ConnectClient {
|
|
|
100
100
|
return handleError(error);
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
+
createInviteCode = async ({ roomId }) => {
|
|
104
|
+
const body = {
|
|
105
|
+
participant_access: 'can_edit',
|
|
106
|
+
};
|
|
107
|
+
try {
|
|
108
|
+
const response = await this._fetch(`/v1/rooms/${roomId}/invites`, {
|
|
109
|
+
method: 'POST',
|
|
110
|
+
body: JSON.stringify(body),
|
|
111
|
+
});
|
|
112
|
+
const data = await response.json();
|
|
113
|
+
return defaultParser(data);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
return handleError(error);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
103
119
|
createAnonymousUser = async () => {
|
|
104
120
|
try {
|
|
105
121
|
const response = await this._fetch('/v1/session/anon', { method: 'POST' });
|
|
@@ -34,7 +34,17 @@ export type RoomKey = {
|
|
|
34
34
|
roomId: string;
|
|
35
35
|
key: Buffer;
|
|
36
36
|
};
|
|
37
|
-
export type
|
|
38
|
-
|
|
37
|
+
export type ParticipantAccess = 'full_access' | 'can_edit' | 'can_view';
|
|
38
|
+
export type RoomInvite = {
|
|
39
|
+
id: string;
|
|
40
|
+
creatorId: string;
|
|
41
|
+
insertedAt: string;
|
|
42
|
+
inviteCode: string;
|
|
43
|
+
participantAccess: ParticipantAccess;
|
|
44
|
+
roomId: string;
|
|
45
|
+
};
|
|
46
|
+
export type NewRoomInviteResponse = {
|
|
47
|
+
allInvites: RoomInvite[];
|
|
48
|
+
data: RoomInvite;
|
|
39
49
|
};
|
|
40
50
|
export {};
|
|
@@ -13,8 +13,9 @@ export declare class OORJA {
|
|
|
13
13
|
createRoom: (options: CreateRoomOptions) => Promise<{
|
|
14
14
|
room: import("../connect/types.js").Room;
|
|
15
15
|
roomKey: RoomKey;
|
|
16
|
+
inviteCode: string;
|
|
16
17
|
}>;
|
|
17
|
-
linkForRoom: (roomKey: RoomKey) => string;
|
|
18
|
+
linkForRoom: (roomKey: RoomKey, inviteCode: string) => string;
|
|
18
19
|
getRoomKey(streamKey: StreamKey): RoomKey;
|
|
19
20
|
teletype: (options: Omit<TeletypeOptions, "userId" | "joinChannel">) => Promise<unknown>;
|
|
20
21
|
}
|
package/dist/lib/oorja/index.js
CHANGED
|
@@ -24,13 +24,15 @@ export class OORJA {
|
|
|
24
24
|
createRoom = async (options) => {
|
|
25
25
|
const room = await this.connectClient.createRoom(options);
|
|
26
26
|
const roomKey = createRoomKey(room.id);
|
|
27
|
+
const { data: { inviteCode }, } = await this.connectClient.createInviteCode({ roomId: room.id });
|
|
27
28
|
return {
|
|
28
29
|
room,
|
|
29
30
|
roomKey,
|
|
31
|
+
inviteCode,
|
|
30
32
|
};
|
|
31
33
|
};
|
|
32
|
-
linkForRoom = (roomKey) => {
|
|
33
|
-
return `${oorjaURL(this.config)}/rooms?id=${roomKey.roomId}#${exportKey(roomKey.key)}`;
|
|
34
|
+
linkForRoom = (roomKey, inviteCode) => {
|
|
35
|
+
return `${oorjaURL(this.config)}/rooms?id=${roomKey.roomId}&inviteCode=${inviteCode}#${exportKey(roomKey.key)}`;
|
|
34
36
|
};
|
|
35
37
|
getRoomKey(streamKey) {
|
|
36
38
|
return {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IPty } from 'node-pty';
|
|
2
|
-
import { Hash } from '../connect/types.js';
|
|
3
2
|
export declare const initScreen: (username: string, hostname: string, shell: string, multiplexed: boolean) => void;
|
|
4
3
|
export type dimensions = {
|
|
5
4
|
rows: number;
|
|
@@ -7,4 +6,4 @@ export type dimensions = {
|
|
|
7
6
|
};
|
|
8
7
|
export declare const getDimensions: () => dimensions;
|
|
9
8
|
export declare const areDimensionEqual: (a: dimensions, b: dimensions) => boolean;
|
|
10
|
-
export declare const resizeBestFit: (term: IPty, userDimensions:
|
|
9
|
+
export declare const resizeBestFit: (term: IPty, userDimensions: Record<string, dimensions>, shouldClearScreen?: boolean) => void;
|
package/oclif.manifest.json
CHANGED