@tthr/vue 0.0.17 → 0.0.18

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.
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @tthr/vue/server - Server-side Tether client for Nuxt
3
+ *
4
+ * Use this in Nuxt server/api routes for webhooks, third-party integrations,
5
+ * and any server-side logic that needs to call Tether queries/mutations.
6
+ */
7
+ import { TetherServerClient, type TetherServerClientOptions } from '@tthr/client';
8
+ export { TetherServerClient, type TetherServerClientOptions } from '@tthr/client';
9
+ /**
10
+ * Configure the server-side Tether client.
11
+ * Call this once in your Nuxt server plugin or at the top of your API routes.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * // server/plugins/tether.ts
16
+ * import { configureTetherServer } from '@tthr/vue/server';
17
+ *
18
+ * export default defineNitroPlugin(() => {
19
+ * configureTetherServer({
20
+ * url: process.env.TETHER_URL!,
21
+ * projectId: process.env.TETHER_PROJECT_ID!,
22
+ * apiKey: process.env.TETHER_API_KEY,
23
+ * });
24
+ * });
25
+ * ```
26
+ */
27
+ export declare function configureTetherServer(options: TetherServerClientOptions): void;
28
+ /**
29
+ * Get the configured server-side Tether client.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * // server/api/users.get.ts
34
+ * import { useTetherServer } from '@tthr/vue/server';
35
+ *
36
+ * export default defineEventHandler(async () => {
37
+ * const tether = useTetherServer();
38
+ * return await tether.query('users.list');
39
+ * });
40
+ * ```
41
+ */
42
+ export declare function useTetherServer(): TetherServerClient;
43
+ /**
44
+ * Create a new server-side Tether client instance.
45
+ * Use this when you need a separate client with different configuration.
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * // server/api/webhook.ts
50
+ * import { createTetherServer } from '@tthr/vue/server';
51
+ *
52
+ * const tether = createTetherServer({
53
+ * url: process.env.TETHER_URL!,
54
+ * projectId: process.env.TETHER_PROJECT_ID!,
55
+ * apiKey: process.env.TETHER_API_KEY,
56
+ * });
57
+ *
58
+ * export default defineEventHandler(async (event) => {
59
+ * const users = await tether.query('users.list');
60
+ * return { users };
61
+ * });
62
+ * ```
63
+ */
64
+ export declare function createTetherServer(options: TetherServerClientOptions): TetherServerClient;
65
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAGlF,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAKlF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAE9E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,IAAI,kBAAkB,CAQpD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,kBAAkB,CAEzF"}
package/dist/server.js ADDED
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @tthr/vue/server - Server-side Tether client for Nuxt
3
+ *
4
+ * Use this in Nuxt server/api routes for webhooks, third-party integrations,
5
+ * and any server-side logic that needs to call Tether queries/mutations.
6
+ */
7
+ import { TetherServerClient } from '@tthr/client';
8
+ // Re-export the server client and types for convenience
9
+ export { TetherServerClient } from '@tthr/client';
10
+ // Singleton client instance
11
+ let serverClient = null;
12
+ /**
13
+ * Configure the server-side Tether client.
14
+ * Call this once in your Nuxt server plugin or at the top of your API routes.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // server/plugins/tether.ts
19
+ * import { configureTetherServer } from '@tthr/vue/server';
20
+ *
21
+ * export default defineNitroPlugin(() => {
22
+ * configureTetherServer({
23
+ * url: process.env.TETHER_URL!,
24
+ * projectId: process.env.TETHER_PROJECT_ID!,
25
+ * apiKey: process.env.TETHER_API_KEY,
26
+ * });
27
+ * });
28
+ * ```
29
+ */
30
+ export function configureTetherServer(options) {
31
+ serverClient = new TetherServerClient(options);
32
+ }
33
+ /**
34
+ * Get the configured server-side Tether client.
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * // server/api/users.get.ts
39
+ * import { useTetherServer } from '@tthr/vue/server';
40
+ *
41
+ * export default defineEventHandler(async () => {
42
+ * const tether = useTetherServer();
43
+ * return await tether.query('users.list');
44
+ * });
45
+ * ```
46
+ */
47
+ export function useTetherServer() {
48
+ if (!serverClient) {
49
+ throw new Error('Tether server client not configured. Call configureTetherServer() first, ' +
50
+ 'typically in a Nitro plugin (server/plugins/tether.ts).');
51
+ }
52
+ return serverClient;
53
+ }
54
+ /**
55
+ * Create a new server-side Tether client instance.
56
+ * Use this when you need a separate client with different configuration.
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * // server/api/webhook.ts
61
+ * import { createTetherServer } from '@tthr/vue/server';
62
+ *
63
+ * const tether = createTetherServer({
64
+ * url: process.env.TETHER_URL!,
65
+ * projectId: process.env.TETHER_PROJECT_ID!,
66
+ * apiKey: process.env.TETHER_API_KEY,
67
+ * });
68
+ *
69
+ * export default defineEventHandler(async (event) => {
70
+ * const users = await tether.query('users.list');
71
+ * return { users };
72
+ * });
73
+ * ```
74
+ */
75
+ export function createTetherServer(options) {
76
+ return new TetherServerClient(options);
77
+ }
78
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAkC,MAAM,cAAc,CAAC;AAElF,wDAAwD;AACxD,OAAO,EAAE,kBAAkB,EAAkC,MAAM,cAAc,CAAC;AAElF,4BAA4B;AAC5B,IAAI,YAAY,GAA8B,IAAI,CAAC;AAEnD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAkC;IACtE,YAAY,GAAG,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe;IAC7B,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CACb,2EAA2E;YAC3E,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAkC;IACnE,OAAO,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tthr/vue",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "Tether Vue/Nuxt SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -10,6 +10,10 @@
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.js"
12
12
  },
13
+ "./server": {
14
+ "types": "./dist/server.d.ts",
15
+ "import": "./dist/server.js"
16
+ },
13
17
  "./nuxt": {
14
18
  "import": "./nuxt/module.ts"
15
19
  }