nordlet 0.2.1 → 0.2.3

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/Client.d.ts +3 -0
  2. package/dist/Client.js +28 -24
  3. package/dist/api/resources/account/client/Client.d.ts +155 -0
  4. package/dist/api/resources/account/client/Client.js +587 -0
  5. package/dist/api/resources/account/client/requests/PostV1AccountConsentAcceptRequest.d.ts +11 -0
  6. package/dist/api/resources/account/client/requests/PostV1AccountConsentAcceptRequest.js +3 -0
  7. package/dist/api/resources/account/client/requests/PostV1AccountDeleteRequest.d.ts +9 -0
  8. package/dist/api/resources/account/client/requests/PostV1AccountDeleteRequest.js +3 -0
  9. package/dist/api/resources/account/client/requests/PostV1AccountEmailChangeRequestRequest.d.ts +18 -0
  10. package/dist/api/resources/account/client/requests/PostV1AccountEmailChangeRequestRequest.js +12 -0
  11. package/dist/api/resources/account/client/requests/PostV1AccountExportRequest.d.ts +5 -0
  12. package/dist/api/resources/account/client/requests/PostV1AccountExportRequest.js +3 -0
  13. package/dist/api/resources/account/client/requests/PostV1AccountInvitesAcceptRequest.d.ts +2 -0
  14. package/dist/api/resources/account/client/requests/PostV1AccountLoginLinkRequestRequest.d.ts +2 -0
  15. package/dist/api/resources/account/client/requests/PostV1AccountProfileUpdateRequest.d.ts +7 -0
  16. package/dist/api/resources/account/client/requests/PostV1AccountProfileUpdateRequest.js +3 -0
  17. package/dist/api/resources/account/client/requests/PostV1AccountSessionsListRequest.d.ts +5 -0
  18. package/dist/api/resources/account/client/requests/PostV1AccountSessionsListRequest.js +3 -0
  19. package/dist/api/resources/account/client/requests/PostV1AccountSessionsRevokeOthersRequest.d.ts +5 -0
  20. package/dist/api/resources/account/client/requests/PostV1AccountSessionsRevokeOthersRequest.js +3 -0
  21. package/dist/api/resources/account/client/requests/PostV1AccountSessionsRevokeRequest.d.ts +9 -0
  22. package/dist/api/resources/account/client/requests/PostV1AccountSessionsRevokeRequest.js +3 -0
  23. package/dist/api/resources/account/client/requests/index.d.ts +8 -0
  24. package/dist/api/resources/account/client/requests/index.js +3 -1
  25. package/dist/api/resources/account/types/PostV1AccountConsentAcceptResponse.d.ts +9 -0
  26. package/dist/api/resources/account/types/PostV1AccountConsentAcceptResponse.js +3 -0
  27. package/dist/api/resources/account/types/PostV1AccountDeleteResponse.d.ts +3 -0
  28. package/dist/api/resources/account/types/PostV1AccountDeleteResponse.js +3 -0
  29. package/dist/api/resources/account/types/PostV1AccountEmailChangeRequestResponse.d.ts +3 -0
  30. package/dist/api/resources/account/types/PostV1AccountEmailChangeRequestResponse.js +3 -0
  31. package/dist/api/resources/account/types/PostV1AccountExportResponse.d.ts +77 -0
  32. package/dist/api/resources/account/types/PostV1AccountExportResponse.js +3 -0
  33. package/dist/api/resources/account/types/PostV1AccountMeResponse.d.ts +10 -0
  34. package/dist/api/resources/account/types/PostV1AccountProfileUpdateResponse.d.ts +5 -0
  35. package/dist/api/resources/account/types/PostV1AccountProfileUpdateResponse.js +3 -0
  36. package/dist/api/resources/account/types/PostV1AccountSessionsListResponse.d.ts +15 -0
  37. package/dist/api/resources/account/types/PostV1AccountSessionsListResponse.js +3 -0
  38. package/dist/api/resources/account/types/PostV1AccountSessionsRevokeOthersResponse.d.ts +3 -0
  39. package/dist/api/resources/account/types/PostV1AccountSessionsRevokeOthersResponse.js +3 -0
  40. package/dist/api/resources/account/types/PostV1AccountSessionsRevokeResponse.d.ts +3 -0
  41. package/dist/api/resources/account/types/PostV1AccountSessionsRevokeResponse.js +3 -0
  42. package/dist/api/resources/account/types/index.d.ts +8 -0
  43. package/dist/api/resources/account/types/index.js +8 -0
  44. package/dist/api/resources/hr/client/Client.d.ts +42 -0
  45. package/dist/api/resources/hr/client/Client.js +150 -0
  46. package/dist/api/resources/hr/client/requests/PostV1HrEmployeesAnonymizeRequest.d.ts +9 -0
  47. package/dist/api/resources/hr/client/requests/PostV1HrEmployeesAnonymizeRequest.js +3 -0
  48. package/dist/api/resources/hr/client/requests/PostV1HrEmployeesDeleteRequest.d.ts +9 -0
  49. package/dist/api/resources/hr/client/requests/PostV1HrEmployeesDeleteRequest.js +3 -0
  50. package/dist/api/resources/hr/client/requests/index.d.ts +2 -0
  51. package/dist/api/resources/hr/types/PostV1HrEmployeesAnonymizeResponse.d.ts +35 -0
  52. package/dist/api/resources/hr/types/PostV1HrEmployeesAnonymizeResponse.js +11 -0
  53. package/dist/api/resources/hr/types/PostV1HrEmployeesDeleteResponse.d.ts +3 -0
  54. package/dist/api/resources/hr/types/PostV1HrEmployeesDeleteResponse.js +3 -0
  55. package/dist/api/resources/hr/types/index.d.ts +2 -0
  56. package/dist/api/resources/hr/types/index.js +2 -0
  57. package/dist/api/resources/index.d.ts +3 -0
  58. package/dist/api/resources/index.js +4 -1
  59. package/dist/api/resources/migration/client/Client.d.ts +57 -0
  60. package/dist/api/resources/migration/client/Client.js +203 -0
  61. package/dist/api/resources/migration/client/index.d.ts +1 -0
  62. package/dist/api/resources/migration/client/index.js +17 -0
  63. package/dist/api/resources/migration/client/requests/PostV1MigrationBooksImportRequest.d.ts +196 -0
  64. package/dist/api/resources/migration/client/requests/PostV1MigrationBooksImportRequest.js +40 -0
  65. package/dist/api/resources/migration/client/requests/PostV1MigrationBooksValidateRequest.d.ts +196 -0
  66. package/dist/api/resources/migration/client/requests/PostV1MigrationBooksValidateRequest.js +40 -0
  67. package/dist/api/resources/migration/client/requests/index.d.ts +2 -0
  68. package/dist/api/resources/migration/client/requests/index.js +7 -0
  69. package/dist/api/resources/migration/exports.d.ts +2 -0
  70. package/dist/api/resources/migration/exports.js +21 -0
  71. package/dist/api/resources/migration/index.d.ts +2 -0
  72. package/dist/api/resources/migration/index.js +18 -0
  73. package/dist/api/resources/migration/types/PostV1MigrationBooksImportResponse.d.ts +71 -0
  74. package/dist/api/resources/migration/types/PostV1MigrationBooksImportResponse.js +3 -0
  75. package/dist/api/resources/migration/types/PostV1MigrationBooksValidateResponse.d.ts +71 -0
  76. package/dist/api/resources/migration/types/PostV1MigrationBooksValidateResponse.js +3 -0
  77. package/dist/api/resources/migration/types/index.d.ts +2 -0
  78. package/dist/api/resources/migration/types/index.js +18 -0
  79. package/dist/api/resources/partners/client/Client.d.ts +22 -0
  80. package/dist/api/resources/partners/client/Client.js +76 -0
  81. package/dist/api/resources/partners/client/requests/PostV1PartnersAnonymizeRequest.d.ts +9 -0
  82. package/dist/api/resources/partners/client/requests/PostV1PartnersAnonymizeRequest.js +3 -0
  83. package/dist/api/resources/partners/client/requests/index.d.ts +1 -0
  84. package/dist/api/resources/partners/types/PostV1PartnersAnonymizeResponse.d.ts +4 -0
  85. package/dist/api/resources/partners/types/PostV1PartnersAnonymizeResponse.js +3 -0
  86. package/dist/api/resources/partners/types/index.d.ts +1 -0
  87. package/dist/api/resources/partners/types/index.js +1 -0
  88. package/package.json +1 -1
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PostV1HrEmployeesAnonymizeResponse = void 0;
5
+ var PostV1HrEmployeesAnonymizeResponse;
6
+ (function (PostV1HrEmployeesAnonymizeResponse) {
7
+ PostV1HrEmployeesAnonymizeResponse.Status = {
8
+ Active: "active",
9
+ Terminated: "terminated",
10
+ };
11
+ })(PostV1HrEmployeesAnonymizeResponse || (exports.PostV1HrEmployeesAnonymizeResponse = PostV1HrEmployeesAnonymizeResponse = {}));
@@ -0,0 +1,3 @@
1
+ export interface PostV1HrEmployeesDeleteResponse {
2
+ id: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,10 @@
1
1
  export * from "./PostV1HrContractsCreateResponse.js";
2
2
  export * from "./PostV1HrContractsEndResponse.js";
3
3
  export * from "./PostV1HrContractsListResponse.js";
4
+ export * from "./PostV1HrEmployeesAnonymizeResponse.js";
4
5
  export * from "./PostV1HrEmployeesAttachmentsListResponse.js";
5
6
  export * from "./PostV1HrEmployeesCreateResponse.js";
7
+ export * from "./PostV1HrEmployeesDeleteResponse.js";
6
8
  export * from "./PostV1HrEmployeesGetResponse.js";
7
9
  export * from "./PostV1HrEmployeesListResponse.js";
8
10
  export * from "./PostV1HrEmployeesRecordsCreateResponse.js";
@@ -17,8 +17,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./PostV1HrContractsCreateResponse.js"), exports);
18
18
  __exportStar(require("./PostV1HrContractsEndResponse.js"), exports);
19
19
  __exportStar(require("./PostV1HrContractsListResponse.js"), exports);
20
+ __exportStar(require("./PostV1HrEmployeesAnonymizeResponse.js"), exports);
20
21
  __exportStar(require("./PostV1HrEmployeesAttachmentsListResponse.js"), exports);
21
22
  __exportStar(require("./PostV1HrEmployeesCreateResponse.js"), exports);
23
+ __exportStar(require("./PostV1HrEmployeesDeleteResponse.js"), exports);
22
24
  __exportStar(require("./PostV1HrEmployeesGetResponse.js"), exports);
23
25
  __exportStar(require("./PostV1HrEmployeesListResponse.js"), exports);
24
26
  __exportStar(require("./PostV1HrEmployeesRecordsCreateResponse.js"), exports);
@@ -49,6 +49,9 @@ export * from "./inventory/types/index.js";
49
49
  export * from "./ledger/client/requests/index.js";
50
50
  export * as ledger from "./ledger/index.js";
51
51
  export * from "./ledger/types/index.js";
52
+ export * from "./migration/client/requests/index.js";
53
+ export * as migration from "./migration/index.js";
54
+ export * from "./migration/types/index.js";
52
55
  export * from "./partners/client/requests/index.js";
53
56
  export * as partners from "./partners/index.js";
54
57
  export * from "./partners/types/index.js";
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.webhooks = exports.transport = exports.sales = exports.reports = exports.reference = exports.purchases = exports.public_ = exports.projects = exports.production = exports.pos = exports.payroll = exports.partners = exports.ledger = exports.inventory = exports.hr = exports.fleet = exports.files = exports.ecommerce = exports.declarations = exports.consolidation = exports.catalog = exports.cash = exports.capture = exports.billing = exports.bank = exports.audit = exports.assets = exports.agreements = exports.account = void 0;
39
+ exports.webhooks = exports.transport = exports.sales = exports.reports = exports.reference = exports.purchases = exports.public_ = exports.projects = exports.production = exports.pos = exports.payroll = exports.partners = exports.migration = exports.ledger = exports.inventory = exports.hr = exports.fleet = exports.files = exports.ecommerce = exports.declarations = exports.consolidation = exports.catalog = exports.cash = exports.capture = exports.billing = exports.bank = exports.audit = exports.assets = exports.agreements = exports.account = void 0;
40
40
  __exportStar(require("./account/client/requests/index.js"), exports);
41
41
  exports.account = __importStar(require("./account/index.js"));
42
42
  __exportStar(require("./account/types/index.js"), exports);
@@ -88,6 +88,9 @@ __exportStar(require("./inventory/types/index.js"), exports);
88
88
  __exportStar(require("./ledger/client/requests/index.js"), exports);
89
89
  exports.ledger = __importStar(require("./ledger/index.js"));
90
90
  __exportStar(require("./ledger/types/index.js"), exports);
91
+ __exportStar(require("./migration/client/requests/index.js"), exports);
92
+ exports.migration = __importStar(require("./migration/index.js"));
93
+ __exportStar(require("./migration/types/index.js"), exports);
91
94
  __exportStar(require("./partners/client/requests/index.js"), exports);
92
95
  exports.partners = __importStar(require("./partners/index.js"));
93
96
  __exportStar(require("./partners/types/index.js"), exports);
@@ -0,0 +1,57 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
+ import * as core from "../../../../core/index.js";
4
+ import * as NordletApi from "../../../index.js";
5
+ export declare namespace MigrationClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class MigrationClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<MigrationClient.Options>;
12
+ constructor(options: MigrationClient.Options);
13
+ /**
14
+ * Runs every check the import runs (accounts, partners, balances, open invoices, assets, stock) and returns the same summary and warnings, then rolls everything back. Nothing is stored.
15
+ *
16
+ * @param {NordletApi.PostV1MigrationBooksValidateRequest} request
17
+ * @param {MigrationClient.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link NordletApi.BadRequestError}
20
+ * @throws {@link NordletApi.UnauthorizedError}
21
+ * @throws {@link NordletApi.ForbiddenError}
22
+ * @throws {@link NordletApi.NotFoundError}
23
+ * @throws {@link NordletApi.ConflictError}
24
+ * @throws {@link NordletApi.UnprocessableEntityError}
25
+ * @throws {@link NordletApi.TooManyRequestsError}
26
+ * @throws {@link NordletApi.InternalServerError}
27
+ *
28
+ * @example
29
+ * await client.migration.checkAHistoricalBooksPackageWithoutWritingAnything({
30
+ * cutoverDate: "cutoverDate"
31
+ * })
32
+ */
33
+ checkAHistoricalBooksPackageWithoutWritingAnything(request: NordletApi.PostV1MigrationBooksValidateRequest, requestOptions?: MigrationClient.RequestOptions): core.HttpResponsePromise<NordletApi.PostV1MigrationBooksValidateResponse>;
34
+ private __checkAHistoricalBooksPackageWithoutWritingAnything;
35
+ /**
36
+ * Brings a company over from another system in one call: chart of accounts, partners, items, opening balances (or the full journal history), open customer and supplier invoices, fixed assets with their accumulated depreciation, and stock on hand. The whole package is written in one database transaction — if any row fails, nothing is stored.
37
+ *
38
+ * @param {NordletApi.PostV1MigrationBooksImportRequest} request
39
+ * @param {MigrationClient.RequestOptions} requestOptions - Request-specific configuration.
40
+ *
41
+ * @throws {@link NordletApi.BadRequestError}
42
+ * @throws {@link NordletApi.UnauthorizedError}
43
+ * @throws {@link NordletApi.ForbiddenError}
44
+ * @throws {@link NordletApi.NotFoundError}
45
+ * @throws {@link NordletApi.ConflictError}
46
+ * @throws {@link NordletApi.UnprocessableEntityError}
47
+ * @throws {@link NordletApi.TooManyRequestsError}
48
+ * @throws {@link NordletApi.InternalServerError}
49
+ *
50
+ * @example
51
+ * await client.migration.importHistoricalBooksFromAPreviousAccountingSystem({
52
+ * cutoverDate: "cutoverDate"
53
+ * })
54
+ */
55
+ importHistoricalBooksFromAPreviousAccountingSystem(request: NordletApi.PostV1MigrationBooksImportRequest, requestOptions?: MigrationClient.RequestOptions): core.HttpResponsePromise<NordletApi.PostV1MigrationBooksImportResponse>;
56
+ private __importHistoricalBooksFromAPreviousAccountingSystem;
57
+ }
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.MigrationClient = void 0;
38
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
39
+ const headers_js_1 = require("../../../../core/headers.js");
40
+ const core = __importStar(require("../../../../core/index.js"));
41
+ const requestBody_js_1 = require("../../../../core/requestBody.js");
42
+ const environments = __importStar(require("../../../../environments.js"));
43
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
44
+ const errors = __importStar(require("../../../../errors/index.js"));
45
+ const NordletApi = __importStar(require("../../../index.js"));
46
+ class MigrationClient {
47
+ constructor(options) {
48
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
49
+ }
50
+ /**
51
+ * Runs every check the import runs (accounts, partners, balances, open invoices, assets, stock) and returns the same summary and warnings, then rolls everything back. Nothing is stored.
52
+ *
53
+ * @param {NordletApi.PostV1MigrationBooksValidateRequest} request
54
+ * @param {MigrationClient.RequestOptions} requestOptions - Request-specific configuration.
55
+ *
56
+ * @throws {@link NordletApi.BadRequestError}
57
+ * @throws {@link NordletApi.UnauthorizedError}
58
+ * @throws {@link NordletApi.ForbiddenError}
59
+ * @throws {@link NordletApi.NotFoundError}
60
+ * @throws {@link NordletApi.ConflictError}
61
+ * @throws {@link NordletApi.UnprocessableEntityError}
62
+ * @throws {@link NordletApi.TooManyRequestsError}
63
+ * @throws {@link NordletApi.InternalServerError}
64
+ *
65
+ * @example
66
+ * await client.migration.checkAHistoricalBooksPackageWithoutWritingAnything({
67
+ * cutoverDate: "cutoverDate"
68
+ * })
69
+ */
70
+ checkAHistoricalBooksPackageWithoutWritingAnything(request, requestOptions) {
71
+ return core.HttpResponsePromise.fromPromise(this.__checkAHistoricalBooksPackageWithoutWritingAnything(request, requestOptions));
72
+ }
73
+ async __checkAHistoricalBooksPackageWithoutWritingAnything(request, requestOptions) {
74
+ const _authRequest = await this._options.authProvider.getAuthRequest();
75
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
76
+ const _response = await core.fetcher({
77
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
78
+ (await core.Supplier.get(this._options.environment)) ??
79
+ environments.NordletApiEnvironment.Production, "v1/migration/books/validate"),
80
+ method: "POST",
81
+ headers: _headers,
82
+ contentType: "application/json",
83
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
84
+ requestType: "json",
85
+ body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(request, requestOptions?.additionalBodyParameters),
86
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
87
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
88
+ abortSignal: requestOptions?.abortSignal,
89
+ fetchFn: this._options?.fetch,
90
+ logging: this._options.logging,
91
+ });
92
+ if (_response.ok) {
93
+ return {
94
+ data: _response.body,
95
+ rawResponse: _response.rawResponse,
96
+ };
97
+ }
98
+ if (_response.error.reason === "status-code") {
99
+ switch (_response.error.statusCode) {
100
+ case 400:
101
+ throw new NordletApi.BadRequestError(_response.error.body, _response.rawResponse);
102
+ case 401:
103
+ throw new NordletApi.UnauthorizedError(_response.error.body, _response.rawResponse);
104
+ case 403:
105
+ throw new NordletApi.ForbiddenError(_response.error.body, _response.rawResponse);
106
+ case 404:
107
+ throw new NordletApi.NotFoundError(_response.error.body, _response.rawResponse);
108
+ case 409:
109
+ throw new NordletApi.ConflictError(_response.error.body, _response.rawResponse);
110
+ case 422:
111
+ throw new NordletApi.UnprocessableEntityError(_response.error.body, _response.rawResponse);
112
+ case 429:
113
+ throw new NordletApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
114
+ case 500:
115
+ throw new NordletApi.InternalServerError(_response.error.body, _response.rawResponse);
116
+ default:
117
+ throw new errors.NordletApiError({
118
+ statusCode: _response.error.statusCode,
119
+ body: _response.error.body,
120
+ rawResponse: _response.rawResponse,
121
+ });
122
+ }
123
+ }
124
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/migration/books/validate");
125
+ }
126
+ /**
127
+ * Brings a company over from another system in one call: chart of accounts, partners, items, opening balances (or the full journal history), open customer and supplier invoices, fixed assets with their accumulated depreciation, and stock on hand. The whole package is written in one database transaction — if any row fails, nothing is stored.
128
+ *
129
+ * @param {NordletApi.PostV1MigrationBooksImportRequest} request
130
+ * @param {MigrationClient.RequestOptions} requestOptions - Request-specific configuration.
131
+ *
132
+ * @throws {@link NordletApi.BadRequestError}
133
+ * @throws {@link NordletApi.UnauthorizedError}
134
+ * @throws {@link NordletApi.ForbiddenError}
135
+ * @throws {@link NordletApi.NotFoundError}
136
+ * @throws {@link NordletApi.ConflictError}
137
+ * @throws {@link NordletApi.UnprocessableEntityError}
138
+ * @throws {@link NordletApi.TooManyRequestsError}
139
+ * @throws {@link NordletApi.InternalServerError}
140
+ *
141
+ * @example
142
+ * await client.migration.importHistoricalBooksFromAPreviousAccountingSystem({
143
+ * cutoverDate: "cutoverDate"
144
+ * })
145
+ */
146
+ importHistoricalBooksFromAPreviousAccountingSystem(request, requestOptions) {
147
+ return core.HttpResponsePromise.fromPromise(this.__importHistoricalBooksFromAPreviousAccountingSystem(request, requestOptions));
148
+ }
149
+ async __importHistoricalBooksFromAPreviousAccountingSystem(request, requestOptions) {
150
+ const _authRequest = await this._options.authProvider.getAuthRequest();
151
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
152
+ const _response = await core.fetcher({
153
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
154
+ (await core.Supplier.get(this._options.environment)) ??
155
+ environments.NordletApiEnvironment.Production, "v1/migration/books/import"),
156
+ method: "POST",
157
+ headers: _headers,
158
+ contentType: "application/json",
159
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
160
+ requestType: "json",
161
+ body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(request, requestOptions?.additionalBodyParameters),
162
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
163
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
164
+ abortSignal: requestOptions?.abortSignal,
165
+ fetchFn: this._options?.fetch,
166
+ logging: this._options.logging,
167
+ });
168
+ if (_response.ok) {
169
+ return {
170
+ data: _response.body,
171
+ rawResponse: _response.rawResponse,
172
+ };
173
+ }
174
+ if (_response.error.reason === "status-code") {
175
+ switch (_response.error.statusCode) {
176
+ case 400:
177
+ throw new NordletApi.BadRequestError(_response.error.body, _response.rawResponse);
178
+ case 401:
179
+ throw new NordletApi.UnauthorizedError(_response.error.body, _response.rawResponse);
180
+ case 403:
181
+ throw new NordletApi.ForbiddenError(_response.error.body, _response.rawResponse);
182
+ case 404:
183
+ throw new NordletApi.NotFoundError(_response.error.body, _response.rawResponse);
184
+ case 409:
185
+ throw new NordletApi.ConflictError(_response.error.body, _response.rawResponse);
186
+ case 422:
187
+ throw new NordletApi.UnprocessableEntityError(_response.error.body, _response.rawResponse);
188
+ case 429:
189
+ throw new NordletApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
190
+ case 500:
191
+ throw new NordletApi.InternalServerError(_response.error.body, _response.rawResponse);
192
+ default:
193
+ throw new errors.NordletApiError({
194
+ statusCode: _response.error.statusCode,
195
+ body: _response.error.body,
196
+ rawResponse: _response.rawResponse,
197
+ });
198
+ }
199
+ }
200
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/migration/books/import");
201
+ }
202
+ }
203
+ exports.MigrationClient = MigrationClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,196 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * cutoverDate: "cutoverDate"
5
+ * }
6
+ */
7
+ export interface PostV1MigrationBooksImportRequest {
8
+ cutoverDate: string;
9
+ source?: string;
10
+ accounts?: PostV1MigrationBooksImportRequest.Accounts.Item[];
11
+ partners?: PostV1MigrationBooksImportRequest.Partners.Item[];
12
+ items?: PostV1MigrationBooksImportRequest.Items.Item[];
13
+ openingBalances?: PostV1MigrationBooksImportRequest.OpeningBalances;
14
+ journal?: PostV1MigrationBooksImportRequest.Journal.Item[];
15
+ openReceivables?: PostV1MigrationBooksImportRequest.OpenReceivables.Item[];
16
+ openPayables?: PostV1MigrationBooksImportRequest.OpenPayables.Item[];
17
+ assetGroups?: PostV1MigrationBooksImportRequest.AssetGroups.Item[];
18
+ fixedAssets?: PostV1MigrationBooksImportRequest.FixedAssets.Item[];
19
+ stock?: PostV1MigrationBooksImportRequest.Stock.Item[];
20
+ }
21
+ export declare namespace PostV1MigrationBooksImportRequest {
22
+ type Accounts = Accounts.Item[];
23
+ namespace Accounts {
24
+ interface Item {
25
+ code: string;
26
+ name: string;
27
+ type: Item.Type;
28
+ parentCode?: string | undefined;
29
+ isPostable?: boolean | undefined;
30
+ }
31
+ namespace Item {
32
+ const Type: {
33
+ readonly Asset: "asset";
34
+ readonly Liability: "liability";
35
+ readonly Equity: "equity";
36
+ readonly Income: "income";
37
+ readonly Expense: "expense";
38
+ };
39
+ type Type = (typeof Type)[keyof typeof Type];
40
+ }
41
+ }
42
+ type Partners = Partners.Item[];
43
+ namespace Partners {
44
+ interface Item {
45
+ code: string;
46
+ name: string;
47
+ type?: Item.Type | undefined;
48
+ vatCode?: string | undefined;
49
+ email?: string | undefined;
50
+ phone?: string | undefined;
51
+ isCustomer?: boolean | undefined;
52
+ isSupplier?: boolean | undefined;
53
+ paymentTermDays?: number | undefined;
54
+ address?: Item.Address | undefined;
55
+ notes?: string | undefined;
56
+ }
57
+ namespace Item {
58
+ const Type: {
59
+ readonly Company: "company";
60
+ readonly Person: "person";
61
+ };
62
+ type Type = (typeof Type)[keyof typeof Type];
63
+ interface Address {
64
+ street?: string | undefined;
65
+ city?: string | undefined;
66
+ postalCode?: string | undefined;
67
+ countryCode?: string | undefined;
68
+ }
69
+ }
70
+ }
71
+ type Items = Items.Item[];
72
+ namespace Items {
73
+ interface Item {
74
+ code: string;
75
+ name: string;
76
+ type?: Item.Type | undefined;
77
+ unit?: string | undefined;
78
+ barcode?: string | undefined;
79
+ vatRatePercent?: string | undefined;
80
+ salePriceExclVat?: string | undefined;
81
+ purchasePriceExclVat?: string | undefined;
82
+ description?: string | undefined;
83
+ }
84
+ namespace Item {
85
+ const Type: {
86
+ readonly Product: "product";
87
+ readonly Service: "service";
88
+ };
89
+ type Type = (typeof Type)[keyof typeof Type];
90
+ }
91
+ }
92
+ interface OpeningBalances {
93
+ date?: string | undefined;
94
+ balancingAccountCode?: string | undefined;
95
+ entries: OpeningBalances.Entries.Item[];
96
+ }
97
+ namespace OpeningBalances {
98
+ type Entries = Entries.Item[];
99
+ namespace Entries {
100
+ interface Item {
101
+ accountCode: string;
102
+ debit?: string | undefined;
103
+ credit?: string | undefined;
104
+ description?: string | undefined;
105
+ }
106
+ }
107
+ }
108
+ type Journal = Journal.Item[];
109
+ namespace Journal {
110
+ interface Item {
111
+ date: string;
112
+ description?: string | undefined;
113
+ reference?: string | undefined;
114
+ entries: Item.Entries.Item[];
115
+ }
116
+ namespace Item {
117
+ type Entries = Entries.Item[];
118
+ namespace Entries {
119
+ interface Item {
120
+ accountCode: string;
121
+ debit?: string | undefined;
122
+ credit?: string | undefined;
123
+ description?: string | undefined;
124
+ }
125
+ }
126
+ }
127
+ }
128
+ type OpenReceivables = OpenReceivables.Item[];
129
+ namespace OpenReceivables {
130
+ interface Item {
131
+ partnerCode: string;
132
+ dueDate?: string | undefined;
133
+ currency?: string | undefined;
134
+ grossTotal: string;
135
+ vatTotal?: string | undefined;
136
+ outstanding?: string | undefined;
137
+ fxRate?: string | undefined;
138
+ notes?: string | undefined;
139
+ number: string;
140
+ issueDate: string;
141
+ }
142
+ }
143
+ type OpenPayables = OpenPayables.Item[];
144
+ namespace OpenPayables {
145
+ interface Item {
146
+ partnerCode: string;
147
+ dueDate?: string | undefined;
148
+ currency?: string | undefined;
149
+ grossTotal: string;
150
+ vatTotal?: string | undefined;
151
+ outstanding?: string | undefined;
152
+ fxRate?: string | undefined;
153
+ notes?: string | undefined;
154
+ documentNumber: string;
155
+ documentDate: string;
156
+ }
157
+ }
158
+ type AssetGroups = AssetGroups.Item[];
159
+ namespace AssetGroups {
160
+ interface Item {
161
+ code: string;
162
+ name: string;
163
+ assetAccountCode: string;
164
+ depreciationAccountCode: string;
165
+ expenseAccountCode?: string | undefined;
166
+ defaultUsefulLifeMonths?: number | undefined;
167
+ }
168
+ }
169
+ type FixedAssets = FixedAssets.Item[];
170
+ namespace FixedAssets {
171
+ interface Item {
172
+ groupCode: string;
173
+ code: string;
174
+ name: string;
175
+ acquisitionDate: string;
176
+ depreciationStartDate?: string | undefined;
177
+ acquisitionCost: string;
178
+ salvageValue?: string | undefined;
179
+ usefulLifeMonths?: number | undefined;
180
+ accumulatedDepreciation?: string | undefined;
181
+ depreciatedMonths?: number | undefined;
182
+ notes?: string | undefined;
183
+ }
184
+ }
185
+ type Stock = Stock.Item[];
186
+ namespace Stock {
187
+ interface Item {
188
+ warehouseCode?: string | undefined;
189
+ itemCode: string;
190
+ quantity: string;
191
+ unitCost: string;
192
+ lotNumber?: string | undefined;
193
+ expiryDate?: string | undefined;
194
+ }
195
+ }
196
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PostV1MigrationBooksImportRequest = void 0;
5
+ var PostV1MigrationBooksImportRequest;
6
+ (function (PostV1MigrationBooksImportRequest) {
7
+ let Accounts;
8
+ (function (Accounts) {
9
+ let Item;
10
+ (function (Item) {
11
+ Item.Type = {
12
+ Asset: "asset",
13
+ Liability: "liability",
14
+ Equity: "equity",
15
+ Income: "income",
16
+ Expense: "expense",
17
+ };
18
+ })(Item = Accounts.Item || (Accounts.Item = {}));
19
+ })(Accounts = PostV1MigrationBooksImportRequest.Accounts || (PostV1MigrationBooksImportRequest.Accounts = {}));
20
+ let Partners;
21
+ (function (Partners) {
22
+ let Item;
23
+ (function (Item) {
24
+ Item.Type = {
25
+ Company: "company",
26
+ Person: "person",
27
+ };
28
+ })(Item = Partners.Item || (Partners.Item = {}));
29
+ })(Partners = PostV1MigrationBooksImportRequest.Partners || (PostV1MigrationBooksImportRequest.Partners = {}));
30
+ let Items;
31
+ (function (Items) {
32
+ let Item;
33
+ (function (Item) {
34
+ Item.Type = {
35
+ Product: "product",
36
+ Service: "service",
37
+ };
38
+ })(Item = Items.Item || (Items.Item = {}));
39
+ })(Items = PostV1MigrationBooksImportRequest.Items || (PostV1MigrationBooksImportRequest.Items = {}));
40
+ })(PostV1MigrationBooksImportRequest || (exports.PostV1MigrationBooksImportRequest = PostV1MigrationBooksImportRequest = {}));