@tinkerer/sdk 0.1.1 → 0.1.3

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.md CHANGED
@@ -15,12 +15,13 @@ bun add @tinkerer/sdk
15
15
  ```ts
16
16
  import { createLmsClient } from "@tinkerer/sdk";
17
17
 
18
- const lms = createLmsClient("https://api.tinkerer.space");
18
+ const lms = createLmsClient();
19
19
  const { writing } = await lms.getDailyJapaneseWriting({});
20
20
  ```
21
21
 
22
- One `create<Name>Client(baseUrl)` helper is exported per service
23
- (`createDirectoryClient`, `createLmsClient`), plus the request/response
24
- types.
22
+ ## Services
23
+
24
+ - `createDirectoryClient` — directory of tinkerer.space
25
+ - `createLmsClient` — learning management
25
26
 
26
27
  ESM-only; type declarations included.
package/dist/index.d.ts CHANGED
@@ -17,16 +17,16 @@ export type DirectoryClient = Client<typeof DirectoryService>;
17
17
  /**
18
18
  * Creates a directory service client.
19
19
  *
20
- * @param baseUrl Base URL of the tinkerer.space API gateway,
21
- * e.g. `https://api.tinkerer.space`.
20
+ * @param baseUrl Base URL of the API gateway. Defaults to the production
21
+ * gateway.
22
22
  */
23
- export declare function createDirectoryClient(baseUrl: string): DirectoryClient;
23
+ export declare function createDirectoryClient(baseUrl?: string): DirectoryClient;
24
24
  /** A client for the lms service. */
25
25
  export type LmsClient = Client<typeof LmsService>;
26
26
  /**
27
27
  * Creates an lms service client.
28
28
  *
29
- * @param baseUrl Base URL of the tinkerer.space API gateway,
30
- * e.g. `https://api.tinkerer.space`.
29
+ * @param baseUrl Base URL of the API gateway. Defaults to the production
30
+ * gateway.
31
31
  */
32
- export declare function createLmsClient(baseUrl: string): LmsClient;
32
+ export declare function createLmsClient(baseUrl?: string): LmsClient;
package/dist/index.js CHANGED
@@ -10,23 +10,25 @@ import { DirectoryService } from "./gen/directory/v1/directory_pb.js";
10
10
  import { LmsService } from "./gen/lms/v1/lms_pb.js";
11
11
  export { Grade, Jlpt } from "./gen/lms/v1/lms_pb.js";
12
12
  export { DirectoryService, LmsService };
13
+ /** Base URL of the production tinkerer.space API gateway. */
14
+ const TINKERER_API_URL = "https://api.tinkerer.space";
13
15
  /**
14
16
  * Creates a directory service client.
15
17
  *
16
- * @param baseUrl Base URL of the tinkerer.space API gateway,
17
- * e.g. `https://api.tinkerer.space`.
18
+ * @param baseUrl Base URL of the API gateway. Defaults to the production
19
+ * gateway.
18
20
  */
19
- export function createDirectoryClient(baseUrl) {
21
+ export function createDirectoryClient(baseUrl = TINKERER_API_URL) {
20
22
  const transport = createGrpcWebTransport({ baseUrl });
21
23
  return createClient(DirectoryService, transport);
22
24
  }
23
25
  /**
24
26
  * Creates an lms service client.
25
27
  *
26
- * @param baseUrl Base URL of the tinkerer.space API gateway,
27
- * e.g. `https://api.tinkerer.space`.
28
+ * @param baseUrl Base URL of the API gateway. Defaults to the production
29
+ * gateway.
28
30
  */
29
- export function createLmsClient(baseUrl) {
31
+ export function createLmsClient(baseUrl = TINKERER_API_URL) {
30
32
  const transport = createGrpcWebTransport({ baseUrl });
31
33
  return createClient(LmsService, transport);
32
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinkerer/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Browser SDK for tinkerer.space services.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -20,7 +20,8 @@
20
20
  "dist"
21
21
  ],
22
22
  "publishConfig": {
23
- "access": "public"
23
+ "access": "public",
24
+ "provenance": false
24
25
  },
25
26
  "scripts": {
26
27
  "prepublishOnly": "bun install --frozen-lockfile && rm -rf dist && bun run build",