partnermax 0.2.0 → 0.2.1

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 (74) hide show
  1. package/CHANGELOG.md +60 -47
  2. package/LICENSE +201 -201
  3. package/README.md +370 -370
  4. package/api-promise.js +1 -1
  5. package/client.js +1 -1
  6. package/client.mjs +1 -1
  7. package/core/api-promise.js +1 -1
  8. package/core/api-promise.mjs +1 -1
  9. package/error.js +1 -1
  10. package/package.json +9 -15
  11. package/resource.js +1 -1
  12. package/resources/dealers/dealers.js +1 -1
  13. package/resources/dealers/nlt/nlt.js +1 -1
  14. package/resources/dealers/nlt.js +1 -1
  15. package/resources/dealers/vehicles/vehicles.js +1 -1
  16. package/resources/dealers/vehicles.js +1 -1
  17. package/resources/dealers.js +1 -1
  18. package/resources.js +1 -1
  19. package/src/api-promise.ts +2 -2
  20. package/src/client.ts +841 -841
  21. package/src/core/README.md +3 -3
  22. package/src/core/api-promise.ts +92 -92
  23. package/src/core/error.ts +130 -130
  24. package/src/core/resource.ts +11 -11
  25. package/src/core/uploads.ts +2 -2
  26. package/src/error.ts +2 -2
  27. package/src/index.ts +22 -22
  28. package/src/internal/README.md +3 -3
  29. package/src/internal/builtin-types.ts +93 -93
  30. package/src/internal/detect-platform.ts +196 -196
  31. package/src/internal/errors.ts +33 -33
  32. package/src/internal/headers.ts +97 -97
  33. package/src/internal/parse.ts +56 -56
  34. package/src/internal/request-options.ts +91 -91
  35. package/src/internal/shim-types.ts +26 -26
  36. package/src/internal/shims.ts +107 -107
  37. package/src/internal/to-file.ts +154 -154
  38. package/src/internal/types.ts +93 -93
  39. package/src/internal/uploads.ts +187 -187
  40. package/src/internal/utils/base64.ts +40 -40
  41. package/src/internal/utils/bytes.ts +32 -32
  42. package/src/internal/utils/env.ts +18 -18
  43. package/src/internal/utils/log.ts +128 -128
  44. package/src/internal/utils/path.ts +88 -88
  45. package/src/internal/utils/query.ts +23 -23
  46. package/src/internal/utils/sleep.ts +3 -3
  47. package/src/internal/utils/uuid.ts +17 -17
  48. package/src/internal/utils/values.ts +105 -105
  49. package/src/internal/utils.ts +9 -9
  50. package/src/lib/.keep +4 -4
  51. package/src/resource.ts +2 -2
  52. package/src/resources/dealers/dealers.ts +348 -348
  53. package/src/resources/dealers/index.ts +28 -28
  54. package/src/resources/dealers/nlt/index.ts +11 -11
  55. package/src/resources/dealers/nlt/nlt.ts +29 -29
  56. package/src/resources/dealers/nlt/offers.ts +427 -427
  57. package/src/resources/dealers/nlt-settings.ts +269 -269
  58. package/src/resources/dealers/nlt.ts +3 -3
  59. package/src/resources/dealers/vehicles/images.ts +153 -153
  60. package/src/resources/dealers/vehicles/index.ts +25 -25
  61. package/src/resources/dealers/vehicles/vehicles.ts +796 -796
  62. package/src/resources/dealers/vehicles.ts +3 -3
  63. package/src/resources/dealers.ts +3 -3
  64. package/src/resources/index.ts +12 -12
  65. package/src/resources/keys.ts +128 -128
  66. package/src/resources.ts +1 -1
  67. package/src/tsconfig.json +11 -11
  68. package/src/uploads.ts +2 -2
  69. package/src/version.ts +1 -1
  70. package/uploads.js +1 -1
  71. package/version.d.mts +1 -1
  72. package/version.d.ts +1 -1
  73. package/version.js +1 -1
  74. package/version.mjs +1 -1
@@ -1,3 +1,3 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export const sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export const sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
@@ -1,17 +1,17 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- /**
4
- * https://stackoverflow.com/a/2117523
5
- */
6
- export let uuid4 = function () {
7
- const { crypto } = globalThis as any;
8
- if (crypto?.randomUUID) {
9
- uuid4 = crypto.randomUUID.bind(crypto);
10
- return crypto.randomUUID();
11
- }
12
- const u8 = new Uint8Array(1);
13
- const randomByte = crypto ? () => crypto.getRandomValues(u8)[0]! : () => (Math.random() * 0xff) & 0xff;
14
- return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, (c) =>
15
- (+c ^ (randomByte() & (15 >> (+c / 4)))).toString(16),
16
- );
17
- };
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ /**
4
+ * https://stackoverflow.com/a/2117523
5
+ */
6
+ export let uuid4 = function () {
7
+ const { crypto } = globalThis as any;
8
+ if (crypto?.randomUUID) {
9
+ uuid4 = crypto.randomUUID.bind(crypto);
10
+ return crypto.randomUUID();
11
+ }
12
+ const u8 = new Uint8Array(1);
13
+ const randomByte = crypto ? () => crypto.getRandomValues(u8)[0]! : () => (Math.random() * 0xff) & 0xff;
14
+ return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, (c) =>
15
+ (+c ^ (randomByte() & (15 >> (+c / 4)))).toString(16),
16
+ );
17
+ };
@@ -1,105 +1,105 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { PartnermaxError } from '../../core/error';
4
-
5
- // https://url.spec.whatwg.org/#url-scheme-string
6
- const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
7
-
8
- export const isAbsoluteURL = (url: string): boolean => {
9
- return startsWithSchemeRegexp.test(url);
10
- };
11
-
12
- export let isArray = (val: unknown): val is unknown[] => ((isArray = Array.isArray), isArray(val));
13
- export let isReadonlyArray = isArray as (val: unknown) => val is readonly unknown[];
14
-
15
- /** Returns an object if the given value isn't an object, otherwise returns as-is */
16
- export function maybeObj(x: unknown): object {
17
- if (typeof x !== 'object') {
18
- return {};
19
- }
20
-
21
- return x ?? {};
22
- }
23
-
24
- // https://stackoverflow.com/a/34491287
25
- export function isEmptyObj(obj: Object | null | undefined): boolean {
26
- if (!obj) return true;
27
- for (const _k in obj) return false;
28
- return true;
29
- }
30
-
31
- // https://eslint.org/docs/latest/rules/no-prototype-builtins
32
- export function hasOwn<T extends object = object>(obj: T, key: PropertyKey): key is keyof T {
33
- return Object.prototype.hasOwnProperty.call(obj, key);
34
- }
35
-
36
- export function isObj(obj: unknown): obj is Record<string, unknown> {
37
- return obj != null && typeof obj === 'object' && !Array.isArray(obj);
38
- }
39
-
40
- export const ensurePresent = <T>(value: T | null | undefined): T => {
41
- if (value == null) {
42
- throw new PartnermaxError(`Expected a value to be given but received ${value} instead.`);
43
- }
44
-
45
- return value;
46
- };
47
-
48
- export const validatePositiveInteger = (name: string, n: unknown): number => {
49
- if (typeof n !== 'number' || !Number.isInteger(n)) {
50
- throw new PartnermaxError(`${name} must be an integer`);
51
- }
52
- if (n < 0) {
53
- throw new PartnermaxError(`${name} must be a positive integer`);
54
- }
55
- return n;
56
- };
57
-
58
- export const coerceInteger = (value: unknown): number => {
59
- if (typeof value === 'number') return Math.round(value);
60
- if (typeof value === 'string') return parseInt(value, 10);
61
-
62
- throw new PartnermaxError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
63
- };
64
-
65
- export const coerceFloat = (value: unknown): number => {
66
- if (typeof value === 'number') return value;
67
- if (typeof value === 'string') return parseFloat(value);
68
-
69
- throw new PartnermaxError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
70
- };
71
-
72
- export const coerceBoolean = (value: unknown): boolean => {
73
- if (typeof value === 'boolean') return value;
74
- if (typeof value === 'string') return value === 'true';
75
- return Boolean(value);
76
- };
77
-
78
- export const maybeCoerceInteger = (value: unknown): number | undefined => {
79
- if (value == null) {
80
- return undefined;
81
- }
82
- return coerceInteger(value);
83
- };
84
-
85
- export const maybeCoerceFloat = (value: unknown): number | undefined => {
86
- if (value == null) {
87
- return undefined;
88
- }
89
- return coerceFloat(value);
90
- };
91
-
92
- export const maybeCoerceBoolean = (value: unknown): boolean | undefined => {
93
- if (value == null) {
94
- return undefined;
95
- }
96
- return coerceBoolean(value);
97
- };
98
-
99
- export const safeJSON = (text: string) => {
100
- try {
101
- return JSON.parse(text);
102
- } catch (err) {
103
- return undefined;
104
- }
105
- };
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { PartnermaxError } from '../../core/error';
4
+
5
+ // https://url.spec.whatwg.org/#url-scheme-string
6
+ const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
7
+
8
+ export const isAbsoluteURL = (url: string): boolean => {
9
+ return startsWithSchemeRegexp.test(url);
10
+ };
11
+
12
+ export let isArray = (val: unknown): val is unknown[] => ((isArray = Array.isArray), isArray(val));
13
+ export let isReadonlyArray = isArray as (val: unknown) => val is readonly unknown[];
14
+
15
+ /** Returns an object if the given value isn't an object, otherwise returns as-is */
16
+ export function maybeObj(x: unknown): object {
17
+ if (typeof x !== 'object') {
18
+ return {};
19
+ }
20
+
21
+ return x ?? {};
22
+ }
23
+
24
+ // https://stackoverflow.com/a/34491287
25
+ export function isEmptyObj(obj: Object | null | undefined): boolean {
26
+ if (!obj) return true;
27
+ for (const _k in obj) return false;
28
+ return true;
29
+ }
30
+
31
+ // https://eslint.org/docs/latest/rules/no-prototype-builtins
32
+ export function hasOwn<T extends object = object>(obj: T, key: PropertyKey): key is keyof T {
33
+ return Object.prototype.hasOwnProperty.call(obj, key);
34
+ }
35
+
36
+ export function isObj(obj: unknown): obj is Record<string, unknown> {
37
+ return obj != null && typeof obj === 'object' && !Array.isArray(obj);
38
+ }
39
+
40
+ export const ensurePresent = <T>(value: T | null | undefined): T => {
41
+ if (value == null) {
42
+ throw new PartnermaxError(`Expected a value to be given but received ${value} instead.`);
43
+ }
44
+
45
+ return value;
46
+ };
47
+
48
+ export const validatePositiveInteger = (name: string, n: unknown): number => {
49
+ if (typeof n !== 'number' || !Number.isInteger(n)) {
50
+ throw new PartnermaxError(`${name} must be an integer`);
51
+ }
52
+ if (n < 0) {
53
+ throw new PartnermaxError(`${name} must be a positive integer`);
54
+ }
55
+ return n;
56
+ };
57
+
58
+ export const coerceInteger = (value: unknown): number => {
59
+ if (typeof value === 'number') return Math.round(value);
60
+ if (typeof value === 'string') return parseInt(value, 10);
61
+
62
+ throw new PartnermaxError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
63
+ };
64
+
65
+ export const coerceFloat = (value: unknown): number => {
66
+ if (typeof value === 'number') return value;
67
+ if (typeof value === 'string') return parseFloat(value);
68
+
69
+ throw new PartnermaxError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
70
+ };
71
+
72
+ export const coerceBoolean = (value: unknown): boolean => {
73
+ if (typeof value === 'boolean') return value;
74
+ if (typeof value === 'string') return value === 'true';
75
+ return Boolean(value);
76
+ };
77
+
78
+ export const maybeCoerceInteger = (value: unknown): number | undefined => {
79
+ if (value == null) {
80
+ return undefined;
81
+ }
82
+ return coerceInteger(value);
83
+ };
84
+
85
+ export const maybeCoerceFloat = (value: unknown): number | undefined => {
86
+ if (value == null) {
87
+ return undefined;
88
+ }
89
+ return coerceFloat(value);
90
+ };
91
+
92
+ export const maybeCoerceBoolean = (value: unknown): boolean | undefined => {
93
+ if (value == null) {
94
+ return undefined;
95
+ }
96
+ return coerceBoolean(value);
97
+ };
98
+
99
+ export const safeJSON = (text: string) => {
100
+ try {
101
+ return JSON.parse(text);
102
+ } catch (err) {
103
+ return undefined;
104
+ }
105
+ };
@@ -1,9 +1,9 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export * from './utils/values';
4
- export * from './utils/base64';
5
- export * from './utils/env';
6
- export * from './utils/log';
7
- export * from './utils/uuid';
8
- export * from './utils/sleep';
9
- export * from './utils/query';
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './utils/values';
4
+ export * from './utils/base64';
5
+ export * from './utils/env';
6
+ export * from './utils/log';
7
+ export * from './utils/uuid';
8
+ export * from './utils/sleep';
9
+ export * from './utils/query';
package/src/lib/.keep CHANGED
@@ -1,4 +1,4 @@
1
- File generated from our OpenAPI spec by Stainless.
2
-
3
- This directory can be used to store custom files to expand the SDK.
4
- It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.
1
+ File generated from our OpenAPI spec by Stainless.
2
+
3
+ This directory can be used to store custom files to expand the SDK.
4
+ It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.
package/src/resource.ts CHANGED
@@ -1,2 +1,2 @@
1
- /** @deprecated Import from ./core/resource instead */
2
- export * from './core/resource';
1
+ /** @deprecated Import from ./core/resource instead */
2
+ export * from './core/resource';