@deliverart/sdk-js-company 0.0.8 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @deliverart/sdk-js-company
2
2
 
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 84e283d: update logic based on new sdk core version
8
+
3
9
  ## 0.0.8
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -25,9 +25,9 @@ __export(index_exports, {
25
25
  GetCompanies: () => GetCompanies,
26
26
  GetCompanyDetails: () => GetCompanyDetails,
27
27
  UpdateCompany: () => UpdateCompany,
28
+ companiesQuerySchema: () => companiesQuerySchema,
28
29
  companyDetailsSchema: () => companyDetailsSchema,
29
- companyNullablePathSchema: () => companyNullablePathSchema,
30
- companyPathSchema: () => companyPathSchema,
30
+ companyIriSchema: () => companyIriSchema,
31
31
  companySchema: () => companySchema,
32
32
  createCompanyInputSchema: () => createCompanyInputSchema,
33
33
  createCompanyResponseSchema: () => createCompanyResponseSchema,
@@ -46,6 +46,7 @@ module.exports = __toCommonJS(index_exports);
46
46
 
47
47
  // src/models.ts
48
48
  var import_sdk_js_global_types = require("@deliverart/sdk-js-global-types");
49
+ var import_sdk_js_user = require("@deliverart/sdk-js-user");
49
50
  var import_zod = require("zod");
50
51
  var companySchema = import_zod.z.object({
51
52
  id: import_zod.z.string(),
@@ -59,7 +60,7 @@ var companySchema = import_zod.z.object({
59
60
  var companyDetailsSchema = companySchema.extend({
60
61
  billingAddress: import_sdk_js_global_types.addressSchema,
61
62
  billingData: import_sdk_js_global_types.billingDataSchema,
62
- adminBy: import_zod.z.string()
63
+ adminBy: import_sdk_js_user.userIriSchema
63
64
  });
64
65
  var writableCompanySchema = companyDetailsSchema.pick({
65
66
  businessName: true,
@@ -69,6 +70,19 @@ var writableCompanySchema = companyDetailsSchema.pick({
69
70
  operationalAddress: true,
70
71
  billingData: true
71
72
  });
73
+ var companiesQuerySchema = import_zod.z.object({
74
+ businessName: import_zod.z.string().optional(),
75
+ vat: import_zod.z.string().optional(),
76
+ taxCode: import_zod.z.string().optional(),
77
+ "billingAddress.city": import_zod.z.string().optional(),
78
+ "billingAddress.postalCode": import_zod.z.string().optional(),
79
+ "operationalAddress.city": import_zod.z.string().optional(),
80
+ "operationalAddress.postalCode": import_zod.z.string().optional(),
81
+ "order[businessName]": import_sdk_js_global_types.sortDirSchema.optional(),
82
+ "order[createdAt]": import_sdk_js_global_types.sortDirSchema.optional(),
83
+ "order[updatedAt]": import_sdk_js_global_types.sortDirSchema.optional(),
84
+ page: import_zod.z.coerce.number().optional()
85
+ });
72
86
 
73
87
  // src/requests/CreateCompany.ts
74
88
  var import_sdk_js_core = require("@deliverart/sdk-js-core");
@@ -105,7 +119,7 @@ var DeleteCompany = class extends import_sdk_js_core2.AbstractApiRequest {
105
119
  headersSchema = void 0;
106
120
  companyId;
107
121
  constructor(companyId) {
108
- super();
122
+ super(void 0);
109
123
  this.companyId = companyId;
110
124
  }
111
125
  getPath() {
@@ -117,21 +131,9 @@ var DeleteCompany = class extends import_sdk_js_core2.AbstractApiRequest {
117
131
  var import_sdk_js_core3 = require("@deliverart/sdk-js-core");
118
132
  var import_sdk_js_global_types2 = require("@deliverart/sdk-js-global-types");
119
133
  var import_zod3 = require("zod");
120
- var getCompaniesQuerySchema = import_zod3.z.object({
121
- businessName: import_zod3.z.string().optional(),
122
- vat: import_zod3.z.string().optional(),
123
- taxCode: import_zod3.z.string().optional(),
124
- "billingAddress.city": import_zod3.z.string().optional(),
125
- "billingAddress.postalCode": import_zod3.z.string().optional(),
126
- "operationalAddress.city": import_zod3.z.string().optional(),
127
- "operationalAddress.postalCode": import_zod3.z.string().optional(),
128
- "order[businessName]": import_sdk_js_global_types2.sortDirSchema.optional(),
129
- "order[createdAt]": import_sdk_js_global_types2.sortDirSchema.optional(),
130
- "order[updatedAt]": import_sdk_js_global_types2.sortDirSchema.optional(),
131
- page: import_zod3.z.coerce.number().optional()
132
- });
133
- var getCompaniesResponseSchema = (0, import_sdk_js_global_types2.createPaginatedSchema)(companySchema);
134
+ var getCompaniesQuerySchema = companiesQuerySchema;
134
135
  var getCompaniesInputSchema = import_zod3.z.undefined();
136
+ var getCompaniesResponseSchema = (0, import_sdk_js_global_types2.createPaginatedSchema)(companySchema);
135
137
  var GetCompanies = class extends import_sdk_js_core3.AbstractApiRequest {
136
138
  method = "GET";
137
139
  contentType = "application/json";
@@ -167,7 +169,7 @@ var GetCompanyDetails = class extends import_sdk_js_core4.AbstractApiRequest {
167
169
  headersSchema = void 0;
168
170
  companyId;
169
171
  constructor(companyId) {
170
- super();
172
+ super(void 0);
171
173
  this.companyId = companyId;
172
174
  }
173
175
  getPath() {
@@ -198,19 +200,8 @@ var UpdateCompany = class extends import_sdk_js_core5.AbstractApiRequest {
198
200
  };
199
201
 
200
202
  // src/types.ts
201
- var import_zod5 = require("zod");
202
- var companyPathSchema = import_zod5.z.string().refine((val) => /^\/companies\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
203
- message: "Invalid integration path format"
204
- });
205
- var companyNullablePathSchema = import_zod5.z.string().nullable().refine(
206
- (val) => {
207
- if (!val) return true;
208
- return /^\/companies\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
209
- },
210
- {
211
- message: "Invalid integration path format"
212
- }
213
- );
203
+ var import_sdk_js_global_types3 = require("@deliverart/sdk-js-global-types");
204
+ var companyIriSchema = (0, import_sdk_js_global_types3.iriSchema)("/companies/:id");
214
205
  // Annotate the CommonJS export names for ESM import in node:
215
206
  0 && (module.exports = {
216
207
  CreateCompany,
@@ -218,9 +209,9 @@ var companyNullablePathSchema = import_zod5.z.string().nullable().refine(
218
209
  GetCompanies,
219
210
  GetCompanyDetails,
220
211
  UpdateCompany,
212
+ companiesQuerySchema,
221
213
  companyDetailsSchema,
222
- companyNullablePathSchema,
223
- companyPathSchema,
214
+ companyIriSchema,
224
215
  companySchema,
225
216
  createCompanyInputSchema,
226
217
  createCompanyResponseSchema,
package/dist/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
+ import * as _deliverart_sdk_js_global_types from '@deliverart/sdk-js-global-types';
2
+ import { Paginated } from '@deliverart/sdk-js-global-types';
1
3
  import { z } from 'zod';
2
4
  import { AbstractApiRequest } from '@deliverart/sdk-js-core';
3
- import { Paginated } from '@deliverart/sdk-js-global-types';
4
5
  import { AxiosResponse } from 'axios';
5
6
 
6
7
  declare const companySchema: z.ZodObject<{
@@ -132,7 +133,7 @@ declare const companyDetailsSchema: z.ZodObject<{
132
133
  sdi?: string | null | undefined;
133
134
  pec?: string | null | undefined;
134
135
  }>;
135
- adminBy: z.ZodString;
136
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
136
137
  }, "strip", z.ZodTypeAny, {
137
138
  id: string;
138
139
  businessName: string;
@@ -160,7 +161,7 @@ declare const companyDetailsSchema: z.ZodObject<{
160
161
  sdi?: string | null | undefined;
161
162
  pec?: string | null | undefined;
162
163
  };
163
- adminBy: string;
164
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
164
165
  }, {
165
166
  id: string;
166
167
  businessName: string;
@@ -259,7 +260,7 @@ declare const writableCompanySchema: z.ZodObject<Pick<{
259
260
  sdi?: string | null | undefined;
260
261
  pec?: string | null | undefined;
261
262
  }>;
262
- adminBy: z.ZodString;
263
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
263
264
  }, "businessName" | "vat" | "taxCode" | "operationalAddress" | "billingAddress" | "billingData">, "strip", z.ZodTypeAny, {
264
265
  businessName: string;
265
266
  vat: string;
@@ -309,6 +310,44 @@ declare const writableCompanySchema: z.ZodObject<Pick<{
309
310
  pec?: string | null | undefined;
310
311
  };
311
312
  }>;
313
+ declare const companiesQuerySchema: z.ZodObject<{
314
+ businessName: z.ZodOptional<z.ZodString>;
315
+ vat: z.ZodOptional<z.ZodString>;
316
+ taxCode: z.ZodOptional<z.ZodString>;
317
+ 'billingAddress.city': z.ZodOptional<z.ZodString>;
318
+ 'billingAddress.postalCode': z.ZodOptional<z.ZodString>;
319
+ 'operationalAddress.city': z.ZodOptional<z.ZodString>;
320
+ 'operationalAddress.postalCode': z.ZodOptional<z.ZodString>;
321
+ 'order[businessName]': z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
322
+ 'order[createdAt]': z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
323
+ 'order[updatedAt]': z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
324
+ page: z.ZodOptional<z.ZodNumber>;
325
+ }, "strip", z.ZodTypeAny, {
326
+ businessName?: string | undefined;
327
+ vat?: string | undefined;
328
+ taxCode?: string | undefined;
329
+ 'billingAddress.city'?: string | undefined;
330
+ 'billingAddress.postalCode'?: string | undefined;
331
+ 'operationalAddress.city'?: string | undefined;
332
+ 'operationalAddress.postalCode'?: string | undefined;
333
+ 'order[businessName]'?: "asc" | "desc" | undefined;
334
+ 'order[createdAt]'?: "asc" | "desc" | undefined;
335
+ 'order[updatedAt]'?: "asc" | "desc" | undefined;
336
+ page?: number | undefined;
337
+ }, {
338
+ businessName?: string | undefined;
339
+ vat?: string | undefined;
340
+ taxCode?: string | undefined;
341
+ 'billingAddress.city'?: string | undefined;
342
+ 'billingAddress.postalCode'?: string | undefined;
343
+ 'operationalAddress.city'?: string | undefined;
344
+ 'operationalAddress.postalCode'?: string | undefined;
345
+ 'order[businessName]'?: "asc" | "desc" | undefined;
346
+ 'order[createdAt]'?: "asc" | "desc" | undefined;
347
+ 'order[updatedAt]'?: "asc" | "desc" | undefined;
348
+ page?: number | undefined;
349
+ }>;
350
+ type CompaniesQueryParams = z.infer<typeof companiesQuerySchema>;
312
351
 
313
352
  declare const createCompanyInputSchema: z.ZodObject<{
314
353
  businessName: z.ZodString;
@@ -423,7 +462,7 @@ declare const createCompanyInputSchema: z.ZodObject<{
423
462
  pec?: string | null | undefined;
424
463
  };
425
464
  }>;
426
- type CreateCompanyInput = z.infer<typeof createCompanyInputSchema>;
465
+ type CreateCompanyInput = z.input<typeof createCompanyInputSchema>;
427
466
  declare const createCompanyResponseSchema: z.ZodObject<{
428
467
  id: z.ZodString;
429
468
  businessName: z.ZodString;
@@ -492,7 +531,7 @@ declare const createCompanyResponseSchema: z.ZodObject<{
492
531
  sdi?: string | null | undefined;
493
532
  pec?: string | null | undefined;
494
533
  }>;
495
- adminBy: z.ZodString;
534
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
496
535
  }, "strip", z.ZodTypeAny, {
497
536
  id: string;
498
537
  businessName: string;
@@ -520,7 +559,7 @@ declare const createCompanyResponseSchema: z.ZodObject<{
520
559
  sdi?: string | null | undefined;
521
560
  pec?: string | null | undefined;
522
561
  };
523
- adminBy: string;
562
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
524
563
  }, {
525
564
  id: string;
526
565
  businessName: string;
@@ -550,8 +589,8 @@ declare const createCompanyResponseSchema: z.ZodObject<{
550
589
  };
551
590
  adminBy: string;
552
591
  }>;
553
- type CreateCompanyResponse = CompanyDetails;
554
- declare class CreateCompany extends AbstractApiRequest<CreateCompanyInput, CreateCompanyResponse> {
592
+ type CreateCompanyResponse = z.infer<typeof createCompanyResponseSchema>;
593
+ declare class CreateCompany extends AbstractApiRequest<typeof createCompanyInputSchema, typeof createCompanyResponseSchema> {
555
594
  readonly method = "POST";
556
595
  readonly contentType = "application/json";
557
596
  readonly accept = "application/json";
@@ -736,7 +775,7 @@ declare class CreateCompany extends AbstractApiRequest<CreateCompanyInput, Creat
736
775
  sdi?: string | null | undefined;
737
776
  pec?: string | null | undefined;
738
777
  }>;
739
- adminBy: z.ZodString;
778
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
740
779
  }, "strip", z.ZodTypeAny, {
741
780
  id: string;
742
781
  businessName: string;
@@ -764,7 +803,7 @@ declare class CreateCompany extends AbstractApiRequest<CreateCompanyInput, Creat
764
803
  sdi?: string | null | undefined;
765
804
  pec?: string | null | undefined;
766
805
  };
767
- adminBy: string;
806
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
768
807
  }, {
769
808
  id: string;
770
809
  businessName: string;
@@ -802,7 +841,7 @@ declare class CreateCompany extends AbstractApiRequest<CreateCompanyInput, Creat
802
841
 
803
842
  declare const deleteCompanyInputSchema: z.ZodUndefined;
804
843
  declare const deleteCompanyResponseSchema: z.ZodUndefined;
805
- declare class DeleteCompany extends AbstractApiRequest<void, void> {
844
+ declare class DeleteCompany extends AbstractApiRequest<typeof deleteCompanyInputSchema, typeof deleteCompanyResponseSchema> {
806
845
  readonly method = "DELETE";
807
846
  readonly contentType = "application/json";
808
847
  readonly accept = "application/json";
@@ -853,6 +892,8 @@ declare const getCompaniesQuerySchema: z.ZodObject<{
853
892
  page?: number | undefined;
854
893
  }>;
855
894
  type GetCompaniesQueryParams = z.infer<typeof getCompaniesQuerySchema>;
895
+ declare const getCompaniesInputSchema: z.ZodUndefined;
896
+ type GetCompaniesInput = z.input<typeof getCompaniesInputSchema>;
856
897
  declare const getCompaniesResponseSchema: z.ZodObject<{
857
898
  data: z.ZodArray<z.ZodObject<{
858
899
  id: z.ZodString;
@@ -988,8 +1029,7 @@ declare const getCompaniesResponseSchema: z.ZodObject<{
988
1029
  };
989
1030
  }>;
990
1031
  type GetCompaniesResponse = z.infer<typeof getCompaniesResponseSchema>;
991
- declare const getCompaniesInputSchema: z.ZodUndefined;
992
- declare class GetCompanies extends AbstractApiRequest<void, GetCompaniesResponse, GetCompaniesQueryParams> {
1032
+ declare class GetCompanies extends AbstractApiRequest<typeof getCompaniesInputSchema, typeof getCompaniesResponseSchema, GetCompaniesQueryParams> {
993
1033
  readonly method = "GET";
994
1034
  readonly contentType = "application/json";
995
1035
  readonly accept = "application/json";
@@ -1174,6 +1214,7 @@ declare class GetCompanies extends AbstractApiRequest<void, GetCompaniesResponse
1174
1214
  }
1175
1215
 
1176
1216
  declare const getCompanyDetailsInputSchema: z.ZodUndefined;
1217
+ type GetCompanyDetailsInput = z.input<typeof getCompanyDetailsInputSchema>;
1177
1218
  declare const getCompanyDetailsResponseSchema: z.ZodObject<{
1178
1219
  id: z.ZodString;
1179
1220
  businessName: z.ZodString;
@@ -1242,7 +1283,7 @@ declare const getCompanyDetailsResponseSchema: z.ZodObject<{
1242
1283
  sdi?: string | null | undefined;
1243
1284
  pec?: string | null | undefined;
1244
1285
  }>;
1245
- adminBy: z.ZodString;
1286
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
1246
1287
  }, "strip", z.ZodTypeAny, {
1247
1288
  id: string;
1248
1289
  businessName: string;
@@ -1270,7 +1311,7 @@ declare const getCompanyDetailsResponseSchema: z.ZodObject<{
1270
1311
  sdi?: string | null | undefined;
1271
1312
  pec?: string | null | undefined;
1272
1313
  };
1273
- adminBy: string;
1314
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
1274
1315
  }, {
1275
1316
  id: string;
1276
1317
  businessName: string;
@@ -1301,7 +1342,7 @@ declare const getCompanyDetailsResponseSchema: z.ZodObject<{
1301
1342
  adminBy: string;
1302
1343
  }>;
1303
1344
  type GetCompanyDetailsResponse = CompanyDetails;
1304
- declare class GetCompanyDetails extends AbstractApiRequest<void, GetCompanyDetailsResponse> {
1345
+ declare class GetCompanyDetails extends AbstractApiRequest<typeof getCompanyDetailsInputSchema, typeof getCompanyDetailsResponseSchema> {
1305
1346
  readonly method = "GET";
1306
1347
  readonly contentType = "application/json";
1307
1348
  readonly accept = "application/json";
@@ -1374,7 +1415,7 @@ declare class GetCompanyDetails extends AbstractApiRequest<void, GetCompanyDetai
1374
1415
  sdi?: string | null | undefined;
1375
1416
  pec?: string | null | undefined;
1376
1417
  }>;
1377
- adminBy: z.ZodString;
1418
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
1378
1419
  }, "strip", z.ZodTypeAny, {
1379
1420
  id: string;
1380
1421
  businessName: string;
@@ -1402,7 +1443,7 @@ declare class GetCompanyDetails extends AbstractApiRequest<void, GetCompanyDetai
1402
1443
  sdi?: string | null | undefined;
1403
1444
  pec?: string | null | undefined;
1404
1445
  };
1405
- adminBy: string;
1446
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
1406
1447
  }, {
1407
1448
  id: string;
1408
1449
  businessName: string;
@@ -1552,7 +1593,7 @@ declare const updateCompanyInputSchema: z.ZodObject<{
1552
1593
  pec?: string | null | undefined;
1553
1594
  } | undefined;
1554
1595
  }>;
1555
- type UpdateCompanyInput = z.infer<typeof updateCompanyInputSchema>;
1596
+ type UpdateCompanyInput = z.input<typeof updateCompanyInputSchema>;
1556
1597
  declare const updateCompanyResponseSchema: z.ZodObject<{
1557
1598
  id: z.ZodString;
1558
1599
  businessName: z.ZodString;
@@ -1621,7 +1662,7 @@ declare const updateCompanyResponseSchema: z.ZodObject<{
1621
1662
  sdi?: string | null | undefined;
1622
1663
  pec?: string | null | undefined;
1623
1664
  }>;
1624
- adminBy: z.ZodString;
1665
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
1625
1666
  }, "strip", z.ZodTypeAny, {
1626
1667
  id: string;
1627
1668
  businessName: string;
@@ -1649,7 +1690,7 @@ declare const updateCompanyResponseSchema: z.ZodObject<{
1649
1690
  sdi?: string | null | undefined;
1650
1691
  pec?: string | null | undefined;
1651
1692
  };
1652
- adminBy: string;
1693
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
1653
1694
  }, {
1654
1695
  id: string;
1655
1696
  businessName: string;
@@ -1679,8 +1720,8 @@ declare const updateCompanyResponseSchema: z.ZodObject<{
1679
1720
  };
1680
1721
  adminBy: string;
1681
1722
  }>;
1682
- type UpdateCompanyResponse = CompanyDetails;
1683
- declare class UpdateCompany extends AbstractApiRequest<UpdateCompanyInput, UpdateCompanyResponse> {
1723
+ type UpdateCompanyResponse = z.infer<typeof updateCompanyResponseSchema>;
1724
+ declare class UpdateCompany extends AbstractApiRequest<typeof updateCompanyInputSchema, typeof updateCompanyResponseSchema> {
1684
1725
  readonly method = "PATCH";
1685
1726
  readonly contentType = "application/merge-patch+json";
1686
1727
  readonly accept = "application/json";
@@ -1865,7 +1906,7 @@ declare class UpdateCompany extends AbstractApiRequest<UpdateCompanyInput, Updat
1865
1906
  sdi?: string | null | undefined;
1866
1907
  pec?: string | null | undefined;
1867
1908
  }>;
1868
- adminBy: z.ZodString;
1909
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
1869
1910
  }, "strip", z.ZodTypeAny, {
1870
1911
  id: string;
1871
1912
  businessName: string;
@@ -1893,7 +1934,7 @@ declare class UpdateCompany extends AbstractApiRequest<UpdateCompanyInput, Updat
1893
1934
  sdi?: string | null | undefined;
1894
1935
  pec?: string | null | undefined;
1895
1936
  };
1896
- adminBy: string;
1937
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
1897
1938
  }, {
1898
1939
  id: string;
1899
1940
  businessName: string;
@@ -1930,9 +1971,7 @@ declare class UpdateCompany extends AbstractApiRequest<UpdateCompanyInput, Updat
1930
1971
  getPath(): string;
1931
1972
  }
1932
1973
 
1933
- declare const companyPathSchema: z.ZodEffects<z.ZodString, string, string>;
1934
- type PointOfSalePath = z.infer<typeof companyPathSchema>;
1935
- declare const companyNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
1936
- type PointOfSaleNullablePath = z.infer<typeof companyNullablePathSchema>;
1974
+ declare const companyIriSchema: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/companies/:id">, string>;
1975
+ type CompanyIri = z.infer<typeof companyIriSchema>;
1937
1976
 
1938
- export { type Company, type CompanyDetails, CreateCompany, type CreateCompanyInput, type CreateCompanyResponse, DeleteCompany, GetCompanies, type GetCompaniesQueryParams, type GetCompaniesResponse, GetCompanyDetails, type GetCompanyDetailsResponse, type PointOfSaleNullablePath, type PointOfSalePath, UpdateCompany, type UpdateCompanyInput, type UpdateCompanyResponse, companyDetailsSchema, companyNullablePathSchema, companyPathSchema, companySchema, createCompanyInputSchema, createCompanyResponseSchema, deleteCompanyInputSchema, deleteCompanyResponseSchema, getCompaniesInputSchema, getCompaniesQuerySchema, getCompaniesResponseSchema, getCompanyDetailsInputSchema, getCompanyDetailsResponseSchema, updateCompanyInputSchema, updateCompanyResponseSchema, writableCompanySchema };
1977
+ export { type CompaniesQueryParams, type Company, type CompanyDetails, type CompanyIri, CreateCompany, type CreateCompanyInput, type CreateCompanyResponse, DeleteCompany, GetCompanies, type GetCompaniesInput, type GetCompaniesQueryParams, type GetCompaniesResponse, GetCompanyDetails, type GetCompanyDetailsInput, type GetCompanyDetailsResponse, UpdateCompany, type UpdateCompanyInput, type UpdateCompanyResponse, companiesQuerySchema, companyDetailsSchema, companyIriSchema, companySchema, createCompanyInputSchema, createCompanyResponseSchema, deleteCompanyInputSchema, deleteCompanyResponseSchema, getCompaniesInputSchema, getCompaniesQuerySchema, getCompaniesResponseSchema, getCompanyDetailsInputSchema, getCompanyDetailsResponseSchema, updateCompanyInputSchema, updateCompanyResponseSchema, writableCompanySchema };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
+ import * as _deliverart_sdk_js_global_types from '@deliverart/sdk-js-global-types';
2
+ import { Paginated } from '@deliverart/sdk-js-global-types';
1
3
  import { z } from 'zod';
2
4
  import { AbstractApiRequest } from '@deliverart/sdk-js-core';
3
- import { Paginated } from '@deliverart/sdk-js-global-types';
4
5
  import { AxiosResponse } from 'axios';
5
6
 
6
7
  declare const companySchema: z.ZodObject<{
@@ -132,7 +133,7 @@ declare const companyDetailsSchema: z.ZodObject<{
132
133
  sdi?: string | null | undefined;
133
134
  pec?: string | null | undefined;
134
135
  }>;
135
- adminBy: z.ZodString;
136
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
136
137
  }, "strip", z.ZodTypeAny, {
137
138
  id: string;
138
139
  businessName: string;
@@ -160,7 +161,7 @@ declare const companyDetailsSchema: z.ZodObject<{
160
161
  sdi?: string | null | undefined;
161
162
  pec?: string | null | undefined;
162
163
  };
163
- adminBy: string;
164
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
164
165
  }, {
165
166
  id: string;
166
167
  businessName: string;
@@ -259,7 +260,7 @@ declare const writableCompanySchema: z.ZodObject<Pick<{
259
260
  sdi?: string | null | undefined;
260
261
  pec?: string | null | undefined;
261
262
  }>;
262
- adminBy: z.ZodString;
263
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
263
264
  }, "businessName" | "vat" | "taxCode" | "operationalAddress" | "billingAddress" | "billingData">, "strip", z.ZodTypeAny, {
264
265
  businessName: string;
265
266
  vat: string;
@@ -309,6 +310,44 @@ declare const writableCompanySchema: z.ZodObject<Pick<{
309
310
  pec?: string | null | undefined;
310
311
  };
311
312
  }>;
313
+ declare const companiesQuerySchema: z.ZodObject<{
314
+ businessName: z.ZodOptional<z.ZodString>;
315
+ vat: z.ZodOptional<z.ZodString>;
316
+ taxCode: z.ZodOptional<z.ZodString>;
317
+ 'billingAddress.city': z.ZodOptional<z.ZodString>;
318
+ 'billingAddress.postalCode': z.ZodOptional<z.ZodString>;
319
+ 'operationalAddress.city': z.ZodOptional<z.ZodString>;
320
+ 'operationalAddress.postalCode': z.ZodOptional<z.ZodString>;
321
+ 'order[businessName]': z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
322
+ 'order[createdAt]': z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
323
+ 'order[updatedAt]': z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
324
+ page: z.ZodOptional<z.ZodNumber>;
325
+ }, "strip", z.ZodTypeAny, {
326
+ businessName?: string | undefined;
327
+ vat?: string | undefined;
328
+ taxCode?: string | undefined;
329
+ 'billingAddress.city'?: string | undefined;
330
+ 'billingAddress.postalCode'?: string | undefined;
331
+ 'operationalAddress.city'?: string | undefined;
332
+ 'operationalAddress.postalCode'?: string | undefined;
333
+ 'order[businessName]'?: "asc" | "desc" | undefined;
334
+ 'order[createdAt]'?: "asc" | "desc" | undefined;
335
+ 'order[updatedAt]'?: "asc" | "desc" | undefined;
336
+ page?: number | undefined;
337
+ }, {
338
+ businessName?: string | undefined;
339
+ vat?: string | undefined;
340
+ taxCode?: string | undefined;
341
+ 'billingAddress.city'?: string | undefined;
342
+ 'billingAddress.postalCode'?: string | undefined;
343
+ 'operationalAddress.city'?: string | undefined;
344
+ 'operationalAddress.postalCode'?: string | undefined;
345
+ 'order[businessName]'?: "asc" | "desc" | undefined;
346
+ 'order[createdAt]'?: "asc" | "desc" | undefined;
347
+ 'order[updatedAt]'?: "asc" | "desc" | undefined;
348
+ page?: number | undefined;
349
+ }>;
350
+ type CompaniesQueryParams = z.infer<typeof companiesQuerySchema>;
312
351
 
313
352
  declare const createCompanyInputSchema: z.ZodObject<{
314
353
  businessName: z.ZodString;
@@ -423,7 +462,7 @@ declare const createCompanyInputSchema: z.ZodObject<{
423
462
  pec?: string | null | undefined;
424
463
  };
425
464
  }>;
426
- type CreateCompanyInput = z.infer<typeof createCompanyInputSchema>;
465
+ type CreateCompanyInput = z.input<typeof createCompanyInputSchema>;
427
466
  declare const createCompanyResponseSchema: z.ZodObject<{
428
467
  id: z.ZodString;
429
468
  businessName: z.ZodString;
@@ -492,7 +531,7 @@ declare const createCompanyResponseSchema: z.ZodObject<{
492
531
  sdi?: string | null | undefined;
493
532
  pec?: string | null | undefined;
494
533
  }>;
495
- adminBy: z.ZodString;
534
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
496
535
  }, "strip", z.ZodTypeAny, {
497
536
  id: string;
498
537
  businessName: string;
@@ -520,7 +559,7 @@ declare const createCompanyResponseSchema: z.ZodObject<{
520
559
  sdi?: string | null | undefined;
521
560
  pec?: string | null | undefined;
522
561
  };
523
- adminBy: string;
562
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
524
563
  }, {
525
564
  id: string;
526
565
  businessName: string;
@@ -550,8 +589,8 @@ declare const createCompanyResponseSchema: z.ZodObject<{
550
589
  };
551
590
  adminBy: string;
552
591
  }>;
553
- type CreateCompanyResponse = CompanyDetails;
554
- declare class CreateCompany extends AbstractApiRequest<CreateCompanyInput, CreateCompanyResponse> {
592
+ type CreateCompanyResponse = z.infer<typeof createCompanyResponseSchema>;
593
+ declare class CreateCompany extends AbstractApiRequest<typeof createCompanyInputSchema, typeof createCompanyResponseSchema> {
555
594
  readonly method = "POST";
556
595
  readonly contentType = "application/json";
557
596
  readonly accept = "application/json";
@@ -736,7 +775,7 @@ declare class CreateCompany extends AbstractApiRequest<CreateCompanyInput, Creat
736
775
  sdi?: string | null | undefined;
737
776
  pec?: string | null | undefined;
738
777
  }>;
739
- adminBy: z.ZodString;
778
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
740
779
  }, "strip", z.ZodTypeAny, {
741
780
  id: string;
742
781
  businessName: string;
@@ -764,7 +803,7 @@ declare class CreateCompany extends AbstractApiRequest<CreateCompanyInput, Creat
764
803
  sdi?: string | null | undefined;
765
804
  pec?: string | null | undefined;
766
805
  };
767
- adminBy: string;
806
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
768
807
  }, {
769
808
  id: string;
770
809
  businessName: string;
@@ -802,7 +841,7 @@ declare class CreateCompany extends AbstractApiRequest<CreateCompanyInput, Creat
802
841
 
803
842
  declare const deleteCompanyInputSchema: z.ZodUndefined;
804
843
  declare const deleteCompanyResponseSchema: z.ZodUndefined;
805
- declare class DeleteCompany extends AbstractApiRequest<void, void> {
844
+ declare class DeleteCompany extends AbstractApiRequest<typeof deleteCompanyInputSchema, typeof deleteCompanyResponseSchema> {
806
845
  readonly method = "DELETE";
807
846
  readonly contentType = "application/json";
808
847
  readonly accept = "application/json";
@@ -853,6 +892,8 @@ declare const getCompaniesQuerySchema: z.ZodObject<{
853
892
  page?: number | undefined;
854
893
  }>;
855
894
  type GetCompaniesQueryParams = z.infer<typeof getCompaniesQuerySchema>;
895
+ declare const getCompaniesInputSchema: z.ZodUndefined;
896
+ type GetCompaniesInput = z.input<typeof getCompaniesInputSchema>;
856
897
  declare const getCompaniesResponseSchema: z.ZodObject<{
857
898
  data: z.ZodArray<z.ZodObject<{
858
899
  id: z.ZodString;
@@ -988,8 +1029,7 @@ declare const getCompaniesResponseSchema: z.ZodObject<{
988
1029
  };
989
1030
  }>;
990
1031
  type GetCompaniesResponse = z.infer<typeof getCompaniesResponseSchema>;
991
- declare const getCompaniesInputSchema: z.ZodUndefined;
992
- declare class GetCompanies extends AbstractApiRequest<void, GetCompaniesResponse, GetCompaniesQueryParams> {
1032
+ declare class GetCompanies extends AbstractApiRequest<typeof getCompaniesInputSchema, typeof getCompaniesResponseSchema, GetCompaniesQueryParams> {
993
1033
  readonly method = "GET";
994
1034
  readonly contentType = "application/json";
995
1035
  readonly accept = "application/json";
@@ -1174,6 +1214,7 @@ declare class GetCompanies extends AbstractApiRequest<void, GetCompaniesResponse
1174
1214
  }
1175
1215
 
1176
1216
  declare const getCompanyDetailsInputSchema: z.ZodUndefined;
1217
+ type GetCompanyDetailsInput = z.input<typeof getCompanyDetailsInputSchema>;
1177
1218
  declare const getCompanyDetailsResponseSchema: z.ZodObject<{
1178
1219
  id: z.ZodString;
1179
1220
  businessName: z.ZodString;
@@ -1242,7 +1283,7 @@ declare const getCompanyDetailsResponseSchema: z.ZodObject<{
1242
1283
  sdi?: string | null | undefined;
1243
1284
  pec?: string | null | undefined;
1244
1285
  }>;
1245
- adminBy: z.ZodString;
1286
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
1246
1287
  }, "strip", z.ZodTypeAny, {
1247
1288
  id: string;
1248
1289
  businessName: string;
@@ -1270,7 +1311,7 @@ declare const getCompanyDetailsResponseSchema: z.ZodObject<{
1270
1311
  sdi?: string | null | undefined;
1271
1312
  pec?: string | null | undefined;
1272
1313
  };
1273
- adminBy: string;
1314
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
1274
1315
  }, {
1275
1316
  id: string;
1276
1317
  businessName: string;
@@ -1301,7 +1342,7 @@ declare const getCompanyDetailsResponseSchema: z.ZodObject<{
1301
1342
  adminBy: string;
1302
1343
  }>;
1303
1344
  type GetCompanyDetailsResponse = CompanyDetails;
1304
- declare class GetCompanyDetails extends AbstractApiRequest<void, GetCompanyDetailsResponse> {
1345
+ declare class GetCompanyDetails extends AbstractApiRequest<typeof getCompanyDetailsInputSchema, typeof getCompanyDetailsResponseSchema> {
1305
1346
  readonly method = "GET";
1306
1347
  readonly contentType = "application/json";
1307
1348
  readonly accept = "application/json";
@@ -1374,7 +1415,7 @@ declare class GetCompanyDetails extends AbstractApiRequest<void, GetCompanyDetai
1374
1415
  sdi?: string | null | undefined;
1375
1416
  pec?: string | null | undefined;
1376
1417
  }>;
1377
- adminBy: z.ZodString;
1418
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
1378
1419
  }, "strip", z.ZodTypeAny, {
1379
1420
  id: string;
1380
1421
  businessName: string;
@@ -1402,7 +1443,7 @@ declare class GetCompanyDetails extends AbstractApiRequest<void, GetCompanyDetai
1402
1443
  sdi?: string | null | undefined;
1403
1444
  pec?: string | null | undefined;
1404
1445
  };
1405
- adminBy: string;
1446
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
1406
1447
  }, {
1407
1448
  id: string;
1408
1449
  businessName: string;
@@ -1552,7 +1593,7 @@ declare const updateCompanyInputSchema: z.ZodObject<{
1552
1593
  pec?: string | null | undefined;
1553
1594
  } | undefined;
1554
1595
  }>;
1555
- type UpdateCompanyInput = z.infer<typeof updateCompanyInputSchema>;
1596
+ type UpdateCompanyInput = z.input<typeof updateCompanyInputSchema>;
1556
1597
  declare const updateCompanyResponseSchema: z.ZodObject<{
1557
1598
  id: z.ZodString;
1558
1599
  businessName: z.ZodString;
@@ -1621,7 +1662,7 @@ declare const updateCompanyResponseSchema: z.ZodObject<{
1621
1662
  sdi?: string | null | undefined;
1622
1663
  pec?: string | null | undefined;
1623
1664
  }>;
1624
- adminBy: z.ZodString;
1665
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
1625
1666
  }, "strip", z.ZodTypeAny, {
1626
1667
  id: string;
1627
1668
  businessName: string;
@@ -1649,7 +1690,7 @@ declare const updateCompanyResponseSchema: z.ZodObject<{
1649
1690
  sdi?: string | null | undefined;
1650
1691
  pec?: string | null | undefined;
1651
1692
  };
1652
- adminBy: string;
1693
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
1653
1694
  }, {
1654
1695
  id: string;
1655
1696
  businessName: string;
@@ -1679,8 +1720,8 @@ declare const updateCompanyResponseSchema: z.ZodObject<{
1679
1720
  };
1680
1721
  adminBy: string;
1681
1722
  }>;
1682
- type UpdateCompanyResponse = CompanyDetails;
1683
- declare class UpdateCompany extends AbstractApiRequest<UpdateCompanyInput, UpdateCompanyResponse> {
1723
+ type UpdateCompanyResponse = z.infer<typeof updateCompanyResponseSchema>;
1724
+ declare class UpdateCompany extends AbstractApiRequest<typeof updateCompanyInputSchema, typeof updateCompanyResponseSchema> {
1684
1725
  readonly method = "PATCH";
1685
1726
  readonly contentType = "application/merge-patch+json";
1686
1727
  readonly accept = "application/json";
@@ -1865,7 +1906,7 @@ declare class UpdateCompany extends AbstractApiRequest<UpdateCompanyInput, Updat
1865
1906
  sdi?: string | null | undefined;
1866
1907
  pec?: string | null | undefined;
1867
1908
  }>;
1868
- adminBy: z.ZodString;
1909
+ adminBy: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/users/:id">, string>;
1869
1910
  }, "strip", z.ZodTypeAny, {
1870
1911
  id: string;
1871
1912
  businessName: string;
@@ -1893,7 +1934,7 @@ declare class UpdateCompany extends AbstractApiRequest<UpdateCompanyInput, Updat
1893
1934
  sdi?: string | null | undefined;
1894
1935
  pec?: string | null | undefined;
1895
1936
  };
1896
- adminBy: string;
1937
+ adminBy: _deliverart_sdk_js_global_types.IriObject<"/users/:id">;
1897
1938
  }, {
1898
1939
  id: string;
1899
1940
  businessName: string;
@@ -1930,9 +1971,7 @@ declare class UpdateCompany extends AbstractApiRequest<UpdateCompanyInput, Updat
1930
1971
  getPath(): string;
1931
1972
  }
1932
1973
 
1933
- declare const companyPathSchema: z.ZodEffects<z.ZodString, string, string>;
1934
- type PointOfSalePath = z.infer<typeof companyPathSchema>;
1935
- declare const companyNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
1936
- type PointOfSaleNullablePath = z.infer<typeof companyNullablePathSchema>;
1974
+ declare const companyIriSchema: z.ZodEffects<z.ZodString, _deliverart_sdk_js_global_types.IriObject<"/companies/:id">, string>;
1975
+ type CompanyIri = z.infer<typeof companyIriSchema>;
1937
1976
 
1938
- export { type Company, type CompanyDetails, CreateCompany, type CreateCompanyInput, type CreateCompanyResponse, DeleteCompany, GetCompanies, type GetCompaniesQueryParams, type GetCompaniesResponse, GetCompanyDetails, type GetCompanyDetailsResponse, type PointOfSaleNullablePath, type PointOfSalePath, UpdateCompany, type UpdateCompanyInput, type UpdateCompanyResponse, companyDetailsSchema, companyNullablePathSchema, companyPathSchema, companySchema, createCompanyInputSchema, createCompanyResponseSchema, deleteCompanyInputSchema, deleteCompanyResponseSchema, getCompaniesInputSchema, getCompaniesQuerySchema, getCompaniesResponseSchema, getCompanyDetailsInputSchema, getCompanyDetailsResponseSchema, updateCompanyInputSchema, updateCompanyResponseSchema, writableCompanySchema };
1977
+ export { type CompaniesQueryParams, type Company, type CompanyDetails, type CompanyIri, CreateCompany, type CreateCompanyInput, type CreateCompanyResponse, DeleteCompany, GetCompanies, type GetCompaniesInput, type GetCompaniesQueryParams, type GetCompaniesResponse, GetCompanyDetails, type GetCompanyDetailsInput, type GetCompanyDetailsResponse, UpdateCompany, type UpdateCompanyInput, type UpdateCompanyResponse, companiesQuerySchema, companyDetailsSchema, companyIriSchema, companySchema, createCompanyInputSchema, createCompanyResponseSchema, deleteCompanyInputSchema, deleteCompanyResponseSchema, getCompaniesInputSchema, getCompaniesQuerySchema, getCompaniesResponseSchema, getCompanyDetailsInputSchema, getCompanyDetailsResponseSchema, updateCompanyInputSchema, updateCompanyResponseSchema, writableCompanySchema };
package/dist/index.js CHANGED
@@ -1,5 +1,11 @@
1
1
  // src/models.ts
2
- import { addressSchema, billingDataSchema, datetimeSchema } from "@deliverart/sdk-js-global-types";
2
+ import {
3
+ addressSchema,
4
+ billingDataSchema,
5
+ datetimeSchema,
6
+ sortDirSchema
7
+ } from "@deliverart/sdk-js-global-types";
8
+ import { userIriSchema } from "@deliverart/sdk-js-user";
3
9
  import { z } from "zod";
4
10
  var companySchema = z.object({
5
11
  id: z.string(),
@@ -13,7 +19,7 @@ var companySchema = z.object({
13
19
  var companyDetailsSchema = companySchema.extend({
14
20
  billingAddress: addressSchema,
15
21
  billingData: billingDataSchema,
16
- adminBy: z.string()
22
+ adminBy: userIriSchema
17
23
  });
18
24
  var writableCompanySchema = companyDetailsSchema.pick({
19
25
  businessName: true,
@@ -23,6 +29,19 @@ var writableCompanySchema = companyDetailsSchema.pick({
23
29
  operationalAddress: true,
24
30
  billingData: true
25
31
  });
32
+ var companiesQuerySchema = z.object({
33
+ businessName: z.string().optional(),
34
+ vat: z.string().optional(),
35
+ taxCode: z.string().optional(),
36
+ "billingAddress.city": z.string().optional(),
37
+ "billingAddress.postalCode": z.string().optional(),
38
+ "operationalAddress.city": z.string().optional(),
39
+ "operationalAddress.postalCode": z.string().optional(),
40
+ "order[businessName]": sortDirSchema.optional(),
41
+ "order[createdAt]": sortDirSchema.optional(),
42
+ "order[updatedAt]": sortDirSchema.optional(),
43
+ page: z.coerce.number().optional()
44
+ });
26
45
 
27
46
  // src/requests/CreateCompany.ts
28
47
  import { AbstractApiRequest } from "@deliverart/sdk-js-core";
@@ -59,7 +78,7 @@ var DeleteCompany = class extends AbstractApiRequest2 {
59
78
  headersSchema = void 0;
60
79
  companyId;
61
80
  constructor(companyId) {
62
- super();
81
+ super(void 0);
63
82
  this.companyId = companyId;
64
83
  }
65
84
  getPath() {
@@ -71,25 +90,12 @@ var DeleteCompany = class extends AbstractApiRequest2 {
71
90
  import { AbstractApiRequest as AbstractApiRequest3 } from "@deliverart/sdk-js-core";
72
91
  import {
73
92
  createPaginatedSchema,
74
- responseToPagination,
75
- sortDirSchema
93
+ responseToPagination
76
94
  } from "@deliverart/sdk-js-global-types";
77
95
  import { z as z3 } from "zod";
78
- var getCompaniesQuerySchema = z3.object({
79
- businessName: z3.string().optional(),
80
- vat: z3.string().optional(),
81
- taxCode: z3.string().optional(),
82
- "billingAddress.city": z3.string().optional(),
83
- "billingAddress.postalCode": z3.string().optional(),
84
- "operationalAddress.city": z3.string().optional(),
85
- "operationalAddress.postalCode": z3.string().optional(),
86
- "order[businessName]": sortDirSchema.optional(),
87
- "order[createdAt]": sortDirSchema.optional(),
88
- "order[updatedAt]": sortDirSchema.optional(),
89
- page: z3.coerce.number().optional()
90
- });
91
- var getCompaniesResponseSchema = createPaginatedSchema(companySchema);
96
+ var getCompaniesQuerySchema = companiesQuerySchema;
92
97
  var getCompaniesInputSchema = z3.undefined();
98
+ var getCompaniesResponseSchema = createPaginatedSchema(companySchema);
93
99
  var GetCompanies = class extends AbstractApiRequest3 {
94
100
  method = "GET";
95
101
  contentType = "application/json";
@@ -125,7 +131,7 @@ var GetCompanyDetails = class extends AbstractApiRequest4 {
125
131
  headersSchema = void 0;
126
132
  companyId;
127
133
  constructor(companyId) {
128
- super();
134
+ super(void 0);
129
135
  this.companyId = companyId;
130
136
  }
131
137
  getPath() {
@@ -156,28 +162,17 @@ var UpdateCompany = class extends AbstractApiRequest5 {
156
162
  };
157
163
 
158
164
  // src/types.ts
159
- import { z as z5 } from "zod";
160
- var companyPathSchema = z5.string().refine((val) => /^\/companies\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
161
- message: "Invalid integration path format"
162
- });
163
- var companyNullablePathSchema = z5.string().nullable().refine(
164
- (val) => {
165
- if (!val) return true;
166
- return /^\/companies\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
167
- },
168
- {
169
- message: "Invalid integration path format"
170
- }
171
- );
165
+ import { iriSchema } from "@deliverart/sdk-js-global-types";
166
+ var companyIriSchema = iriSchema("/companies/:id");
172
167
  export {
173
168
  CreateCompany,
174
169
  DeleteCompany,
175
170
  GetCompanies,
176
171
  GetCompanyDetails,
177
172
  UpdateCompany,
173
+ companiesQuerySchema,
178
174
  companyDetailsSchema,
179
- companyNullablePathSchema,
180
- companyPathSchema,
175
+ companyIriSchema,
181
176
  companySchema,
182
177
  createCompanyInputSchema,
183
178
  createCompanyResponseSchema,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deliverart/sdk-js-company",
3
3
  "description": "Deliverart JavaScript SDK for User Management",
4
- "version": "0.0.8",
4
+ "version": "0.1.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -12,10 +12,11 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "zod": "3.25.67",
15
+ "@deliverart/sdk-js-core": "0.2.0",
16
+ "@deliverart/sdk-js-global-types": "0.0.17",
17
+ "@deliverart/sdk-js-user": "0.3.0",
16
18
  "axios": "1.9.0",
17
- "@deliverart/sdk-js-core": "0.1.4",
18
- "@deliverart/sdk-js-global-types": "0.0.16"
19
+ "zod": "3.25.67"
19
20
  },
20
21
  "devDependencies": {
21
22
  "@changesets/cli": "^2.29.4",
package/src/models.ts CHANGED
@@ -1,4 +1,10 @@
1
- import { addressSchema, billingDataSchema, datetimeSchema } from '@deliverart/sdk-js-global-types'
1
+ import {
2
+ addressSchema,
3
+ billingDataSchema,
4
+ datetimeSchema,
5
+ sortDirSchema,
6
+ } from '@deliverart/sdk-js-global-types'
7
+ import { userIriSchema } from '@deliverart/sdk-js-user'
2
8
  import { z } from 'zod'
3
9
 
4
10
  export const companySchema = z.object({
@@ -15,7 +21,7 @@ export type Company = z.infer<typeof companySchema>
15
21
  export const companyDetailsSchema = companySchema.extend({
16
22
  billingAddress: addressSchema,
17
23
  billingData: billingDataSchema,
18
- adminBy: z.string(),
24
+ adminBy: userIriSchema,
19
25
  })
20
26
  export type CompanyDetails = z.infer<typeof companyDetailsSchema>
21
27
 
@@ -27,3 +33,18 @@ export const writableCompanySchema = companyDetailsSchema.pick({
27
33
  operationalAddress: true,
28
34
  billingData: true,
29
35
  })
36
+
37
+ export const companiesQuerySchema = z.object({
38
+ businessName: z.string().optional(),
39
+ vat: z.string().optional(),
40
+ taxCode: z.string().optional(),
41
+ 'billingAddress.city': z.string().optional(),
42
+ 'billingAddress.postalCode': z.string().optional(),
43
+ 'operationalAddress.city': z.string().optional(),
44
+ 'operationalAddress.postalCode': z.string().optional(),
45
+ 'order[businessName]': sortDirSchema.optional(),
46
+ 'order[createdAt]': sortDirSchema.optional(),
47
+ 'order[updatedAt]': sortDirSchema.optional(),
48
+ page: z.coerce.number().optional(),
49
+ })
50
+ export type CompaniesQueryParams = z.infer<typeof companiesQuerySchema>
@@ -1,15 +1,18 @@
1
1
  import { AbstractApiRequest } from '@deliverart/sdk-js-core'
2
2
  import { z } from 'zod'
3
3
 
4
- import { CompanyDetails, companyDetailsSchema, writableCompanySchema } from '../models'
4
+ import { companyDetailsSchema, writableCompanySchema } from '../models'
5
5
 
6
6
  export const createCompanyInputSchema = writableCompanySchema.required()
7
- export type CreateCompanyInput = z.infer<typeof createCompanyInputSchema>
7
+ export type CreateCompanyInput = z.input<typeof createCompanyInputSchema>
8
8
 
9
9
  export const createCompanyResponseSchema = companyDetailsSchema
10
- export type CreateCompanyResponse = CompanyDetails
10
+ export type CreateCompanyResponse = z.infer<typeof createCompanyResponseSchema>
11
11
 
12
- export class CreateCompany extends AbstractApiRequest<CreateCompanyInput, CreateCompanyResponse> {
12
+ export class CreateCompany extends AbstractApiRequest<
13
+ typeof createCompanyInputSchema,
14
+ typeof createCompanyResponseSchema
15
+ > {
13
16
  readonly method = 'POST'
14
17
  readonly contentType = 'application/json'
15
18
  readonly accept = 'application/json'
@@ -4,7 +4,10 @@ import { z } from 'zod'
4
4
  export const deleteCompanyInputSchema = z.undefined()
5
5
  export const deleteCompanyResponseSchema = z.undefined()
6
6
 
7
- export class DeleteCompany extends AbstractApiRequest<void, void> {
7
+ export class DeleteCompany extends AbstractApiRequest<
8
+ typeof deleteCompanyInputSchema,
9
+ typeof deleteCompanyResponseSchema
10
+ > {
8
11
  readonly method = 'DELETE'
9
12
  readonly contentType = 'application/json'
10
13
  readonly accept = 'application/json'
@@ -17,7 +20,7 @@ export class DeleteCompany extends AbstractApiRequest<void, void> {
17
20
  private readonly companyId: string
18
21
 
19
22
  constructor(companyId: string) {
20
- super()
23
+ super(undefined)
21
24
  this.companyId = companyId
22
25
  }
23
26
 
@@ -3,36 +3,24 @@ import {
3
3
  createPaginatedSchema,
4
4
  Paginated,
5
5
  responseToPagination,
6
- sortDirSchema,
7
6
  } from '@deliverart/sdk-js-global-types'
8
7
  import { AxiosResponse } from 'axios'
9
8
  import { z } from 'zod'
10
9
 
11
- import { Company, companySchema } from '../models'
12
-
13
- export const getCompaniesQuerySchema = z.object({
14
- businessName: z.string().optional(),
15
- vat: z.string().optional(),
16
- taxCode: z.string().optional(),
17
- 'billingAddress.city': z.string().optional(),
18
- 'billingAddress.postalCode': z.string().optional(),
19
- 'operationalAddress.city': z.string().optional(),
20
- 'operationalAddress.postalCode': z.string().optional(),
21
- 'order[businessName]': sortDirSchema.optional(),
22
- 'order[createdAt]': sortDirSchema.optional(),
23
- 'order[updatedAt]': sortDirSchema.optional(),
24
- page: z.coerce.number().optional(),
25
- })
10
+ import { companiesQuerySchema, Company, companySchema } from '../models'
11
+
12
+ export const getCompaniesQuerySchema = companiesQuerySchema
26
13
  export type GetCompaniesQueryParams = z.infer<typeof getCompaniesQuerySchema>
27
14
 
15
+ export const getCompaniesInputSchema = z.undefined()
16
+ export type GetCompaniesInput = z.input<typeof getCompaniesInputSchema>
17
+
28
18
  export const getCompaniesResponseSchema = createPaginatedSchema(companySchema)
29
19
  export type GetCompaniesResponse = z.infer<typeof getCompaniesResponseSchema>
30
20
 
31
- export const getCompaniesInputSchema = z.undefined()
32
-
33
21
  export class GetCompanies extends AbstractApiRequest<
34
- void,
35
- GetCompaniesResponse,
22
+ typeof getCompaniesInputSchema,
23
+ typeof getCompaniesResponseSchema,
36
24
  GetCompaniesQueryParams
37
25
  > {
38
26
  readonly method = 'GET'
@@ -4,11 +4,15 @@ import { z } from 'zod'
4
4
  import { CompanyDetails, companyDetailsSchema } from '../models'
5
5
 
6
6
  export const getCompanyDetailsInputSchema = z.undefined()
7
+ export type GetCompanyDetailsInput = z.input<typeof getCompanyDetailsInputSchema>
7
8
 
8
9
  export const getCompanyDetailsResponseSchema = companyDetailsSchema
9
10
  export type GetCompanyDetailsResponse = CompanyDetails
10
11
 
11
- export class GetCompanyDetails extends AbstractApiRequest<void, GetCompanyDetailsResponse> {
12
+ export class GetCompanyDetails extends AbstractApiRequest<
13
+ typeof getCompanyDetailsInputSchema,
14
+ typeof getCompanyDetailsResponseSchema
15
+ > {
12
16
  readonly method = 'GET'
13
17
  readonly contentType = 'application/json'
14
18
  readonly accept = 'application/json'
@@ -20,7 +24,7 @@ export class GetCompanyDetails extends AbstractApiRequest<void, GetCompanyDetail
20
24
  private readonly companyId: string
21
25
 
22
26
  constructor(companyId: string) {
23
- super()
27
+ super(undefined)
24
28
  this.companyId = companyId
25
29
  }
26
30
 
@@ -1,15 +1,18 @@
1
1
  import { AbstractApiRequest } from '@deliverart/sdk-js-core'
2
2
  import { z } from 'zod'
3
3
 
4
- import { CompanyDetails, companyDetailsSchema, writableCompanySchema } from '../models'
4
+ import { companyDetailsSchema, writableCompanySchema } from '../models'
5
5
 
6
6
  export const updateCompanyInputSchema = writableCompanySchema.partial()
7
- export type UpdateCompanyInput = z.infer<typeof updateCompanyInputSchema>
7
+ export type UpdateCompanyInput = z.input<typeof updateCompanyInputSchema>
8
8
 
9
9
  export const updateCompanyResponseSchema = companyDetailsSchema
10
- export type UpdateCompanyResponse = CompanyDetails
10
+ export type UpdateCompanyResponse = z.infer<typeof updateCompanyResponseSchema>
11
11
 
12
- export class UpdateCompany extends AbstractApiRequest<UpdateCompanyInput, UpdateCompanyResponse> {
12
+ export class UpdateCompany extends AbstractApiRequest<
13
+ typeof updateCompanyInputSchema,
14
+ typeof updateCompanyResponseSchema
15
+ > {
13
16
  readonly method = 'PATCH'
14
17
  readonly contentType = 'application/merge-patch+json'
15
18
  readonly accept = 'application/json'
package/src/types.ts CHANGED
@@ -1,22 +1,5 @@
1
+ import { iriSchema } from '@deliverart/sdk-js-global-types'
1
2
  import { z } from 'zod'
2
3
 
3
- export const companyPathSchema = z
4
- .string()
5
- .refine(val => /^\/companies\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
6
- message: 'Invalid integration path format',
7
- })
8
- export type PointOfSalePath = z.infer<typeof companyPathSchema>
9
-
10
- export const companyNullablePathSchema = z
11
- .string()
12
- .nullable()
13
- .refine(
14
- val => {
15
- if (!val) return true
16
- return /^\/companies\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val)
17
- },
18
- {
19
- message: 'Invalid integration path format',
20
- },
21
- )
22
- export type PointOfSaleNullablePath = z.infer<typeof companyNullablePathSchema>
4
+ export const companyIriSchema = iriSchema('/companies/:id')
5
+ export type CompanyIri = z.infer<typeof companyIriSchema>