@deliverart/sdk-js-company 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3
+ "changelog": "@changesets/cli/changelog",
4
+ "commit": false,
5
+ "fixed": [],
6
+ "linked": [],
7
+ "access": "restricted",
8
+ "baseBranch": "main",
9
+ "updateInternalDependencies": "patch",
10
+ "ignore": []
11
+ }
@@ -0,0 +1,47 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ contents: write
10
+
11
+ jobs:
12
+ release:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - uses: pnpm/action-setup@v2
18
+ with:
19
+ version: 8
20
+
21
+ - uses: actions/setup-node@v4
22
+ with:
23
+ node-version: '20'
24
+ registry-url: 'https://registry.npmjs.org'
25
+ always-auth: true
26
+ env:
27
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
28
+
29
+ - name: Install deps
30
+ run: pnpm install
31
+
32
+ - name: Build
33
+ run: pnpm build
34
+
35
+ - name: Create version and changelog
36
+ run: pnpx @changesets/cli version
37
+
38
+ - name: Publish to NPM
39
+ run: pnpx @changesets/cli publish
40
+ env:
41
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42
+
43
+ - name: Push updated versions and changelogs
44
+ uses: EndBug/add-and-commit@v9
45
+ with:
46
+ message: 'chore(release): version bump'
47
+ add: '.'
package/.prettierrc ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "semi": false,
3
+ "singleQuote": true,
4
+ "printWidth": 100,
5
+ "trailingComma": "all",
6
+ "arrowParens": "avoid"
7
+ }
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # sdk-js-company
2
+
3
+ Company module for SDK
package/dist/index.cjs ADDED
@@ -0,0 +1,218 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ CreateCompany: () => CreateCompany,
24
+ DeleteCompany: () => DeleteCompany,
25
+ GetCompanies: () => GetCompanies,
26
+ GetCompanyDetails: () => GetCompanyDetails,
27
+ UpdateCompany: () => UpdateCompany,
28
+ companyDetailsSchema: () => companyDetailsSchema,
29
+ companySchema: () => companySchema,
30
+ createCompanyInputSchema: () => createCompanyInputSchema,
31
+ createCompanyResponseSchema: () => createCompanyResponseSchema,
32
+ deleteCompanyInputSchema: () => deleteCompanyInputSchema,
33
+ deleteCompanyResponseSchema: () => deleteCompanyResponseSchema,
34
+ getCompaniesInputSchema: () => getCompaniesInputSchema,
35
+ getCompaniesQuerySchema: () => getCompaniesQuerySchema,
36
+ getCompaniesResponseSchema: () => getCompaniesResponseSchema,
37
+ getCompanyDetailsInputSchema: () => getCompanyDetailsInputSchema,
38
+ getCompanyDetailsResponseSchema: () => getCompanyDetailsResponseSchema,
39
+ updateCompanyInputSchema: () => updateCompanyInputSchema,
40
+ updateCompanyResponseSchema: () => updateCompanyResponseSchema,
41
+ writableCompanySchema: () => writableCompanySchema
42
+ });
43
+ module.exports = __toCommonJS(index_exports);
44
+
45
+ // src/models.ts
46
+ var import_sdk_js_global_types = require("@deliverart/sdk-js-global-types");
47
+ var import_zod = require("zod");
48
+ var companySchema = import_zod.z.object({
49
+ id: import_zod.z.string(),
50
+ businessName: import_zod.z.string(),
51
+ vat: import_zod.z.string(),
52
+ taxCode: import_zod.z.string(),
53
+ operationalAddress: import_sdk_js_global_types.addressSchema,
54
+ createdAt: import_sdk_js_global_types.datetimeSchema,
55
+ updatedAt: import_sdk_js_global_types.datetimeSchema
56
+ });
57
+ var companyDetailsSchema = companySchema.extend({
58
+ billingAddress: import_sdk_js_global_types.addressSchema,
59
+ billingData: import_sdk_js_global_types.billingDataSchema,
60
+ adminBy: import_zod.z.string()
61
+ });
62
+ var writableCompanySchema = companyDetailsSchema.pick({
63
+ businessName: true,
64
+ vat: true,
65
+ taxCode: true,
66
+ billingAddress: true,
67
+ operationalAddress: true,
68
+ billingData: true
69
+ });
70
+
71
+ // src/requests/CreateCompany.ts
72
+ var import_sdk_js_core = require("@deliverart/sdk-js-core");
73
+ var createCompanyInputSchema = writableCompanySchema.required();
74
+ var createCompanyResponseSchema = companyDetailsSchema;
75
+ var CreateCompany = class extends import_sdk_js_core.AbstractApiRequest {
76
+ method = "POST";
77
+ contentType = "application/json";
78
+ accept = "application/json";
79
+ inputSchema = createCompanyInputSchema;
80
+ outputSchema = createCompanyResponseSchema;
81
+ querySchema = void 0;
82
+ headersSchema = void 0;
83
+ constructor(input) {
84
+ super(input);
85
+ }
86
+ getPath() {
87
+ return "/companies";
88
+ }
89
+ };
90
+
91
+ // src/requests/DeleteCompany.ts
92
+ var import_sdk_js_core2 = require("@deliverart/sdk-js-core");
93
+ var import_zod2 = require("zod");
94
+ var deleteCompanyInputSchema = import_zod2.z.undefined();
95
+ var deleteCompanyResponseSchema = import_zod2.z.undefined();
96
+ var DeleteCompany = class extends import_sdk_js_core2.AbstractApiRequest {
97
+ method = "DELETE";
98
+ contentType = "application/json";
99
+ accept = "application/json";
100
+ inputSchema = deleteCompanyInputSchema;
101
+ outputSchema = deleteCompanyResponseSchema;
102
+ querySchema = void 0;
103
+ headersSchema = void 0;
104
+ companyId;
105
+ constructor(companyId) {
106
+ super();
107
+ this.companyId = companyId;
108
+ }
109
+ getPath() {
110
+ return `/companies/${this.companyId}`;
111
+ }
112
+ };
113
+
114
+ // src/requests/GetCompanies.ts
115
+ var import_sdk_js_core3 = require("@deliverart/sdk-js-core");
116
+ var import_sdk_js_global_types2 = require("@deliverart/sdk-js-global-types");
117
+ var import_zod3 = require("zod");
118
+ var getCompaniesQuerySchema = import_zod3.z.object({
119
+ businessName: import_zod3.z.string().optional(),
120
+ vat: import_zod3.z.string().optional(),
121
+ taxCode: import_zod3.z.string().optional(),
122
+ "billingAddress.city": import_zod3.z.string().optional(),
123
+ "billingAddress.postalCode": import_zod3.z.string().optional(),
124
+ "operationalAddress.city": import_zod3.z.string().optional(),
125
+ "operationalAddress.postalCode": import_zod3.z.string().optional(),
126
+ "order[businessName]": import_zod3.z.enum(["asc", "desc"]).optional(),
127
+ "order[createdAt]": import_zod3.z.enum(["asc", "desc"]).optional(),
128
+ "order[updatedAt]": import_zod3.z.enum(["asc", "desc"]).optional(),
129
+ page: import_zod3.z.coerce.number().optional()
130
+ });
131
+ var getCompaniesResponseSchema = (0, import_sdk_js_global_types2.createPaginatedSchema)(companySchema);
132
+ var getCompaniesInputSchema = import_zod3.z.undefined();
133
+ var GetCompanies = class extends import_sdk_js_core3.AbstractApiRequest {
134
+ method = "GET";
135
+ contentType = "application/json";
136
+ accept = "application/json";
137
+ inputSchema = getCompaniesInputSchema;
138
+ outputSchema = getCompaniesResponseSchema;
139
+ querySchema = getCompaniesQuerySchema;
140
+ headersSchema = void 0;
141
+ constructor(options) {
142
+ super(void 0, options);
143
+ }
144
+ getPath() {
145
+ return "/companies";
146
+ }
147
+ parseResponse(data, rawResponse) {
148
+ const companies = import_zod3.z.array(companySchema).parse(data);
149
+ return this.validateOutput({ data: companies, pagination: (0, import_sdk_js_global_types2.responseToPagination)(rawResponse) });
150
+ }
151
+ };
152
+
153
+ // src/requests/GetCompanyDetails.ts
154
+ var import_sdk_js_core4 = require("@deliverart/sdk-js-core");
155
+ var import_zod4 = require("zod");
156
+ var getCompanyDetailsInputSchema = import_zod4.z.undefined();
157
+ var getCompanyDetailsResponseSchema = companyDetailsSchema;
158
+ var GetCompanyDetails = class extends import_sdk_js_core4.AbstractApiRequest {
159
+ method = "GET";
160
+ contentType = "application/json";
161
+ accept = "application/json";
162
+ inputSchema = getCompanyDetailsInputSchema;
163
+ outputSchema = getCompanyDetailsResponseSchema;
164
+ querySchema = void 0;
165
+ headersSchema = void 0;
166
+ companyId;
167
+ constructor(companyId) {
168
+ super();
169
+ this.companyId = companyId;
170
+ }
171
+ getPath() {
172
+ return `/companies/${this.companyId}`;
173
+ }
174
+ };
175
+
176
+ // src/requests/UpdateCompany.ts
177
+ var import_sdk_js_core5 = require("@deliverart/sdk-js-core");
178
+ var updateCompanyInputSchema = writableCompanySchema.partial();
179
+ var updateCompanyResponseSchema = companyDetailsSchema;
180
+ var UpdateCompany = class extends import_sdk_js_core5.AbstractApiRequest {
181
+ method = "PATCH";
182
+ contentType = "application/merge-patch+json";
183
+ accept = "application/json";
184
+ inputSchema = updateCompanyInputSchema;
185
+ outputSchema = updateCompanyResponseSchema;
186
+ querySchema = void 0;
187
+ headersSchema = void 0;
188
+ companyId;
189
+ constructor(companyId, input) {
190
+ super(input);
191
+ this.companyId = companyId;
192
+ }
193
+ getPath() {
194
+ return `/companies/${this.companyId}`;
195
+ }
196
+ };
197
+ // Annotate the CommonJS export names for ESM import in node:
198
+ 0 && (module.exports = {
199
+ CreateCompany,
200
+ DeleteCompany,
201
+ GetCompanies,
202
+ GetCompanyDetails,
203
+ UpdateCompany,
204
+ companyDetailsSchema,
205
+ companySchema,
206
+ createCompanyInputSchema,
207
+ createCompanyResponseSchema,
208
+ deleteCompanyInputSchema,
209
+ deleteCompanyResponseSchema,
210
+ getCompaniesInputSchema,
211
+ getCompaniesQuerySchema,
212
+ getCompaniesResponseSchema,
213
+ getCompanyDetailsInputSchema,
214
+ getCompanyDetailsResponseSchema,
215
+ updateCompanyInputSchema,
216
+ updateCompanyResponseSchema,
217
+ writableCompanySchema
218
+ });