@hanzo/rooms 0.1.51 → 0.1.52
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/lib/api.d.ts +9 -0
- package/dist/lib/api.js +16 -1
- package/dist/lib/host.d.ts +7 -0
- package/dist/lib/host.js +14 -0
- package/package.json +1 -1
package/dist/lib/api.d.ts
CHANGED
|
@@ -19,6 +19,15 @@
|
|
|
19
19
|
* production address was frozen into the bundle before a browser could say
|
|
20
20
|
* where it was. Called at request time it answers for the page that is open.
|
|
21
21
|
*/
|
|
22
|
+
/**
|
|
23
|
+
* The devnet's gateway and identity. A page on a devnet host (`devnet()` in
|
|
24
|
+
* host.ts) talks to these and to nothing of production's: the export is the
|
|
25
|
+
* same bytes on hanzo.ai and on app-dev.hanzo.ai, so the host it is open on is
|
|
26
|
+
* the only thing that tells the two apart, and it outranks any address the
|
|
27
|
+
* build stated with `configure()`.
|
|
28
|
+
*/
|
|
29
|
+
export declare const API_DEV = "https://api-dev.hanzo.ai";
|
|
30
|
+
export declare const IAM_DEV = "https://id-dev.hanzo.ai";
|
|
22
31
|
/** The gateway's origin, with no trailing slash: callers write `${api()}/v1/…`. */
|
|
23
32
|
export declare function api(): string;
|
|
24
33
|
/**
|
package/dist/lib/api.js
CHANGED
|
@@ -19,10 +19,23 @@
|
|
|
19
19
|
* production address was frozen into the bundle before a browser could say
|
|
20
20
|
* where it was. Called at request time it answers for the page that is open.
|
|
21
21
|
*/
|
|
22
|
-
import { guest, team } from './host.js';
|
|
22
|
+
import { devnet, guest, team } from './host.js';
|
|
23
23
|
import { where } from '../where.js';
|
|
24
|
+
/**
|
|
25
|
+
* The devnet's gateway and identity. A page on a devnet host (`devnet()` in
|
|
26
|
+
* host.ts) talks to these and to nothing of production's: the export is the
|
|
27
|
+
* same bytes on hanzo.ai and on app-dev.hanzo.ai, so the host it is open on is
|
|
28
|
+
* the only thing that tells the two apart, and it outranks any address the
|
|
29
|
+
* build stated with `configure()`.
|
|
30
|
+
*/
|
|
31
|
+
export const API_DEV = 'https://api-dev.hanzo.ai';
|
|
32
|
+
export const IAM_DEV = 'https://id-dev.hanzo.ai';
|
|
33
|
+
/** Whether the page in front of us is on a devnet host. */
|
|
34
|
+
const onDevnet = () => typeof window !== 'undefined' && devnet(window.location.hostname);
|
|
24
35
|
/** The gateway's origin, with no trailing slash: callers write `${api()}/v1/…`. */
|
|
25
36
|
export function api() {
|
|
37
|
+
if (onDevnet())
|
|
38
|
+
return API_DEV;
|
|
26
39
|
const set = where().api;
|
|
27
40
|
if (set)
|
|
28
41
|
return set.replace(/\/+$/, '');
|
|
@@ -52,6 +65,8 @@ export function api() {
|
|
|
52
65
|
* the day it is changed.
|
|
53
66
|
*/
|
|
54
67
|
export function iam() {
|
|
68
|
+
if (onDevnet())
|
|
69
|
+
return IAM_DEV;
|
|
55
70
|
return (where().iam || 'https://hanzo.id').replace(/\/+$/, '');
|
|
56
71
|
}
|
|
57
72
|
/**
|
package/dist/lib/host.d.ts
CHANGED
|
@@ -128,3 +128,10 @@ export declare const WEB = "https://hanzo.ai/chat";
|
|
|
128
128
|
* on hanzo.ai.
|
|
129
129
|
*/
|
|
130
130
|
export declare const guest: (hostname: string) => boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Whether a host is the devnet's: its production twin with `-dev` on the one
|
|
133
|
+
* label under hanzo.ai (app-dev.hanzo.ai, api-dev.hanzo.ai, id-dev.hanzo.ai).
|
|
134
|
+
* A deeper name (a.b-dev.hanzo.ai) is not one, and neither is a name that only
|
|
135
|
+
* contains the suffix (app-dev.hanzo.ai.example.com).
|
|
136
|
+
*/
|
|
137
|
+
export declare function devnet(hostname: string): boolean;
|
package/dist/lib/host.js
CHANGED
|
@@ -197,3 +197,17 @@ export const WEB = `${SIGNIN}${CHAT}`;
|
|
|
197
197
|
* on hanzo.ai.
|
|
198
198
|
*/
|
|
199
199
|
export const guest = (hostname) => hostname === 'hanzo.app' || hostname.endsWith('.hanzo.app') || hostname === 'hanzo.chat';
|
|
200
|
+
/** The devnet's hosts are one label under hanzo.ai ending in `-dev`: app-dev, api-dev, id-dev. */
|
|
201
|
+
const DEVNET = '-dev.hanzo.ai';
|
|
202
|
+
/**
|
|
203
|
+
* Whether a host is the devnet's: its production twin with `-dev` on the one
|
|
204
|
+
* label under hanzo.ai (app-dev.hanzo.ai, api-dev.hanzo.ai, id-dev.hanzo.ai).
|
|
205
|
+
* A deeper name (a.b-dev.hanzo.ai) is not one, and neither is a name that only
|
|
206
|
+
* contains the suffix (app-dev.hanzo.ai.example.com).
|
|
207
|
+
*/
|
|
208
|
+
export function devnet(hostname) {
|
|
209
|
+
if (!hostname.endsWith(DEVNET))
|
|
210
|
+
return false;
|
|
211
|
+
const label = hostname.slice(0, -'.hanzo.ai'.length);
|
|
212
|
+
return label.length > '-dev'.length && !label.includes('.');
|
|
213
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/rooms",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.52",
|
|
4
4
|
"description": "The workspace rooms — Home, Chat, Inbox, Contacts, Meet, Cal, Drive, Board, Work, Bots — and the frame that holds them, once, for every Hanzo surface.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|