instant-cli 1.0.34 → 1.0.35
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/.turbo/turbo-build.log
CHANGED
package/dist/commands/info.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
export declare const infoCommand: () => Effect.Effect<void, Error, never>;
|
|
2
|
+
export declare const infoCommand: () => Effect.Effect<void, Error | import("@effect/platform/HttpClientError").RequestError | import("effect/ParseResult").ParseError | import("@effect/platform/HttpClientError").ResponseError, never>;
|
|
3
3
|
//# sourceMappingURL=info.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../src/commands/info.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../src/commands/info.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAoBhD,eAAO,MAAM,WAAW,wMA+BpB,CAAC"}
|
package/dist/commands/info.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpClientResponse } from '@effect/platform';
|
|
2
2
|
import { Effect, Schema, Option } from 'effect';
|
|
3
|
-
import {
|
|
3
|
+
import { InstantHttpAuthed } from "../lib/http.js";
|
|
4
4
|
import { version } from '@instantdb/version';
|
|
5
5
|
import { CurrentApp } from "../context/currentApp.js";
|
|
6
6
|
const DashMeResponse = Schema.Struct({
|
|
@@ -18,7 +18,6 @@ const DashAppResponse = Schema.Struct({
|
|
|
18
18
|
});
|
|
19
19
|
export const infoCommand = () => Effect.gen(function* () {
|
|
20
20
|
const authedHttp = yield* Effect.serviceOption(InstantHttpAuthed).pipe(Effect.map(Option.getOrNull));
|
|
21
|
-
const http = yield* Effect.serviceOption(InstantHttp).pipe(Effect.map(Option.getOrNull));
|
|
22
21
|
const maybeApp = yield* Effect.serviceOption(CurrentApp);
|
|
23
22
|
yield* Effect.log('CLI Version:', version);
|
|
24
23
|
// If logged in..
|
|
@@ -29,19 +28,11 @@ export const infoCommand = () => Effect.gen(function* () {
|
|
|
29
28
|
else {
|
|
30
29
|
yield* Effect.log('Not logged in.');
|
|
31
30
|
}
|
|
32
|
-
if (Option.isSome(maybeApp) &&
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!appHttp)
|
|
38
|
-
return;
|
|
39
|
-
const appInfo = yield* appHttp
|
|
40
|
-
.get(`/dash/apps/${app.appId}`)
|
|
41
|
-
.pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(DashAppResponse)), Effect.option);
|
|
42
|
-
if (Option.isSome(appInfo)) {
|
|
43
|
-
yield* Effect.log(`App: ${appInfo.value.app.title} (${appInfo.value.app.id})`);
|
|
44
|
-
}
|
|
31
|
+
if (Option.isSome(maybeApp) && authedHttp) {
|
|
32
|
+
const appInfo = yield* authedHttp
|
|
33
|
+
.get(`/dash/apps/${maybeApp.value.appId}`)
|
|
34
|
+
.pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(DashAppResponse)));
|
|
35
|
+
yield* Effect.log(`App: ${appInfo.app.title} (${appInfo.app.id})`);
|
|
45
36
|
}
|
|
46
37
|
});
|
|
47
38
|
//# sourceMappingURL=info.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/commands/info.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/commands/info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO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AAE,KAAK,EAAE,CAAC,EAAE,CAAC,CACjE,CACF,CAAC;QAEF,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,gBAAgB,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACzD,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU,EAAE,CAAC;QAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,UAAU;aAC9B,GAAG,CAAC,cAAc,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;aACzC,IAAI,CACH,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CACnE,CAAC;QAEJ,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACrE,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { HttpClientResponse } from '@effect/platform';\nimport { Effect, Schema, Option } from 'effect';\nimport { InstantHttpAuthed } from '../lib/http.ts';\nimport { version } from '@instantdb/version';\nimport { CurrentApp } from '../context/currentApp.ts';\n\nconst DashMeResponse = Schema.Struct({\n user: Schema.Struct({\n id: Schema.String,\n email: Schema.String,\n created_at: Schema.String,\n }),\n});\n\nconst DashAppResponse = Schema.Struct({\n app: Schema.Struct({\n id: Schema.String,\n title: Schema.String,\n }),\n});\n\nexport const infoCommand = () =>\n Effect.gen(function* () {\n const authedHttp = yield* Effect.serviceOption(InstantHttpAuthed).pipe(\n Effect.map(Option.getOrNull),\n );\n const maybeApp = yield* Effect.serviceOption(CurrentApp);\n\n yield* Effect.log('CLI Version:', version);\n // If logged in..\n if (authedHttp) {\n const meData = yield* authedHttp.get('/dash/me').pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(DashMeResponse)),\n Effect.mapError(\n (e) => new Error(\"Couldn't get user information.\", { cause: e }),\n ),\n );\n\n yield* Effect.log(`Logged in as ${meData.user.email}`);\n } else {\n yield* Effect.log('Not logged in.');\n }\n\n if (Option.isSome(maybeApp) && authedHttp) {\n const appInfo = yield* authedHttp\n .get(`/dash/apps/${maybeApp.value.appId}`)\n .pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(DashAppResponse)),\n );\n\n yield* Effect.log(`App: ${appInfo.app.title} (${appInfo.app.id})`);\n }\n });\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instant-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.35",
|
|
5
5
|
"description": "Instant's CLI",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"homepage": "https://github.com/instantdb/instant/tree/main/client/packages/cli",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"strip-ansi": "^7.1.2",
|
|
51
51
|
"supports-hyperlinks": "^4.4.0",
|
|
52
52
|
"unconfig": "^7.5.0",
|
|
53
|
-
"@instantdb/
|
|
54
|
-
"@instantdb/
|
|
55
|
-
"@instantdb/
|
|
53
|
+
"@instantdb/platform": "1.0.35",
|
|
54
|
+
"@instantdb/version": "1.0.35",
|
|
55
|
+
"@instantdb/core": "1.0.35"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@babel/core": "^7.17.9",
|
package/src/commands/info.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
HttpClient,
|
|
3
|
-
HttpClientRequest,
|
|
4
|
-
HttpClientResponse,
|
|
5
|
-
} from '@effect/platform';
|
|
1
|
+
import { HttpClientResponse } from '@effect/platform';
|
|
6
2
|
import { Effect, Schema, Option } from 'effect';
|
|
7
|
-
import {
|
|
3
|
+
import { InstantHttpAuthed } from '../lib/http.ts';
|
|
8
4
|
import { version } from '@instantdb/version';
|
|
9
5
|
import { CurrentApp } from '../context/currentApp.ts';
|
|
10
6
|
|
|
@@ -28,9 +24,6 @@ export const infoCommand = () =>
|
|
|
28
24
|
const authedHttp = yield* Effect.serviceOption(InstantHttpAuthed).pipe(
|
|
29
25
|
Effect.map(Option.getOrNull),
|
|
30
26
|
);
|
|
31
|
-
const http = yield* Effect.serviceOption(InstantHttp).pipe(
|
|
32
|
-
Effect.map(Option.getOrNull),
|
|
33
|
-
);
|
|
34
27
|
const maybeApp = yield* Effect.serviceOption(CurrentApp);
|
|
35
28
|
|
|
36
29
|
yield* Effect.log('CLI Version:', version);
|
|
@@ -48,35 +41,13 @@ export const infoCommand = () =>
|
|
|
48
41
|
yield* Effect.log('Not logged in.');
|
|
49
42
|
}
|
|
50
43
|
|
|
51
|
-
if (Option.isSome(maybeApp) &&
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
app.adminToken && http
|
|
55
|
-
? http.pipe(
|
|
56
|
-
HttpClient.mapRequest((request) =>
|
|
57
|
-
request.pipe(
|
|
58
|
-
HttpClientRequest.setHeader(
|
|
59
|
-
'Authorization',
|
|
60
|
-
`Bearer ${app.adminToken}`,
|
|
61
|
-
),
|
|
62
|
-
),
|
|
63
|
-
),
|
|
64
|
-
)
|
|
65
|
-
: authedHttp;
|
|
66
|
-
|
|
67
|
-
if (!appHttp) return;
|
|
68
|
-
|
|
69
|
-
const appInfo = yield* appHttp
|
|
70
|
-
.get(`/dash/apps/${app.appId}`)
|
|
44
|
+
if (Option.isSome(maybeApp) && authedHttp) {
|
|
45
|
+
const appInfo = yield* authedHttp
|
|
46
|
+
.get(`/dash/apps/${maybeApp.value.appId}`)
|
|
71
47
|
.pipe(
|
|
72
48
|
Effect.flatMap(HttpClientResponse.schemaBodyJson(DashAppResponse)),
|
|
73
|
-
Effect.option,
|
|
74
49
|
);
|
|
75
50
|
|
|
76
|
-
|
|
77
|
-
yield* Effect.log(
|
|
78
|
-
`App: ${appInfo.value.app.title} (${appInfo.value.app.id})`,
|
|
79
|
-
);
|
|
80
|
-
}
|
|
51
|
+
yield* Effect.log(`App: ${appInfo.app.title} (${appInfo.app.id})`);
|
|
81
52
|
}
|
|
82
53
|
});
|