@townco/fly 0.1.2 → 0.1.4

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.
Files changed (54) hide show
  1. package/dist/client/client.gen.d.ts +2 -0
  2. package/dist/client/client.gen.js +228 -0
  3. package/dist/client/index.d.ts +8 -0
  4. package/dist/client/index.js +6 -0
  5. package/dist/client/types.gen.d.ts +117 -0
  6. package/dist/client/types.gen.js +2 -0
  7. package/dist/client/utils.gen.d.ts +33 -0
  8. package/dist/client/utils.gen.js +231 -0
  9. package/{src/client.gen.ts → dist/client.gen.d.ts} +3 -16
  10. package/dist/client.gen.js +3 -0
  11. package/dist/core/auth.gen.d.ts +18 -0
  12. package/dist/core/auth.gen.js +14 -0
  13. package/dist/core/bodySerializer.gen.d.ts +25 -0
  14. package/dist/core/bodySerializer.gen.js +57 -0
  15. package/dist/core/params.gen.d.ts +43 -0
  16. package/dist/core/params.gen.js +100 -0
  17. package/dist/core/pathSerializer.gen.d.ts +33 -0
  18. package/dist/core/pathSerializer.gen.js +114 -0
  19. package/dist/core/queryKeySerializer.gen.d.ts +18 -0
  20. package/dist/core/queryKeySerializer.gen.js +99 -0
  21. package/dist/core/serverSentEvents.gen.d.ts +71 -0
  22. package/dist/core/serverSentEvents.gen.js +135 -0
  23. package/dist/core/types.gen.d.ts +78 -0
  24. package/dist/core/types.gen.js +2 -0
  25. package/dist/core/utils.gen.d.ts +19 -0
  26. package/dist/core/utils.gen.js +87 -0
  27. package/dist/hey-api.d.ts +2 -0
  28. package/dist/hey-api.js +6 -0
  29. package/dist/index.d.ts +2 -0
  30. package/{src/index.ts → dist/index.js} +0 -2
  31. package/dist/sdk.gen.d.ts +379 -0
  32. package/dist/sdk.gen.js +557 -0
  33. package/dist/types.gen.d.ts +2592 -0
  34. package/dist/types.gen.js +2 -0
  35. package/package.json +6 -3
  36. package/.envrc +0 -11
  37. package/openapi-ts.config.ts +0 -7
  38. package/spec.json +0 -5072
  39. package/src/client/client.gen.ts +0 -301
  40. package/src/client/index.ts +0 -25
  41. package/src/client/types.gen.ts +0 -241
  42. package/src/client/utils.gen.ts +0 -337
  43. package/src/core/auth.gen.ts +0 -42
  44. package/src/core/bodySerializer.gen.ts +0 -100
  45. package/src/core/params.gen.ts +0 -176
  46. package/src/core/pathSerializer.gen.ts +0 -181
  47. package/src/core/queryKeySerializer.gen.ts +0 -136
  48. package/src/core/serverSentEvents.gen.ts +0 -264
  49. package/src/core/types.gen.ts +0 -118
  50. package/src/core/utils.gen.ts +0 -143
  51. package/src/hey-api.ts +0 -8
  52. package/src/sdk.gen.ts +0 -1163
  53. package/src/types.gen.ts +0 -2974
  54. package/tsconfig.json +0 -11
@@ -1,143 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
-
3
- import type { BodySerializer, QuerySerializer } from "./bodySerializer.gen";
4
- import {
5
- type ArraySeparatorStyle,
6
- serializeArrayParam,
7
- serializeObjectParam,
8
- serializePrimitiveParam,
9
- } from "./pathSerializer.gen";
10
-
11
- export interface PathSerializer {
12
- path: Record<string, unknown>;
13
- url: string;
14
- }
15
-
16
- export const PATH_PARAM_RE = /\{[^{}]+\}/g;
17
-
18
- export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
19
- let url = _url;
20
- const matches = _url.match(PATH_PARAM_RE);
21
- if (matches) {
22
- for (const match of matches) {
23
- let explode = false;
24
- let name = match.substring(1, match.length - 1);
25
- let style: ArraySeparatorStyle = "simple";
26
-
27
- if (name.endsWith("*")) {
28
- explode = true;
29
- name = name.substring(0, name.length - 1);
30
- }
31
-
32
- if (name.startsWith(".")) {
33
- name = name.substring(1);
34
- style = "label";
35
- } else if (name.startsWith(";")) {
36
- name = name.substring(1);
37
- style = "matrix";
38
- }
39
-
40
- const value = path[name];
41
-
42
- if (value === undefined || value === null) {
43
- continue;
44
- }
45
-
46
- if (Array.isArray(value)) {
47
- url = url.replace(
48
- match,
49
- serializeArrayParam({ explode, name, style, value }),
50
- );
51
- continue;
52
- }
53
-
54
- if (typeof value === "object") {
55
- url = url.replace(
56
- match,
57
- serializeObjectParam({
58
- explode,
59
- name,
60
- style,
61
- value: value as Record<string, unknown>,
62
- valueOnly: true,
63
- }),
64
- );
65
- continue;
66
- }
67
-
68
- if (style === "matrix") {
69
- url = url.replace(
70
- match,
71
- `;${serializePrimitiveParam({
72
- name,
73
- value: value as string,
74
- })}`,
75
- );
76
- continue;
77
- }
78
-
79
- const replaceValue = encodeURIComponent(
80
- style === "label" ? `.${value as string}` : (value as string),
81
- );
82
- url = url.replace(match, replaceValue);
83
- }
84
- }
85
- return url;
86
- };
87
-
88
- export const getUrl = ({
89
- baseUrl,
90
- path,
91
- query,
92
- querySerializer,
93
- url: _url,
94
- }: {
95
- baseUrl?: string;
96
- path?: Record<string, unknown>;
97
- query?: Record<string, unknown>;
98
- querySerializer: QuerySerializer;
99
- url: string;
100
- }) => {
101
- const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
102
- let url = (baseUrl ?? "") + pathUrl;
103
- if (path) {
104
- url = defaultPathSerializer({ path, url });
105
- }
106
- let search = query ? querySerializer(query) : "";
107
- if (search.startsWith("?")) {
108
- search = search.substring(1);
109
- }
110
- if (search) {
111
- url += `?${search}`;
112
- }
113
- return url;
114
- };
115
-
116
- export function getValidRequestBody(options: {
117
- body?: unknown;
118
- bodySerializer?: BodySerializer | null;
119
- serializedBody?: unknown;
120
- }) {
121
- const hasBody = options.body !== undefined;
122
- const isSerializedBody = hasBody && options.bodySerializer;
123
-
124
- if (isSerializedBody) {
125
- if ("serializedBody" in options) {
126
- const hasSerializedBody =
127
- options.serializedBody !== undefined && options.serializedBody !== "";
128
-
129
- return hasSerializedBody ? options.serializedBody : null;
130
- }
131
-
132
- // not all clients implement a serializedBody property (i.e. client-axios)
133
- return options.body !== "" ? options.body : null;
134
- }
135
-
136
- // plain/text body
137
- if (hasBody) {
138
- return options.body;
139
- }
140
-
141
- // no body was provided
142
- return undefined;
143
- }
package/src/hey-api.ts DELETED
@@ -1,8 +0,0 @@
1
- import { parseEnv } from "@townco/env";
2
- import type { CreateClientConfig } from "@/client.gen";
3
-
4
- export const createClientConfig: CreateClientConfig = (config) => ({
5
- ...config,
6
- baseUrl: "https://api.supabase.com",
7
- auth: () => parseEnv().SUPABASE_ACCESS_TOKEN,
8
- });