@compass-labs/api-sdk 2.2.64-rc.0 → 2.2.65-rc.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 (95) hide show
  1. package/dist/commonjs/lib/config.d.ts +2 -2
  2. package/dist/commonjs/lib/config.js +2 -2
  3. package/dist/commonjs/lib/encodings.js +12 -12
  4. package/dist/commonjs/lib/encodings.js.map +1 -1
  5. package/dist/commonjs/lib/matchers.js +3 -3
  6. package/dist/commonjs/lib/matchers.js.map +1 -1
  7. package/dist/commonjs/lib/primitives.d.ts +1 -0
  8. package/dist/commonjs/lib/primitives.d.ts.map +1 -1
  9. package/dist/commonjs/lib/primitives.js +18 -0
  10. package/dist/commonjs/lib/primitives.js.map +1 -1
  11. package/dist/commonjs/lib/retries.js +7 -0
  12. package/dist/commonjs/lib/retries.js.map +1 -1
  13. package/dist/commonjs/models/components/compassapibackendv2modelstokenizedassetsreadresponsepositionsposition.d.ts +5 -0
  14. package/dist/commonjs/models/components/compassapibackendv2modelstokenizedassetsreadresponsepositionsposition.d.ts.map +1 -1
  15. package/dist/commonjs/models/components/compassapibackendv2modelstokenizedassetsreadresponsepositionsposition.js +2 -0
  16. package/dist/commonjs/models/components/compassapibackendv2modelstokenizedassetsreadresponsepositionsposition.js.map +1 -1
  17. package/dist/commonjs/models/components/index.d.ts +1 -0
  18. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  19. package/dist/commonjs/models/components/index.js +1 -0
  20. package/dist/commonjs/models/components/index.js.map +1 -1
  21. package/dist/commonjs/models/components/tokenizedassetspnl.d.ts +43 -0
  22. package/dist/commonjs/models/components/tokenizedassetspnl.d.ts.map +1 -0
  23. package/dist/commonjs/models/components/tokenizedassetspnl.js +65 -0
  24. package/dist/commonjs/models/components/tokenizedassetspnl.js.map +1 -0
  25. package/dist/commonjs/models/components/tokenizedassetspositionsresponse.d.ts +5 -0
  26. package/dist/commonjs/models/components/tokenizedassetspositionsresponse.d.ts.map +1 -1
  27. package/dist/commonjs/models/components/tokenizedassetspositionsresponse.js +2 -0
  28. package/dist/commonjs/models/components/tokenizedassetspositionsresponse.js.map +1 -1
  29. package/dist/esm/lib/config.d.ts +2 -2
  30. package/dist/esm/lib/config.js +2 -2
  31. package/dist/esm/lib/encodings.js +1 -1
  32. package/dist/esm/lib/encodings.js.map +1 -1
  33. package/dist/esm/lib/matchers.js +1 -1
  34. package/dist/esm/lib/matchers.js.map +1 -1
  35. package/dist/esm/lib/primitives.d.ts +1 -0
  36. package/dist/esm/lib/primitives.d.ts.map +1 -1
  37. package/dist/esm/lib/primitives.js +17 -0
  38. package/dist/esm/lib/primitives.js.map +1 -1
  39. package/dist/esm/lib/retries.js +7 -0
  40. package/dist/esm/lib/retries.js.map +1 -1
  41. package/dist/esm/models/components/compassapibackendv2modelstokenizedassetsreadresponsepositionsposition.d.ts +5 -0
  42. package/dist/esm/models/components/compassapibackendv2modelstokenizedassetsreadresponsepositionsposition.d.ts.map +1 -1
  43. package/dist/esm/models/components/compassapibackendv2modelstokenizedassetsreadresponsepositionsposition.js +2 -0
  44. package/dist/esm/models/components/compassapibackendv2modelstokenizedassetsreadresponsepositionsposition.js.map +1 -1
  45. package/dist/esm/models/components/index.d.ts +1 -0
  46. package/dist/esm/models/components/index.d.ts.map +1 -1
  47. package/dist/esm/models/components/index.js +1 -0
  48. package/dist/esm/models/components/index.js.map +1 -1
  49. package/dist/esm/models/components/tokenizedassetspnl.d.ts +43 -0
  50. package/dist/esm/models/components/tokenizedassetspnl.d.ts.map +1 -0
  51. package/dist/esm/models/components/tokenizedassetspnl.js +28 -0
  52. package/dist/esm/models/components/tokenizedassetspnl.js.map +1 -0
  53. package/dist/esm/models/components/tokenizedassetspositionsresponse.d.ts +5 -0
  54. package/dist/esm/models/components/tokenizedassetspositionsresponse.d.ts.map +1 -1
  55. package/dist/esm/models/components/tokenizedassetspositionsresponse.js +2 -0
  56. package/dist/esm/models/components/tokenizedassetspositionsresponse.js.map +1 -1
  57. package/docs/models/components/compassapibackendv2modelstokenizedassetsreadresponsepositionsposition.md +2 -1
  58. package/docs/models/components/tokenizedassetspnl.md +34 -0
  59. package/docs/models/components/tokenizedassetspositionsresponse.md +2 -1
  60. package/examples/node_modules/@esbuild/linux-x64/bin/esbuild +0 -0
  61. package/examples/node_modules/@esbuild/linux-x64/package.json +1 -1
  62. package/examples/node_modules/esbuild/bin/esbuild +1 -1
  63. package/examples/node_modules/esbuild/install.js +2 -2
  64. package/examples/node_modules/esbuild/lib/main.js +8 -8
  65. package/examples/node_modules/esbuild/package.json +50 -50
  66. package/examples/package-lock.json +107 -107
  67. package/openapi_prepped_for_speakeasy.json +67 -0
  68. package/package.json +1 -1
  69. package/src/lib/config.ts +2 -2
  70. package/src/lib/encodings.ts +1 -1
  71. package/src/lib/matchers.ts +1 -1
  72. package/src/lib/primitives.ts +16 -0
  73. package/src/lib/retries.ts +8 -0
  74. package/src/models/components/compassapibackendv2modelstokenizedassetsreadresponsepositionsposition.ts +9 -0
  75. package/src/models/components/index.ts +1 -0
  76. package/src/models/components/tokenizedassetspnl.ts +79 -0
  77. package/src/models/components/tokenizedassetspositionsresponse.ts +9 -0
  78. package/dist/commonjs/lib/dlv.d.ts +0 -14
  79. package/dist/commonjs/lib/dlv.d.ts.map +0 -1
  80. package/dist/commonjs/lib/dlv.js +0 -49
  81. package/dist/commonjs/lib/dlv.js.map +0 -1
  82. package/dist/commonjs/lib/is-plain-object.d.ts +0 -2
  83. package/dist/commonjs/lib/is-plain-object.d.ts.map +0 -1
  84. package/dist/commonjs/lib/is-plain-object.js +0 -41
  85. package/dist/commonjs/lib/is-plain-object.js.map +0 -1
  86. package/dist/esm/lib/dlv.d.ts +0 -14
  87. package/dist/esm/lib/dlv.d.ts.map +0 -1
  88. package/dist/esm/lib/dlv.js +0 -46
  89. package/dist/esm/lib/dlv.js.map +0 -1
  90. package/dist/esm/lib/is-plain-object.d.ts +0 -2
  91. package/dist/esm/lib/is-plain-object.d.ts.map +0 -1
  92. package/dist/esm/lib/is-plain-object.js +0 -38
  93. package/dist/esm/lib/is-plain-object.js.map +0 -1
  94. package/src/lib/dlv.ts +0 -53
  95. package/src/lib/is-plain-object.ts +0 -43
@@ -0,0 +1,79 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ /**
12
+ * Realized + unrealized PnL for a tokenized-asset position.
13
+ *
14
+ * @remarks
15
+ *
16
+ * Mirrors Earn's ``pnl`` shape so SDK/widget reuse is trivial. Cost basis is
17
+ * the USDC paid for the position through its product account; ``current_value``
18
+ * marks the held balance to the current price. All amounts are USD decimal
19
+ * strings; ``total_pnl_percent`` is a percentage (also a decimal string).
20
+ */
21
+ export type TokenizedAssetsPnl = {
22
+ /**
23
+ * Total USDC paid for this position over all time.
24
+ */
25
+ totalDeposited: string;
26
+ /**
27
+ * Current USD value of the held balance (`balance * current_price_usd`).
28
+ */
29
+ currentValue: string;
30
+ /**
31
+ * `current_value` minus the remaining cost basis.
32
+ */
33
+ unrealizedPnl: string;
34
+ /**
35
+ * Realized profit/loss banked from past sales.
36
+ */
37
+ realizedPnl: string;
38
+ /**
39
+ * `unrealized_pnl + realized_pnl`.
40
+ */
41
+ totalPnl: string;
42
+ /**
43
+ * `(total_pnl / total_deposited) * 100`.
44
+ */
45
+ totalPnlPercent: string;
46
+ };
47
+
48
+ /** @internal */
49
+ export const TokenizedAssetsPnl$inboundSchema: z.ZodType<
50
+ TokenizedAssetsPnl,
51
+ z.ZodTypeDef,
52
+ unknown
53
+ > = z.object({
54
+ total_deposited: z.string(),
55
+ current_value: z.string(),
56
+ unrealized_pnl: z.string(),
57
+ realized_pnl: z.string(),
58
+ total_pnl: z.string(),
59
+ total_pnl_percent: z.string(),
60
+ }).transform((v) => {
61
+ return remap$(v, {
62
+ "total_deposited": "totalDeposited",
63
+ "current_value": "currentValue",
64
+ "unrealized_pnl": "unrealizedPnl",
65
+ "realized_pnl": "realizedPnl",
66
+ "total_pnl": "totalPnl",
67
+ "total_pnl_percent": "totalPnlPercent",
68
+ });
69
+ });
70
+
71
+ export function tokenizedAssetsPnlFromJSON(
72
+ jsonString: string,
73
+ ): SafeParseResult<TokenizedAssetsPnl, SDKValidationError> {
74
+ return safeParse(
75
+ jsonString,
76
+ (x) => TokenizedAssetsPnl$inboundSchema.parse(JSON.parse(x)),
77
+ `Failed to parse 'TokenizedAssetsPnl' from JSON`,
78
+ );
79
+ }
@@ -11,6 +11,10 @@ import {
11
11
  CompassApiBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition,
12
12
  CompassApiBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition$inboundSchema,
13
13
  } from "./compassapibackendv2modelstokenizedassetsreadresponsepositionsposition.js";
14
+ import {
15
+ TokenizedAssetsPnl,
16
+ TokenizedAssetsPnl$inboundSchema,
17
+ } from "./tokenizedassetspnl.js";
14
18
 
15
19
  /**
16
20
  * On-chain tokenized-equity holdings for an owner's Tokenized Assets Account.
@@ -32,6 +36,10 @@ export type TokenizedAssetsPositionsResponse = {
32
36
  * Sum of `balance_usd` across positions where the price is known.
33
37
  */
34
38
  totalUsd: string;
39
+ /**
40
+ * Account-level PnL summed across positions that have a known PnL; `null` when no position can be priced.
41
+ */
42
+ pnl?: TokenizedAssetsPnl | null | undefined;
35
43
  };
36
44
 
37
45
  /** @internal */
@@ -45,6 +53,7 @@ export const TokenizedAssetsPositionsResponse$inboundSchema: z.ZodType<
45
53
  CompassApiBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition$inboundSchema,
46
54
  ).optional(),
47
55
  total_usd: z.string(),
56
+ pnl: z.nullable(TokenizedAssetsPnl$inboundSchema).optional(),
48
57
  }).transform((v) => {
49
58
  return remap$(v, {
50
59
  "total_usd": "totalUsd",
@@ -1,14 +0,0 @@
1
- /**
2
- * @param obj The object to walk
3
- * @param key The key path to walk the object with
4
- * @param def A default value to return if the result is undefined
5
- *
6
- * @example
7
- * dlv(obj, "a.b.c.d")
8
- * @example
9
- * dlv(object, ["a", "b", "c", "d"])
10
- * @example
11
- * dlv(object, "foo.bar.baz", "Hello, default value!")
12
- */
13
- export declare function dlv<T = any>(obj: any, key: string | string[], def?: T, p?: number, undef?: never): T | undefined;
14
- //# sourceMappingURL=dlv.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dlv.d.ts","sourceRoot":"","sources":["../../../src/lib/dlv.ts"],"names":[],"mappings":"AA2BA;;;;;;;;;;;GAWG;AACH,wBAAgB,GAAG,CAAC,CAAC,GAAG,GAAG,EACzB,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EACtB,GAAG,CAAC,EAAE,CAAC,EACP,CAAC,CAAC,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,KAAK,GACZ,CAAC,GAAG,SAAS,CAOf"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- /*
3
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.dlv = dlv;
7
- /*
8
- MIT License
9
-
10
- Copyright (c) 2024 Jason Miller <jason@developit.ca> (http://jasonformat.com)
11
-
12
- Permission is hereby granted, free of charge, to any person obtaining a copy of
13
- this software and associated documentation files (the "Software"), to deal in
14
- the Software without restriction, including without limitation the rights to
15
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
16
- the Software, and to permit persons to whom the Software is furnished to do so,
17
- subject to the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included in all
20
- copies or substantial portions of the Software.
21
-
22
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
24
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
25
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
26
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
- */
29
- /**
30
- * @param obj The object to walk
31
- * @param key The key path to walk the object with
32
- * @param def A default value to return if the result is undefined
33
- *
34
- * @example
35
- * dlv(obj, "a.b.c.d")
36
- * @example
37
- * dlv(object, ["a", "b", "c", "d"])
38
- * @example
39
- * dlv(object, "foo.bar.baz", "Hello, default value!")
40
- */
41
- function dlv(obj, key, def, p, undef) {
42
- key = Array.isArray(key) ? key : key.split(".");
43
- for (p = 0; p < key.length; p++) {
44
- const k = key[p];
45
- obj = k != null && obj ? obj[k] : undef;
46
- }
47
- return obj === undef ? def : obj;
48
- }
49
- //# sourceMappingURL=dlv.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dlv.js","sourceRoot":"","sources":["../../../src/lib/dlv.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAqCH,kBAaC;AAhDD;;;;;;;;;;;;;;;;;;;;;EAqBE;AAEF;;;;;;;;;;;GAWG;AACH,SAAgB,GAAG,CACjB,GAAQ,EACR,GAAsB,EACtB,GAAO,EACP,CAAU,EACV,KAAa;IAEb,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChD,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACjB,GAAG,GAAG,CAAC,IAAI,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1C,CAAC;IACD,OAAO,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACnC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function isPlainObject(value: unknown): value is object;
2
- //# sourceMappingURL=is-plain-object.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-plain-object.d.ts","sourceRoot":"","sources":["../../../src/lib/is-plain-object.ts"],"names":[],"mappings":"AA6BA,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAa7D"}
@@ -1,41 +0,0 @@
1
- "use strict";
2
- /*
3
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isPlainObject = isPlainObject;
7
- /*
8
- MIT License
9
-
10
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
11
-
12
- Permission is hereby granted, free of charge, to any person obtaining a copy of
13
- this software and associated documentation files (the "Software"), to deal in
14
- the Software without restriction, including without limitation the rights to
15
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
16
- the Software, and to permit persons to whom the Software is furnished to do so,
17
- subject to the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included in all
20
- copies or substantial portions of the Software.
21
-
22
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
24
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
25
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
26
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
- */
29
- // Taken from https://github.com/sindresorhus/is-plain-obj/blob/97f38e8836f86a642cce98fc6ab3058bc36df181/index.js
30
- function isPlainObject(value) {
31
- if (typeof value !== "object" || value === null) {
32
- return false;
33
- }
34
- const prototype = Object.getPrototypeOf(value);
35
- return ((prototype === null ||
36
- prototype === Object.prototype ||
37
- Object.getPrototypeOf(prototype) === null) &&
38
- !(Symbol.toStringTag in value) &&
39
- !(Symbol.iterator in value));
40
- }
41
- //# sourceMappingURL=is-plain-object.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-plain-object.js","sourceRoot":"","sources":["../../../src/lib/is-plain-object.ts"],"names":[],"mappings":";AAAA;;GAEG;;AA2BH,sCAaC;AAtCD;;;;;;;;;;;;;;;;;;;;;EAqBE;AAEF,iHAAiH;AAEjH,SAAgB,aAAa,CAAC,KAAc;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,CACL,CAAC,SAAS,KAAK,IAAI;QACjB,SAAS,KAAK,MAAM,CAAC,SAAS;QAC9B,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;QAC5C,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,KAAK,CAAC;QAC9B,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC,CAC5B,CAAC;AACJ,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * @param obj The object to walk
3
- * @param key The key path to walk the object with
4
- * @param def A default value to return if the result is undefined
5
- *
6
- * @example
7
- * dlv(obj, "a.b.c.d")
8
- * @example
9
- * dlv(object, ["a", "b", "c", "d"])
10
- * @example
11
- * dlv(object, "foo.bar.baz", "Hello, default value!")
12
- */
13
- export declare function dlv<T = any>(obj: any, key: string | string[], def?: T, p?: number, undef?: never): T | undefined;
14
- //# sourceMappingURL=dlv.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dlv.d.ts","sourceRoot":"","sources":["../../../src/lib/dlv.ts"],"names":[],"mappings":"AA2BA;;;;;;;;;;;GAWG;AACH,wBAAgB,GAAG,CAAC,CAAC,GAAG,GAAG,EACzB,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EACtB,GAAG,CAAC,EAAE,CAAC,EACP,CAAC,CAAC,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,KAAK,GACZ,CAAC,GAAG,SAAS,CAOf"}
@@ -1,46 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
- /*
5
- MIT License
6
-
7
- Copyright (c) 2024 Jason Miller <jason@developit.ca> (http://jasonformat.com)
8
-
9
- Permission is hereby granted, free of charge, to any person obtaining a copy of
10
- this software and associated documentation files (the "Software"), to deal in
11
- the Software without restriction, including without limitation the rights to
12
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
13
- the Software, and to permit persons to whom the Software is furnished to do so,
14
- subject to the following conditions:
15
-
16
- The above copyright notice and this permission notice shall be included in all
17
- copies or substantial portions of the Software.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
21
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
22
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
23
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
- */
26
- /**
27
- * @param obj The object to walk
28
- * @param key The key path to walk the object with
29
- * @param def A default value to return if the result is undefined
30
- *
31
- * @example
32
- * dlv(obj, "a.b.c.d")
33
- * @example
34
- * dlv(object, ["a", "b", "c", "d"])
35
- * @example
36
- * dlv(object, "foo.bar.baz", "Hello, default value!")
37
- */
38
- export function dlv(obj, key, def, p, undef) {
39
- key = Array.isArray(key) ? key : key.split(".");
40
- for (p = 0; p < key.length; p++) {
41
- const k = key[p];
42
- obj = k != null && obj ? obj[k] : undef;
43
- }
44
- return obj === undef ? def : obj;
45
- }
46
- //# sourceMappingURL=dlv.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dlv.js","sourceRoot":"","sources":["../../../src/lib/dlv.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;EAqBE;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,GAAG,CACjB,GAAQ,EACR,GAAsB,EACtB,GAAO,EACP,CAAU,EACV,KAAa;IAEb,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChD,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACjB,GAAG,GAAG,CAAC,IAAI,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1C,CAAC;IACD,OAAO,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACnC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function isPlainObject(value: unknown): value is object;
2
- //# sourceMappingURL=is-plain-object.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-plain-object.d.ts","sourceRoot":"","sources":["../../../src/lib/is-plain-object.ts"],"names":[],"mappings":"AA6BA,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAa7D"}
@@ -1,38 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
- /*
5
- MIT License
6
-
7
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
8
-
9
- Permission is hereby granted, free of charge, to any person obtaining a copy of
10
- this software and associated documentation files (the "Software"), to deal in
11
- the Software without restriction, including without limitation the rights to
12
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
13
- the Software, and to permit persons to whom the Software is furnished to do so,
14
- subject to the following conditions:
15
-
16
- The above copyright notice and this permission notice shall be included in all
17
- copies or substantial portions of the Software.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
21
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
22
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
23
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
- */
26
- // Taken from https://github.com/sindresorhus/is-plain-obj/blob/97f38e8836f86a642cce98fc6ab3058bc36df181/index.js
27
- export function isPlainObject(value) {
28
- if (typeof value !== "object" || value === null) {
29
- return false;
30
- }
31
- const prototype = Object.getPrototypeOf(value);
32
- return ((prototype === null ||
33
- prototype === Object.prototype ||
34
- Object.getPrototypeOf(prototype) === null) &&
35
- !(Symbol.toStringTag in value) &&
36
- !(Symbol.iterator in value));
37
- }
38
- //# sourceMappingURL=is-plain-object.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-plain-object.js","sourceRoot":"","sources":["../../../src/lib/is-plain-object.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;EAqBE;AAEF,iHAAiH;AAEjH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,CACL,CAAC,SAAS,KAAK,IAAI;QACjB,SAAS,KAAK,MAAM,CAAC,SAAS;QAC9B,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;QAC5C,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,KAAK,CAAC;QAC9B,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC,CAC5B,CAAC;AACJ,CAAC"}
package/src/lib/dlv.ts DELETED
@@ -1,53 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- /*
6
- MIT License
7
-
8
- Copyright (c) 2024 Jason Miller <jason@developit.ca> (http://jasonformat.com)
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy of
11
- this software and associated documentation files (the "Software"), to deal in
12
- the Software without restriction, including without limitation the rights to
13
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
14
- the Software, and to permit persons to whom the Software is furnished to do so,
15
- subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
22
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
23
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
- */
27
-
28
- /**
29
- * @param obj The object to walk
30
- * @param key The key path to walk the object with
31
- * @param def A default value to return if the result is undefined
32
- *
33
- * @example
34
- * dlv(obj, "a.b.c.d")
35
- * @example
36
- * dlv(object, ["a", "b", "c", "d"])
37
- * @example
38
- * dlv(object, "foo.bar.baz", "Hello, default value!")
39
- */
40
- export function dlv<T = any>(
41
- obj: any,
42
- key: string | string[],
43
- def?: T,
44
- p?: number,
45
- undef?: never,
46
- ): T | undefined {
47
- key = Array.isArray(key) ? key : key.split(".");
48
- for (p = 0; p < key.length; p++) {
49
- const k = key[p];
50
- obj = k != null && obj ? obj[k] : undef;
51
- }
52
- return obj === undef ? def : obj;
53
- }
@@ -1,43 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- /*
6
- MIT License
7
-
8
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy of
11
- this software and associated documentation files (the "Software"), to deal in
12
- the Software without restriction, including without limitation the rights to
13
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
14
- the Software, and to permit persons to whom the Software is furnished to do so,
15
- subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
22
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
23
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
- */
27
-
28
- // Taken from https://github.com/sindresorhus/is-plain-obj/blob/97f38e8836f86a642cce98fc6ab3058bc36df181/index.js
29
-
30
- export function isPlainObject(value: unknown): value is object {
31
- if (typeof value !== "object" || value === null) {
32
- return false;
33
- }
34
-
35
- const prototype = Object.getPrototypeOf(value);
36
- return (
37
- (prototype === null ||
38
- prototype === Object.prototype ||
39
- Object.getPrototypeOf(prototype) === null) &&
40
- !(Symbol.toStringTag in value) &&
41
- !(Symbol.iterator in value)
42
- );
43
- }