graphor 0.6.0 → 0.8.0

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 (99) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +1 -1
  3. package/client.d.mts +9 -9
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +9 -9
  6. package/client.d.ts.map +1 -1
  7. package/client.js +34 -34
  8. package/client.js.map +1 -1
  9. package/client.mjs +32 -32
  10. package/client.mjs.map +1 -1
  11. package/core/api-promise.d.mts +2 -2
  12. package/core/api-promise.d.mts.map +1 -1
  13. package/core/api-promise.d.ts +2 -2
  14. package/core/api-promise.d.ts.map +1 -1
  15. package/core/api-promise.js.map +1 -1
  16. package/core/api-promise.mjs.map +1 -1
  17. package/core/error.d.mts +2 -2
  18. package/core/error.d.mts.map +1 -1
  19. package/core/error.d.ts +2 -2
  20. package/core/error.d.ts.map +1 -1
  21. package/core/error.js +4 -4
  22. package/core/error.js.map +1 -1
  23. package/core/error.mjs +2 -2
  24. package/core/error.mjs.map +1 -1
  25. package/core/resource.d.mts +3 -3
  26. package/core/resource.d.mts.map +1 -1
  27. package/core/resource.d.ts +3 -3
  28. package/core/resource.d.ts.map +1 -1
  29. package/core/resource.js.map +1 -1
  30. package/core/resource.mjs.map +1 -1
  31. package/index.d.mts +3 -3
  32. package/index.d.mts.map +1 -1
  33. package/index.d.ts +3 -3
  34. package/index.d.ts.map +1 -1
  35. package/index.js +4 -4
  36. package/index.js.map +1 -1
  37. package/index.mjs +3 -3
  38. package/index.mjs.map +1 -1
  39. package/internal/parse.d.mts +2 -2
  40. package/internal/parse.d.mts.map +1 -1
  41. package/internal/parse.d.ts +2 -2
  42. package/internal/parse.d.ts.map +1 -1
  43. package/internal/parse.js.map +1 -1
  44. package/internal/parse.mjs.map +1 -1
  45. package/internal/shims.js +1 -1
  46. package/internal/shims.js.map +1 -1
  47. package/internal/shims.mjs +1 -1
  48. package/internal/shims.mjs.map +1 -1
  49. package/internal/uploads.d.mts +4 -4
  50. package/internal/uploads.d.mts.map +1 -1
  51. package/internal/uploads.d.ts +4 -4
  52. package/internal/uploads.d.ts.map +1 -1
  53. package/internal/uploads.js.map +1 -1
  54. package/internal/uploads.mjs.map +1 -1
  55. package/internal/utils/base64.js +2 -2
  56. package/internal/utils/base64.js.map +1 -1
  57. package/internal/utils/base64.mjs +3 -3
  58. package/internal/utils/base64.mjs.map +1 -1
  59. package/internal/utils/log.d.mts +3 -3
  60. package/internal/utils/log.d.mts.map +1 -1
  61. package/internal/utils/log.d.ts +3 -3
  62. package/internal/utils/log.d.ts.map +1 -1
  63. package/internal/utils/log.js.map +1 -1
  64. package/internal/utils/log.mjs.map +1 -1
  65. package/internal/utils/path.js +1 -1
  66. package/internal/utils/path.js.map +1 -1
  67. package/internal/utils/path.mjs +2 -2
  68. package/internal/utils/path.mjs.map +1 -1
  69. package/internal/utils/values.js +5 -5
  70. package/internal/utils/values.js.map +1 -1
  71. package/internal/utils/values.mjs +6 -6
  72. package/internal/utils/values.mjs.map +1 -1
  73. package/package.json +3 -3
  74. package/resources/sources.d.mts +418 -60
  75. package/resources/sources.d.mts.map +1 -1
  76. package/resources/sources.d.ts +418 -60
  77. package/resources/sources.d.ts.map +1 -1
  78. package/resources/sources.js +348 -19
  79. package/resources/sources.js.map +1 -1
  80. package/resources/sources.mjs +348 -19
  81. package/resources/sources.mjs.map +1 -1
  82. package/src/client.ts +16 -16
  83. package/src/core/api-promise.ts +4 -4
  84. package/src/core/error.ts +2 -2
  85. package/src/core/resource.ts +3 -3
  86. package/src/index.ts +3 -3
  87. package/src/internal/parse.ts +2 -2
  88. package/src/internal/shims.ts +1 -1
  89. package/src/internal/uploads.ts +5 -5
  90. package/src/internal/utils/base64.ts +3 -3
  91. package/src/internal/utils/log.ts +3 -3
  92. package/src/internal/utils/path.ts +2 -2
  93. package/src/internal/utils/values.ts +6 -6
  94. package/src/resources/sources.ts +418 -60
  95. package/src/version.ts +1 -1
  96. package/version.d.mts +1 -1
  97. package/version.d.ts +1 -1
  98. package/version.js +1 -1
  99. package/version.mjs +1 -1
@@ -1,6 +1,6 @@
1
1
  import { type RequestOptions } from './request-options';
2
2
  import type { FilePropertyBag, Fetch } from './builtin-types';
3
- import type { GraphorPrd } from '../client';
3
+ import type { Graphor } from '../client';
4
4
  import { ReadableStreamFrom } from './shims';
5
5
 
6
6
  export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView;
@@ -74,7 +74,7 @@ export const isAsyncIterable = (value: any): value is AsyncIterable<any> =>
74
74
  */
75
75
  export const maybeMultipartFormRequestOptions = async (
76
76
  opts: RequestOptions,
77
- fetch: GraphorPrd | Fetch,
77
+ fetch: Graphor | Fetch,
78
78
  ): Promise<RequestOptions> => {
79
79
  if (!hasUploadableValue(opts.body)) return opts;
80
80
 
@@ -85,7 +85,7 @@ type MultipartFormRequestOptions = Omit<RequestOptions, 'body'> & { body: unknow
85
85
 
86
86
  export const multipartFormRequestOptions = async (
87
87
  opts: MultipartFormRequestOptions,
88
- fetch: GraphorPrd | Fetch,
88
+ fetch: Graphor | Fetch,
89
89
  ): Promise<RequestOptions> => {
90
90
  return { ...opts, body: await createForm(opts.body, fetch) };
91
91
  };
@@ -98,7 +98,7 @@ const supportsFormDataMap = /* @__PURE__ */ new WeakMap<Fetch, Promise<boolean>>
98
98
  * This function detects if the fetch function provided supports the global FormData object to avoid
99
99
  * confusing error messages later on.
100
100
  */
101
- function supportsFormData(fetchObject: GraphorPrd | Fetch): Promise<boolean> {
101
+ function supportsFormData(fetchObject: Graphor | Fetch): Promise<boolean> {
102
102
  const fetch: Fetch = typeof fetchObject === 'function' ? fetchObject : (fetchObject as any).fetch;
103
103
  const cached = supportsFormDataMap.get(fetch);
104
104
  if (cached) return cached;
@@ -124,7 +124,7 @@ function supportsFormData(fetchObject: GraphorPrd | Fetch): Promise<boolean> {
124
124
 
125
125
  export const createForm = async <T = Record<string, unknown>>(
126
126
  body: T | undefined,
127
- fetch: GraphorPrd | Fetch,
127
+ fetch: Graphor | Fetch,
128
128
  ): Promise<FormData> => {
129
129
  if (!(await supportsFormData(fetch))) {
130
130
  throw new TypeError(
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { GraphorPrdError } from '../../core/error';
3
+ import { GraphorError } from '../../core/error';
4
4
  import { encodeUTF8 } from './bytes';
5
5
 
6
6
  export const toBase64 = (data: string | Uint8Array | null | undefined): string => {
@@ -18,7 +18,7 @@ export const toBase64 = (data: string | Uint8Array | null | undefined): string =
18
18
  return btoa(String.fromCharCode.apply(null, data as any));
19
19
  }
20
20
 
21
- throw new GraphorPrdError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
21
+ throw new GraphorError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
22
22
  };
23
23
 
24
24
  export const fromBase64 = (str: string): Uint8Array => {
@@ -36,5 +36,5 @@ export const fromBase64 = (str: string): Uint8Array => {
36
36
  return buf;
37
37
  }
38
38
 
39
- throw new GraphorPrdError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
39
+ throw new GraphorError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
40
40
  };
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { hasOwn } from './values';
4
- import { type GraphorPrd } from '../../client';
4
+ import { type Graphor } from '../../client';
5
5
  import { RequestOptions } from '../request-options';
6
6
 
7
7
  type LogFn = (message: string, ...rest: unknown[]) => void;
@@ -24,7 +24,7 @@ const levelNumbers = {
24
24
  export const parseLogLevel = (
25
25
  maybeLevel: string | undefined,
26
26
  sourceName: string,
27
- client: GraphorPrd,
27
+ client: Graphor,
28
28
  ): LogLevel | undefined => {
29
29
  if (!maybeLevel) {
30
30
  return undefined;
@@ -60,7 +60,7 @@ const noopLogger = {
60
60
 
61
61
  let cachedLoggers = /* @__PURE__ */ new WeakMap<Logger, [LogLevel, Logger]>();
62
62
 
63
- export function loggerFor(client: GraphorPrd): Logger {
63
+ export function loggerFor(client: Graphor): Logger {
64
64
  const logger = client.logger;
65
65
  const logLevel = client.logLevel ?? 'off';
66
66
  if (!logger) {
@@ -1,4 +1,4 @@
1
- import { GraphorPrdError } from '../../core/error';
1
+ import { GraphorError } from '../../core/error';
2
2
 
3
3
  /**
4
4
  * Percent-encode everything that isn't safe to have in a path without encoding safe chars.
@@ -72,7 +72,7 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
72
72
  return acc + spaces + arrows;
73
73
  }, '');
74
74
 
75
- throw new GraphorPrdError(
75
+ throw new GraphorError(
76
76
  `Path parameters result in path with invalid segments:\n${invalidSegments
77
77
  .map((e) => e.error)
78
78
  .join('\n')}\n${path}\n${underline}`,
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { GraphorPrdError } from '../../core/error';
3
+ import { GraphorError } from '../../core/error';
4
4
 
5
5
  // https://url.spec.whatwg.org/#url-scheme-string
6
6
  const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
@@ -39,7 +39,7 @@ export function isObj(obj: unknown): obj is Record<string, unknown> {
39
39
 
40
40
  export const ensurePresent = <T>(value: T | null | undefined): T => {
41
41
  if (value == null) {
42
- throw new GraphorPrdError(`Expected a value to be given but received ${value} instead.`);
42
+ throw new GraphorError(`Expected a value to be given but received ${value} instead.`);
43
43
  }
44
44
 
45
45
  return value;
@@ -47,10 +47,10 @@ export const ensurePresent = <T>(value: T | null | undefined): T => {
47
47
 
48
48
  export const validatePositiveInteger = (name: string, n: unknown): number => {
49
49
  if (typeof n !== 'number' || !Number.isInteger(n)) {
50
- throw new GraphorPrdError(`${name} must be an integer`);
50
+ throw new GraphorError(`${name} must be an integer`);
51
51
  }
52
52
  if (n < 0) {
53
- throw new GraphorPrdError(`${name} must be a positive integer`);
53
+ throw new GraphorError(`${name} must be a positive integer`);
54
54
  }
55
55
  return n;
56
56
  };
@@ -59,14 +59,14 @@ export const coerceInteger = (value: unknown): number => {
59
59
  if (typeof value === 'number') return Math.round(value);
60
60
  if (typeof value === 'string') return parseInt(value, 10);
61
61
 
62
- throw new GraphorPrdError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
62
+ throw new GraphorError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
63
63
  };
64
64
 
65
65
  export const coerceFloat = (value: unknown): number => {
66
66
  if (typeof value === 'number') return value;
67
67
  if (typeof value === 'string') return parseFloat(value);
68
68
 
69
- throw new GraphorPrdError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
69
+ throw new GraphorError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
70
70
  };
71
71
 
72
72
  export const coerceBoolean = (value: unknown): boolean => {