@naturalpay/sdk 0.4.0 → 0.5.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 (118) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/client.d.mts +7 -16
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +7 -16
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -12
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -12
  9. package/client.mjs.map +1 -1
  10. package/internal/tslib.js +17 -17
  11. package/internal/utils/query.d.mts +3 -0
  12. package/internal/utils/query.d.mts.map +1 -1
  13. package/internal/utils/query.d.ts +3 -0
  14. package/internal/utils/query.d.ts.map +1 -1
  15. package/internal/utils/query.js +16 -3
  16. package/internal/utils/query.js.map +1 -1
  17. package/internal/utils/query.mjs +16 -2
  18. package/internal/utils/query.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/resources/agents.d.mts +554 -268
  21. package/resources/agents.d.mts.map +1 -1
  22. package/resources/agents.d.ts +554 -268
  23. package/resources/agents.d.ts.map +1 -1
  24. package/resources/agents.js +72 -20
  25. package/resources/agents.js.map +1 -1
  26. package/resources/agents.mjs +72 -20
  27. package/resources/agents.mjs.map +1 -1
  28. package/resources/customers.d.mts +243 -114
  29. package/resources/customers.d.mts.map +1 -1
  30. package/resources/customers.d.ts +243 -114
  31. package/resources/customers.d.ts.map +1 -1
  32. package/resources/customers.js +6 -7
  33. package/resources/customers.js.map +1 -1
  34. package/resources/customers.mjs +6 -7
  35. package/resources/customers.mjs.map +1 -1
  36. package/resources/index.d.mts +2 -4
  37. package/resources/index.d.mts.map +1 -1
  38. package/resources/index.d.ts +2 -4
  39. package/resources/index.d.ts.map +1 -1
  40. package/resources/index.js +1 -5
  41. package/resources/index.js.map +1 -1
  42. package/resources/index.mjs +0 -2
  43. package/resources/index.mjs.map +1 -1
  44. package/src/client.ts +23 -60
  45. package/src/internal/utils/query.ts +18 -2
  46. package/src/resources/agents.ts +676 -300
  47. package/src/resources/customers.ts +273 -132
  48. package/src/resources/index.ts +10 -24
  49. package/src/version.ts +1 -1
  50. package/version.d.mts +1 -1
  51. package/version.d.ts +1 -1
  52. package/version.js +1 -1
  53. package/version.mjs +1 -1
  54. package/internal/qs/formats.d.mts +0 -7
  55. package/internal/qs/formats.d.mts.map +0 -1
  56. package/internal/qs/formats.d.ts +0 -7
  57. package/internal/qs/formats.d.ts.map +0 -1
  58. package/internal/qs/formats.js +0 -13
  59. package/internal/qs/formats.js.map +0 -1
  60. package/internal/qs/formats.mjs +0 -9
  61. package/internal/qs/formats.mjs.map +0 -1
  62. package/internal/qs/index.d.mts +0 -10
  63. package/internal/qs/index.d.mts.map +0 -1
  64. package/internal/qs/index.d.ts +0 -10
  65. package/internal/qs/index.d.ts.map +0 -1
  66. package/internal/qs/index.js +0 -14
  67. package/internal/qs/index.js.map +0 -1
  68. package/internal/qs/index.mjs +0 -10
  69. package/internal/qs/index.mjs.map +0 -1
  70. package/internal/qs/stringify.d.mts +0 -3
  71. package/internal/qs/stringify.d.mts.map +0 -1
  72. package/internal/qs/stringify.d.ts +0 -3
  73. package/internal/qs/stringify.d.ts.map +0 -1
  74. package/internal/qs/stringify.js +0 -277
  75. package/internal/qs/stringify.js.map +0 -1
  76. package/internal/qs/stringify.mjs +0 -274
  77. package/internal/qs/stringify.mjs.map +0 -1
  78. package/internal/qs/types.d.mts +0 -57
  79. package/internal/qs/types.d.mts.map +0 -1
  80. package/internal/qs/types.d.ts +0 -57
  81. package/internal/qs/types.d.ts.map +0 -1
  82. package/internal/qs/types.js +0 -3
  83. package/internal/qs/types.js.map +0 -1
  84. package/internal/qs/types.mjs +0 -2
  85. package/internal/qs/types.mjs.map +0 -1
  86. package/internal/qs/utils.d.mts +0 -15
  87. package/internal/qs/utils.d.mts.map +0 -1
  88. package/internal/qs/utils.d.ts +0 -15
  89. package/internal/qs/utils.d.ts.map +0 -1
  90. package/internal/qs/utils.js +0 -230
  91. package/internal/qs/utils.js.map +0 -1
  92. package/internal/qs/utils.mjs +0 -217
  93. package/internal/qs/utils.mjs.map +0 -1
  94. package/resources/delegations.d.mts +0 -458
  95. package/resources/delegations.d.mts.map +0 -1
  96. package/resources/delegations.d.ts +0 -458
  97. package/resources/delegations.d.ts.map +0 -1
  98. package/resources/delegations.js +0 -47
  99. package/resources/delegations.js.map +0 -1
  100. package/resources/delegations.mjs +0 -43
  101. package/resources/delegations.mjs.map +0 -1
  102. package/resources/escalations.d.mts +0 -1124
  103. package/resources/escalations.d.mts.map +0 -1
  104. package/resources/escalations.d.ts +0 -1124
  105. package/resources/escalations.d.ts.map +0 -1
  106. package/resources/escalations.js +0 -110
  107. package/resources/escalations.js.map +0 -1
  108. package/resources/escalations.mjs +0 -106
  109. package/resources/escalations.mjs.map +0 -1
  110. package/src/internal/qs/LICENSE.md +0 -13
  111. package/src/internal/qs/README.md +0 -3
  112. package/src/internal/qs/formats.ts +0 -10
  113. package/src/internal/qs/index.ts +0 -13
  114. package/src/internal/qs/stringify.ts +0 -385
  115. package/src/internal/qs/types.ts +0 -71
  116. package/src/internal/qs/utils.ts +0 -265
  117. package/src/resources/delegations.ts +0 -580
  118. package/src/resources/escalations.ts +0 -1422
package/internal/tslib.js CHANGED
@@ -1,10 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.__setModuleDefault = exports.__createBinding = void 0;
4
- exports.__importStar = __importStar;
5
4
  exports.__classPrivateFieldSet = __classPrivateFieldSet;
6
5
  exports.__classPrivateFieldGet = __classPrivateFieldGet;
6
+ exports.__importStar = __importStar;
7
7
  exports.__exportStar = __exportStar;
8
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
9
+ if (kind === "m")
10
+ throw new TypeError("Private method is not writable");
11
+ if (kind === "a" && !f)
12
+ throw new TypeError("Private accessor was defined without a setter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
14
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
15
+ return kind === "a" ? f.call(receiver, value) : f ? (f.value = value) : state.set(receiver, value), value;
16
+ }
17
+ function __classPrivateFieldGet(receiver, state, kind, f) {
18
+ if (kind === "a" && !f)
19
+ throw new TypeError("Private accessor was defined without a getter");
20
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
21
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
22
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
23
+ }
8
24
  var __createBinding = Object.create
9
25
  ? function (o, m, k, k2) {
10
26
  if (k2 === void 0)
@@ -58,22 +74,6 @@ function __importStar(mod) {
58
74
  __setModuleDefault(result, mod);
59
75
  return result;
60
76
  }
61
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
62
- if (kind === "m")
63
- throw new TypeError("Private method is not writable");
64
- if (kind === "a" && !f)
65
- throw new TypeError("Private accessor was defined without a setter");
66
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
67
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
68
- return kind === "a" ? f.call(receiver, value) : f ? (f.value = value) : state.set(receiver, value), value;
69
- }
70
- function __classPrivateFieldGet(receiver, state, kind, f) {
71
- if (kind === "a" && !f)
72
- throw new TypeError("Private accessor was defined without a getter");
73
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
74
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
75
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
76
- }
77
77
  function __exportStar(m, o) {
78
78
  for (var p in m)
79
79
  if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
@@ -1,2 +1,5 @@
1
+ /**
2
+ * Basic re-implementation of `qs.stringify` for primitive types.
3
+ */
1
4
  export declare function stringifyQuery(query: object | Record<string, unknown>): string;
2
5
  //# sourceMappingURL=query.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.mts","sourceRoot":"","sources":["../../src/internal/utils/query.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAErE"}
1
+ {"version":3,"file":"query.d.mts","sourceRoot":"","sources":["../../src/internal/utils/query.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAerE"}
@@ -1,2 +1,5 @@
1
+ /**
2
+ * Basic re-implementation of `qs.stringify` for primitive types.
3
+ */
1
4
  export declare function stringifyQuery(query: object | Record<string, unknown>): string;
2
5
  //# sourceMappingURL=query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/internal/utils/query.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAErE"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/internal/utils/query.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAerE"}
@@ -2,9 +2,22 @@
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.stringifyQuery = stringifyQuery;
5
- const tslib_1 = require("../tslib.js");
6
- const qs = tslib_1.__importStar(require("../qs/stringify.js"));
5
+ const error_1 = require("../../core/error.js");
6
+ /**
7
+ * Basic re-implementation of `qs.stringify` for primitive types.
8
+ */
7
9
  function stringifyQuery(query) {
8
- return qs.stringify(query, { arrayFormat: 'comma' });
10
+ return Object.entries(query)
11
+ .filter(([_, value]) => typeof value !== 'undefined')
12
+ .map(([key, value]) => {
13
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
14
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
15
+ }
16
+ if (value === null) {
17
+ return `${encodeURIComponent(key)}=`;
18
+ }
19
+ throw new error_1.NaturalError(`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`);
20
+ })
21
+ .join('&');
9
22
  }
10
23
  //# sourceMappingURL=query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/internal/utils/query.ts"],"names":[],"mappings":";AAAA,sFAAsF;;AAItF,wCAEC;;AAJD,+DAAsC;AAEtC,SAAgB,cAAc,CAAC,KAAuC;IACpE,OAAO,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;AACvD,CAAC"}
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/internal/utils/query.ts"],"names":[],"mappings":";AAAA,sFAAsF;;AAOtF,wCAeC;AApBD,+CAAgD;AAEhD;;GAEG;AACH,SAAgB,cAAc,CAAC,KAAuC;IACpE,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;SACzB,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,WAAW,CAAC;SACpD,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACpB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YACzF,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QACnE,CAAC;QACD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC;QACvC,CAAC;QACD,MAAM,IAAI,oBAAY,CACpB,yBAAyB,OAAO,KAAK,mQAAmQ,CACzS,CAAC;IACJ,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
@@ -1,6 +1,20 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import * as qs from "../qs/stringify.mjs";
2
+ import { NaturalError } from "../../core/error.mjs";
3
+ /**
4
+ * Basic re-implementation of `qs.stringify` for primitive types.
5
+ */
3
6
  export function stringifyQuery(query) {
4
- return qs.stringify(query, { arrayFormat: 'comma' });
7
+ return Object.entries(query)
8
+ .filter(([_, value]) => typeof value !== 'undefined')
9
+ .map(([key, value]) => {
10
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
11
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
12
+ }
13
+ if (value === null) {
14
+ return `${encodeURIComponent(key)}=`;
15
+ }
16
+ throw new NaturalError(`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`);
17
+ })
18
+ .join('&');
5
19
  }
6
20
  //# sourceMappingURL=query.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.mjs","sourceRoot":"","sources":["../../src/internal/utils/query.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,KAAK,EAAE,4BAAwB;AAEtC,MAAM,UAAU,cAAc,CAAC,KAAuC;IACpE,OAAO,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;AACvD,CAAC"}
1
+ {"version":3,"file":"query.mjs","sourceRoot":"","sources":["../../src/internal/utils/query.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,YAAY,EAAE,6BAAyB;AAEhD;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAuC;IACpE,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;SACzB,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,WAAW,CAAC;SACpD,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACpB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YACzF,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QACnE,CAAC;QACD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC;QACvC,CAAC;QACD,MAAM,IAAI,YAAY,CACpB,yBAAyB,OAAO,KAAK,mQAAmQ,CACzS,CAAC;IACJ,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalpay/sdk",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "The official TypeScript library for the Naturalpay API",
5
5
  "author": "Naturalpay <hi@natural.co>",
6
6
  "types": "./index.d.ts",