agentmail 0.0.78 → 0.1.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 (88) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/apiKeys/client/Client.d.ts +1 -2
  3. package/dist/cjs/api/resources/apiKeys/client/Client.js +62 -52
  4. package/dist/cjs/api/resources/domains/client/Client.d.ts +1 -2
  5. package/dist/cjs/api/resources/domains/client/Client.js +62 -52
  6. package/dist/cjs/api/resources/drafts/client/Client.d.ts +1 -2
  7. package/dist/cjs/api/resources/drafts/client/Client.js +83 -70
  8. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +1 -2
  9. package/dist/cjs/api/resources/inboxes/client/Client.js +62 -52
  10. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +1 -2
  11. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +83 -70
  12. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +1 -2
  13. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +83 -70
  14. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +1 -2
  15. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +83 -70
  16. package/dist/cjs/api/resources/pods/client/Client.d.ts +1 -2
  17. package/dist/cjs/api/resources/pods/client/Client.js +62 -52
  18. package/dist/cjs/api/resources/pods/resources/domains/client/Client.d.ts +1 -2
  19. package/dist/cjs/api/resources/pods/resources/domains/client/Client.js +83 -70
  20. package/dist/cjs/api/resources/pods/resources/drafts/client/Client.d.ts +1 -2
  21. package/dist/cjs/api/resources/pods/resources/drafts/client/Client.js +83 -70
  22. package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.d.ts +1 -2
  23. package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.js +83 -70
  24. package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +1 -2
  25. package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +83 -70
  26. package/dist/cjs/api/resources/threads/client/Client.d.ts +1 -2
  27. package/dist/cjs/api/resources/threads/client/Client.js +83 -70
  28. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +1 -2
  29. package/dist/cjs/api/resources/webhooks/client/Client.js +62 -52
  30. package/dist/cjs/core/index.d.ts +2 -0
  31. package/dist/cjs/core/index.js +2 -0
  32. package/dist/cjs/core/pagination/Page.d.ts +32 -0
  33. package/dist/cjs/core/pagination/Page.js +100 -0
  34. package/dist/cjs/core/pagination/Pageable.d.ts +14 -0
  35. package/dist/cjs/core/pagination/Pageable.js +10 -0
  36. package/dist/cjs/core/pagination/index.d.ts +2 -0
  37. package/dist/cjs/core/pagination/index.js +7 -0
  38. package/dist/cjs/core/utils/index.d.ts +1 -0
  39. package/dist/cjs/core/utils/index.js +5 -0
  40. package/dist/cjs/core/utils/setObjectProperty.d.ts +11 -0
  41. package/dist/cjs/core/utils/setObjectProperty.js +42 -0
  42. package/dist/cjs/version.d.ts +1 -1
  43. package/dist/cjs/version.js +1 -1
  44. package/dist/esm/Client.mjs +2 -2
  45. package/dist/esm/api/resources/apiKeys/client/Client.d.mts +1 -2
  46. package/dist/esm/api/resources/apiKeys/client/Client.mjs +62 -52
  47. package/dist/esm/api/resources/domains/client/Client.d.mts +1 -2
  48. package/dist/esm/api/resources/domains/client/Client.mjs +62 -52
  49. package/dist/esm/api/resources/drafts/client/Client.d.mts +1 -2
  50. package/dist/esm/api/resources/drafts/client/Client.mjs +83 -70
  51. package/dist/esm/api/resources/inboxes/client/Client.d.mts +1 -2
  52. package/dist/esm/api/resources/inboxes/client/Client.mjs +62 -52
  53. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +1 -2
  54. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +83 -70
  55. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +1 -2
  56. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +83 -70
  57. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +1 -2
  58. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +83 -70
  59. package/dist/esm/api/resources/pods/client/Client.d.mts +1 -2
  60. package/dist/esm/api/resources/pods/client/Client.mjs +62 -52
  61. package/dist/esm/api/resources/pods/resources/domains/client/Client.d.mts +1 -2
  62. package/dist/esm/api/resources/pods/resources/domains/client/Client.mjs +83 -70
  63. package/dist/esm/api/resources/pods/resources/drafts/client/Client.d.mts +1 -2
  64. package/dist/esm/api/resources/pods/resources/drafts/client/Client.mjs +83 -70
  65. package/dist/esm/api/resources/pods/resources/inboxes/client/Client.d.mts +1 -2
  66. package/dist/esm/api/resources/pods/resources/inboxes/client/Client.mjs +83 -70
  67. package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +1 -2
  68. package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +83 -70
  69. package/dist/esm/api/resources/threads/client/Client.d.mts +1 -2
  70. package/dist/esm/api/resources/threads/client/Client.mjs +83 -70
  71. package/dist/esm/api/resources/webhooks/client/Client.d.mts +1 -2
  72. package/dist/esm/api/resources/webhooks/client/Client.mjs +62 -52
  73. package/dist/esm/core/index.d.mts +2 -0
  74. package/dist/esm/core/index.mjs +2 -0
  75. package/dist/esm/core/pagination/Page.d.mts +32 -0
  76. package/dist/esm/core/pagination/Page.mjs +96 -0
  77. package/dist/esm/core/pagination/Pageable.d.mts +14 -0
  78. package/dist/esm/core/pagination/Pageable.mjs +6 -0
  79. package/dist/esm/core/pagination/index.d.mts +2 -0
  80. package/dist/esm/core/pagination/index.mjs +2 -0
  81. package/dist/esm/core/utils/index.d.mts +1 -0
  82. package/dist/esm/core/utils/index.mjs +1 -0
  83. package/dist/esm/core/utils/setObjectProperty.d.mts +11 -0
  84. package/dist/esm/core/utils/setObjectProperty.mjs +39 -0
  85. package/dist/esm/version.d.mts +1 -1
  86. package/dist/esm/version.mjs +1 -1
  87. package/package.json +1 -1
  88. package/reference.md +154 -28
@@ -25,64 +25,74 @@ export class Webhooks {
25
25
  * @example
26
26
  * await client.webhooks.list()
27
27
  */
28
- list(request = {}, requestOptions) {
29
- return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
30
- }
31
- __list() {
28
+ list() {
32
29
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
33
- var _a, _b, _c, _d, _e, _f, _g, _h;
34
- const { limit, pageToken } = request;
35
- const _queryParams = {};
36
- if (limit != null) {
37
- _queryParams.limit = limit.toString();
38
- }
39
- if (pageToken != null) {
40
- _queryParams.page_token = pageToken;
41
- }
42
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
43
- const _response = yield core.fetcher({
44
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, "/v0/webhooks"),
45
- method: "GET",
46
- headers: _headers,
47
- queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
48
- timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
49
- maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
50
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
51
- });
52
- if (_response.ok) {
53
- return {
54
- data: serializers.webhooks.ListWebhooksResponse.parseOrThrow(_response.body, {
55
- unrecognizedObjectKeys: "passthrough",
56
- allowUnrecognizedUnionMembers: true,
57
- allowUnrecognizedEnumValues: true,
58
- skipValidation: true,
59
- breadcrumbsPrefix: ["response"],
60
- }),
61
- rawResponse: _response.rawResponse,
62
- };
63
- }
64
- if (_response.error.reason === "status-code") {
65
- throw new errors.AgentMailError({
66
- statusCode: _response.error.statusCode,
67
- body: _response.error.body,
68
- rawResponse: _response.rawResponse,
30
+ const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
31
+ var _a, _b, _c, _d, _e, _f, _g, _h;
32
+ const { limit, pageToken } = request;
33
+ const _queryParams = {};
34
+ if (limit != null) {
35
+ _queryParams.limit = limit.toString();
36
+ }
37
+ if (pageToken != null) {
38
+ _queryParams.page_token = pageToken;
39
+ }
40
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
41
+ const _response = yield core.fetcher({
42
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, "/v0/webhooks"),
43
+ method: "GET",
44
+ headers: _headers,
45
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
46
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
47
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
48
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
69
49
  });
70
- }
71
- switch (_response.error.reason) {
72
- case "non-json":
73
- throw new errors.AgentMailError({
74
- statusCode: _response.error.statusCode,
75
- body: _response.error.rawBody,
50
+ if (_response.ok) {
51
+ return {
52
+ data: serializers.webhooks.ListWebhooksResponse.parseOrThrow(_response.body, {
53
+ unrecognizedObjectKeys: "passthrough",
54
+ allowUnrecognizedUnionMembers: true,
55
+ allowUnrecognizedEnumValues: true,
56
+ skipValidation: true,
57
+ breadcrumbsPrefix: ["response"],
58
+ }),
76
59
  rawResponse: _response.rawResponse,
77
- });
78
- case "timeout":
79
- throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/webhooks.");
80
- case "unknown":
60
+ };
61
+ }
62
+ if (_response.error.reason === "status-code") {
81
63
  throw new errors.AgentMailError({
82
- message: _response.error.errorMessage,
64
+ statusCode: _response.error.statusCode,
65
+ body: _response.error.body,
83
66
  rawResponse: _response.rawResponse,
84
67
  });
85
- }
68
+ }
69
+ switch (_response.error.reason) {
70
+ case "non-json":
71
+ throw new errors.AgentMailError({
72
+ statusCode: _response.error.statusCode,
73
+ body: _response.error.rawBody,
74
+ rawResponse: _response.rawResponse,
75
+ });
76
+ case "timeout":
77
+ throw new errors.AgentMailTimeoutError("Timeout exceeded when calling GET /v0/webhooks.");
78
+ case "unknown":
79
+ throw new errors.AgentMailError({
80
+ message: _response.error.errorMessage,
81
+ rawResponse: _response.rawResponse,
82
+ });
83
+ }
84
+ }));
85
+ const dataWithRawResponse = yield list(request).withRawResponse();
86
+ return new core.Pageable({
87
+ response: dataWithRawResponse.data,
88
+ rawResponse: dataWithRawResponse.rawResponse,
89
+ hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.nextPageToken) != null &&
90
+ !(typeof (response === null || response === void 0 ? void 0 : response.nextPageToken) === "string" && (response === null || response === void 0 ? void 0 : response.nextPageToken) === ""),
91
+ getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.webhooks) !== null && _a !== void 0 ? _a : []; },
92
+ loadPage: (response) => {
93
+ return list(core.setObjectProperty(request, "pageToken", response === null || response === void 0 ? void 0 : response.nextPageToken));
94
+ },
95
+ });
86
96
  });
87
97
  }
88
98
  /**
@@ -1,7 +1,9 @@
1
1
  export * from "./auth/index.mjs";
2
2
  export * from "./base64.mjs";
3
3
  export * from "./fetcher/index.mjs";
4
+ export * from "./pagination/index.mjs";
4
5
  export * from "./runtime/index.mjs";
5
6
  export * as serialization from "./schemas/index.mjs";
6
7
  export * as url from "./url/index.mjs";
8
+ export * from "./utils/index.mjs";
7
9
  export * from "./websocket/index.mjs";
@@ -1,7 +1,9 @@
1
1
  export * from "./auth/index.mjs";
2
2
  export * from "./base64.mjs";
3
3
  export * from "./fetcher/index.mjs";
4
+ export * from "./pagination/index.mjs";
4
5
  export * from "./runtime/index.mjs";
5
6
  export * as serialization from "./schemas/index.mjs";
6
7
  export * as url from "./url/index.mjs";
8
+ export * from "./utils/index.mjs";
7
9
  export * from "./websocket/index.mjs";
@@ -0,0 +1,32 @@
1
+ import type { HttpResponsePromise, RawResponse } from "../fetcher/index.mjs";
2
+ /**
3
+ * A page of results from a paginated API.
4
+ *
5
+ * @template T The type of the items in the page.
6
+ */
7
+ export declare class Page<T> implements AsyncIterable<T> {
8
+ data: T[];
9
+ rawResponse: RawResponse;
10
+ private response;
11
+ private _hasNextPage;
12
+ private getItems;
13
+ private loadNextPage;
14
+ constructor({ response, rawResponse, hasNextPage, getItems, loadPage, }: {
15
+ response: unknown;
16
+ rawResponse: RawResponse;
17
+ hasNextPage: (response: unknown) => boolean;
18
+ getItems: (response: unknown) => T[];
19
+ loadPage: (response: unknown) => HttpResponsePromise<any>;
20
+ });
21
+ /**
22
+ * Retrieves the next page
23
+ * @returns this
24
+ */
25
+ getNextPage(): Promise<this>;
26
+ /**
27
+ * @returns whether there is a next page to load
28
+ */
29
+ hasNextPage(): boolean;
30
+ private iterMessages;
31
+ [Symbol.asyncIterator](): AsyncIterator<T, void, any>;
32
+ }
@@ -0,0 +1,96 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
11
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
12
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
13
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
14
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
15
+ function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
16
+ function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
17
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
18
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
19
+ function fulfill(value) { resume("next", value); }
20
+ function reject(value) { resume("throw", value); }
21
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
22
+ };
23
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
24
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
25
+ var m = o[Symbol.asyncIterator], i;
26
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
27
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
28
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
29
+ };
30
+ /**
31
+ * A page of results from a paginated API.
32
+ *
33
+ * @template T The type of the items in the page.
34
+ */
35
+ export class Page {
36
+ constructor({ response, rawResponse, hasNextPage, getItems, loadPage, }) {
37
+ this.response = response;
38
+ this.rawResponse = rawResponse;
39
+ this.data = getItems(response);
40
+ this._hasNextPage = hasNextPage;
41
+ this.getItems = getItems;
42
+ this.loadNextPage = loadPage;
43
+ }
44
+ /**
45
+ * Retrieves the next page
46
+ * @returns this
47
+ */
48
+ getNextPage() {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const { data, rawResponse } = yield this.loadNextPage(this.response).withRawResponse();
51
+ this.response = data;
52
+ this.rawResponse = rawResponse;
53
+ this.data = this.getItems(this.response);
54
+ return this;
55
+ });
56
+ }
57
+ /**
58
+ * @returns whether there is a next page to load
59
+ */
60
+ hasNextPage() {
61
+ return this._hasNextPage(this.response);
62
+ }
63
+ iterMessages() {
64
+ return __asyncGenerator(this, arguments, function* iterMessages_1() {
65
+ for (const item of this.data) {
66
+ yield yield __await(item);
67
+ }
68
+ while (this.hasNextPage()) {
69
+ yield __await(this.getNextPage());
70
+ for (const item of this.data) {
71
+ yield yield __await(item);
72
+ }
73
+ }
74
+ });
75
+ }
76
+ [Symbol.asyncIterator]() {
77
+ return __asyncGenerator(this, arguments, function* _a() {
78
+ var _b, e_1, _c, _d;
79
+ try {
80
+ for (var _e = true, _f = __asyncValues(this.iterMessages()), _g; _g = yield __await(_f.next()), _b = _g.done, !_b; _e = true) {
81
+ _d = _g.value;
82
+ _e = false;
83
+ const message = _d;
84
+ yield yield __await(message);
85
+ }
86
+ }
87
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
88
+ finally {
89
+ try {
90
+ if (!_e && !_b && (_c = _f.return)) yield __await(_c.call(_f));
91
+ }
92
+ finally { if (e_1) throw e_1.error; }
93
+ }
94
+ });
95
+ }
96
+ }
@@ -0,0 +1,14 @@
1
+ import type { RawResponse } from "../fetcher/index.mjs";
2
+ import { Page } from "./Page.mjs";
3
+ export declare namespace Pageable {
4
+ interface Args<Response, Item> {
5
+ response: Response;
6
+ rawResponse: RawResponse;
7
+ hasNextPage: (response: Response) => boolean;
8
+ getItems: (response: Response) => Item[];
9
+ loadPage: (response: Response) => Promise<Response>;
10
+ }
11
+ }
12
+ export declare class Pageable<R, T> extends Page<T> {
13
+ constructor(args: Pageable.Args<R, T>);
14
+ }
@@ -0,0 +1,6 @@
1
+ import { Page } from "./Page.mjs";
2
+ export class Pageable extends Page {
3
+ constructor(args) {
4
+ super(args);
5
+ }
6
+ }
@@ -0,0 +1,2 @@
1
+ export { Page } from "./Page.mjs";
2
+ export { Pageable } from "./Pageable.mjs";
@@ -0,0 +1,2 @@
1
+ export { Page } from "./Page.mjs";
2
+ export { Pageable } from "./Pageable.mjs";
@@ -0,0 +1 @@
1
+ export { setObjectProperty } from "./setObjectProperty.mjs";
@@ -0,0 +1 @@
1
+ export { setObjectProperty } from "./setObjectProperty.mjs";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Sets the value at path of object. If a portion of path doesn’t exist it’s created. This is
3
+ * inspired by Lodash's set function, but is simplified to accommodate our use case.
4
+ * For more details, see https://lodash.com/docs/4.17.15#set.
5
+ *
6
+ * @param object The object to modify.
7
+ * @param path The path of the property to set.
8
+ * @param value The value to set.
9
+ * @return Returns object.
10
+ */
11
+ export declare function setObjectProperty<T extends object>(object: T, path: string, value: any): T;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Sets the value at path of object. If a portion of path doesn’t exist it’s created. This is
3
+ * inspired by Lodash's set function, but is simplified to accommodate our use case.
4
+ * For more details, see https://lodash.com/docs/4.17.15#set.
5
+ *
6
+ * @param object The object to modify.
7
+ * @param path The path of the property to set.
8
+ * @param value The value to set.
9
+ * @return Returns object.
10
+ */
11
+ export function setObjectProperty(object, path, value) {
12
+ if (object == null) {
13
+ return object;
14
+ }
15
+ const keys = path.split(".");
16
+ if (keys.length === 0) {
17
+ // Invalid path; do nothing.
18
+ return object;
19
+ }
20
+ let current = object;
21
+ for (let i = 0; i < keys.length - 1; i++) {
22
+ const key = keys[i];
23
+ if (key == null) {
24
+ // Unreachable.
25
+ continue;
26
+ }
27
+ if (!current[key] || typeof current[key] !== "object") {
28
+ current[key] = {};
29
+ }
30
+ current = current[key];
31
+ }
32
+ const lastKey = keys[keys.length - 1];
33
+ if (lastKey == null) {
34
+ // Unreachable.
35
+ return object;
36
+ }
37
+ current[lastKey] = value;
38
+ return object;
39
+ }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.78";
1
+ export declare const SDK_VERSION = "0.1.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.0.78";
1
+ export const SDK_VERSION = "0.1.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentmail",
3
- "version": "0.0.78",
3
+ "version": "0.1.0",
4
4
  "private": false,
5
5
  "repository": "github:agentmail-to/agentmail-node",
6
6
  "type": "commonjs",