@deliverart/sdk-js-company 2.35.3-dev.0 → 2.35.4-dev.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/README.md +6 -0
- package/dist/index.cjs +16 -2
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +16 -8
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -514,3 +514,9 @@ import type {
|
|
|
514
514
|
|
|
515
515
|
MIT
|
|
516
516
|
|
|
517
|
+
|
|
518
|
+
## Administrative creation
|
|
519
|
+
|
|
520
|
+
`CreateCompany` links the existing user referenced by `adminBy`; it does not create an account, send an invitation, or grant manager roles. Admin interfaces should select an existing active manager. Lead initialization is a separate API workflow that can create a manager.
|
|
521
|
+
|
|
522
|
+
For VAT numbers starting with `IT`, provide `billingData` with both `sdi` and `pec` keys and at least one non-empty value. Other countries can use `{ sdi: null, pec: null }`. Company response validation does not impose Italian invoicing rules on foreign companies. PATCH defers conditional VAT requirements to the API, which can validate the complete persisted company.
|
package/dist/index.cjs
CHANGED
|
@@ -27,6 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
GetUserCompanies: () => GetUserCompanies,
|
|
28
28
|
UpdateCompany: () => UpdateCompany,
|
|
29
29
|
companiesQuerySchema: () => companiesQuerySchema,
|
|
30
|
+
companyBillingDataSchema: () => companyBillingDataSchema,
|
|
30
31
|
companyDetailsSchema: () => companyDetailsSchema,
|
|
31
32
|
companyIriSchema: () => companyIriSchema,
|
|
32
33
|
companyNullableIriSchema: () => companyNullableIriSchema,
|
|
@@ -62,9 +63,13 @@ var companySchema = import_zod.z.object({
|
|
|
62
63
|
createdAt: import_sdk_js_global_types.datetimeSchema,
|
|
63
64
|
updatedAt: import_sdk_js_global_types.datetimeSchema
|
|
64
65
|
});
|
|
66
|
+
var companyBillingDataSchema = import_zod.z.object({
|
|
67
|
+
sdi: import_zod.z.string().trim().optional().nullable(),
|
|
68
|
+
pec: import_zod.z.email({ message: "Invalid email format" }).optional().nullable()
|
|
69
|
+
});
|
|
65
70
|
var companyDetailsSchema = companySchema.extend({
|
|
66
71
|
billingAddress: import_sdk_js_global_types.addressSchema,
|
|
67
|
-
billingData:
|
|
72
|
+
billingData: companyBillingDataSchema,
|
|
68
73
|
adminBy: import_sdk_js_user.userIriSchema
|
|
69
74
|
});
|
|
70
75
|
var writableCompanySchema = companyDetailsSchema.pick({
|
|
@@ -93,7 +98,15 @@ var companiesQuerySchema = import_zod.z.object({
|
|
|
93
98
|
|
|
94
99
|
// src/requests/CreateCompany.ts
|
|
95
100
|
var import_sdk_js_core = require("@deliverart/sdk-js-core");
|
|
96
|
-
var createCompanyInputSchema = writableCompanySchema.required()
|
|
101
|
+
var createCompanyInputSchema = writableCompanySchema.required().superRefine((value, context) => {
|
|
102
|
+
if (value.vat.startsWith("IT") && !value.billingData.sdi?.trim() && !value.billingData.pec) {
|
|
103
|
+
context.addIssue({
|
|
104
|
+
code: "custom",
|
|
105
|
+
path: ["billingData", "sdi"],
|
|
106
|
+
message: "At least one of SDI or PEC must be provided for Italian VAT numbers"
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
97
110
|
var createCompanyResponseSchema = companyDetailsSchema;
|
|
98
111
|
var CreateCompany = class extends import_sdk_js_core.AbstractApiRequest {
|
|
99
112
|
constructor(input) {
|
|
@@ -240,6 +253,7 @@ var companyNullableIriSchema = (0, import_sdk_js_global_types4.iriNullableSchema
|
|
|
240
253
|
GetUserCompanies,
|
|
241
254
|
UpdateCompany,
|
|
242
255
|
companiesQuerySchema,
|
|
256
|
+
companyBillingDataSchema,
|
|
243
257
|
companyDetailsSchema,
|
|
244
258
|
companyIriSchema,
|
|
245
259
|
companyNullableIriSchema,
|
package/dist/index.d.cts
CHANGED
|
@@ -19,6 +19,10 @@ declare const companySchema: z.ZodObject<{
|
|
|
19
19
|
updatedAt: z.ZodString;
|
|
20
20
|
}, z.core.$strip>;
|
|
21
21
|
type Company = z.infer<typeof companySchema>;
|
|
22
|
+
declare const companyBillingDataSchema: z.ZodObject<{
|
|
23
|
+
sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
24
|
+
pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
22
26
|
declare const companyDetailsSchema: z.ZodObject<{
|
|
23
27
|
id: z.ZodString;
|
|
24
28
|
businessName: z.ZodString;
|
|
@@ -676,4 +680,4 @@ type CompanyIri = z.infer<typeof companyIriSchema>;
|
|
|
676
680
|
declare const companyNullableIriSchema: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/companies/:id"> | null, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/companies/:id"> | null, unknown>>;
|
|
677
681
|
type CompanyNullableIri = z.infer<typeof companyNullableIriSchema>;
|
|
678
682
|
|
|
679
|
-
export { type CompaniesQueryParams, type Company, type CompanyDetails, type CompanyIri, type CompanyNullableIri, CreateCompany, type CreateCompanyInput, type CreateCompanyResponse, DeleteCompany, GetCompanies, type GetCompaniesInput, type GetCompaniesQueryParams, type GetCompaniesResponse, GetCompanyDetails, type GetCompanyDetailsInput, type GetCompanyDetailsResponse, GetUserCompanies, type GetUserCompaniesInput, type GetUserCompaniesQueryParams, type GetUserCompaniesResponse, UpdateCompany, type UpdateCompanyInput, type UpdateCompanyResponse, companiesQuerySchema, companyDetailsSchema, companyIriSchema, companyNullableIriSchema, companySchema, createCompanyInputSchema, createCompanyResponseSchema, deleteCompanyInputSchema, deleteCompanyResponseSchema, getCompaniesInputSchema, getCompaniesQuerySchema, getCompaniesResponseSchema, getCompanyDetailsInputSchema, getCompanyDetailsResponseSchema, getUserCompaniesInputSchema, getUserCompaniesQuerySchema, getUserCompaniesResponseSchema, updateCompanyInputSchema, updateCompanyResponseSchema, writableCompanySchema };
|
|
683
|
+
export { type CompaniesQueryParams, type Company, type CompanyDetails, type CompanyIri, type CompanyNullableIri, CreateCompany, type CreateCompanyInput, type CreateCompanyResponse, DeleteCompany, GetCompanies, type GetCompaniesInput, type GetCompaniesQueryParams, type GetCompaniesResponse, GetCompanyDetails, type GetCompanyDetailsInput, type GetCompanyDetailsResponse, GetUserCompanies, type GetUserCompaniesInput, type GetUserCompaniesQueryParams, type GetUserCompaniesResponse, UpdateCompany, type UpdateCompanyInput, type UpdateCompanyResponse, companiesQuerySchema, companyBillingDataSchema, companyDetailsSchema, companyIriSchema, companyNullableIriSchema, companySchema, createCompanyInputSchema, createCompanyResponseSchema, deleteCompanyInputSchema, deleteCompanyResponseSchema, getCompaniesInputSchema, getCompaniesQuerySchema, getCompaniesResponseSchema, getCompanyDetailsInputSchema, getCompanyDetailsResponseSchema, getUserCompaniesInputSchema, getUserCompaniesQuerySchema, getUserCompaniesResponseSchema, updateCompanyInputSchema, updateCompanyResponseSchema, writableCompanySchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ declare const companySchema: z.ZodObject<{
|
|
|
19
19
|
updatedAt: z.ZodString;
|
|
20
20
|
}, z.core.$strip>;
|
|
21
21
|
type Company = z.infer<typeof companySchema>;
|
|
22
|
+
declare const companyBillingDataSchema: z.ZodObject<{
|
|
23
|
+
sdi: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
24
|
+
pec: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
22
26
|
declare const companyDetailsSchema: z.ZodObject<{
|
|
23
27
|
id: z.ZodString;
|
|
24
28
|
businessName: z.ZodString;
|
|
@@ -676,4 +680,4 @@ type CompanyIri = z.infer<typeof companyIriSchema>;
|
|
|
676
680
|
declare const companyNullableIriSchema: z.ZodType<_deliverart_sdk_js_global_types.IriObject<"/companies/:id"> | null, unknown, z.core.$ZodTypeInternals<_deliverart_sdk_js_global_types.IriObject<"/companies/:id"> | null, unknown>>;
|
|
677
681
|
type CompanyNullableIri = z.infer<typeof companyNullableIriSchema>;
|
|
678
682
|
|
|
679
|
-
export { type CompaniesQueryParams, type Company, type CompanyDetails, type CompanyIri, type CompanyNullableIri, CreateCompany, type CreateCompanyInput, type CreateCompanyResponse, DeleteCompany, GetCompanies, type GetCompaniesInput, type GetCompaniesQueryParams, type GetCompaniesResponse, GetCompanyDetails, type GetCompanyDetailsInput, type GetCompanyDetailsResponse, GetUserCompanies, type GetUserCompaniesInput, type GetUserCompaniesQueryParams, type GetUserCompaniesResponse, UpdateCompany, type UpdateCompanyInput, type UpdateCompanyResponse, companiesQuerySchema, companyDetailsSchema, companyIriSchema, companyNullableIriSchema, companySchema, createCompanyInputSchema, createCompanyResponseSchema, deleteCompanyInputSchema, deleteCompanyResponseSchema, getCompaniesInputSchema, getCompaniesQuerySchema, getCompaniesResponseSchema, getCompanyDetailsInputSchema, getCompanyDetailsResponseSchema, getUserCompaniesInputSchema, getUserCompaniesQuerySchema, getUserCompaniesResponseSchema, updateCompanyInputSchema, updateCompanyResponseSchema, writableCompanySchema };
|
|
683
|
+
export { type CompaniesQueryParams, type Company, type CompanyDetails, type CompanyIri, type CompanyNullableIri, CreateCompany, type CreateCompanyInput, type CreateCompanyResponse, DeleteCompany, GetCompanies, type GetCompaniesInput, type GetCompaniesQueryParams, type GetCompaniesResponse, GetCompanyDetails, type GetCompanyDetailsInput, type GetCompanyDetailsResponse, GetUserCompanies, type GetUserCompaniesInput, type GetUserCompaniesQueryParams, type GetUserCompaniesResponse, UpdateCompany, type UpdateCompanyInput, type UpdateCompanyResponse, companiesQuerySchema, companyBillingDataSchema, companyDetailsSchema, companyIriSchema, companyNullableIriSchema, companySchema, createCompanyInputSchema, createCompanyResponseSchema, deleteCompanyInputSchema, deleteCompanyResponseSchema, getCompaniesInputSchema, getCompaniesQuerySchema, getCompaniesResponseSchema, getCompanyDetailsInputSchema, getCompanyDetailsResponseSchema, getUserCompaniesInputSchema, getUserCompaniesQuerySchema, getUserCompaniesResponseSchema, updateCompanyInputSchema, updateCompanyResponseSchema, writableCompanySchema };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
// src/models.ts
|
|
2
|
-
import {
|
|
3
|
-
addressSchema,
|
|
4
|
-
billingDataSchema,
|
|
5
|
-
datetimeSchema,
|
|
6
|
-
sortDirSchema
|
|
7
|
-
} from "@deliverart/sdk-js-global-types";
|
|
2
|
+
import { addressSchema, datetimeSchema, sortDirSchema } from "@deliverart/sdk-js-global-types";
|
|
8
3
|
import { userIriSchema } from "@deliverart/sdk-js-user";
|
|
9
4
|
import { z } from "zod";
|
|
10
5
|
var companySchema = z.object({
|
|
@@ -16,9 +11,13 @@ var companySchema = z.object({
|
|
|
16
11
|
createdAt: datetimeSchema,
|
|
17
12
|
updatedAt: datetimeSchema
|
|
18
13
|
});
|
|
14
|
+
var companyBillingDataSchema = z.object({
|
|
15
|
+
sdi: z.string().trim().optional().nullable(),
|
|
16
|
+
pec: z.email({ message: "Invalid email format" }).optional().nullable()
|
|
17
|
+
});
|
|
19
18
|
var companyDetailsSchema = companySchema.extend({
|
|
20
19
|
billingAddress: addressSchema,
|
|
21
|
-
billingData:
|
|
20
|
+
billingData: companyBillingDataSchema,
|
|
22
21
|
adminBy: userIriSchema
|
|
23
22
|
});
|
|
24
23
|
var writableCompanySchema = companyDetailsSchema.pick({
|
|
@@ -47,7 +46,15 @@ var companiesQuerySchema = z.object({
|
|
|
47
46
|
|
|
48
47
|
// src/requests/CreateCompany.ts
|
|
49
48
|
import { AbstractApiRequest } from "@deliverart/sdk-js-core";
|
|
50
|
-
var createCompanyInputSchema = writableCompanySchema.required()
|
|
49
|
+
var createCompanyInputSchema = writableCompanySchema.required().superRefine((value, context) => {
|
|
50
|
+
if (value.vat.startsWith("IT") && !value.billingData.sdi?.trim() && !value.billingData.pec) {
|
|
51
|
+
context.addIssue({
|
|
52
|
+
code: "custom",
|
|
53
|
+
path: ["billingData", "sdi"],
|
|
54
|
+
message: "At least one of SDI or PEC must be provided for Italian VAT numbers"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
51
58
|
var createCompanyResponseSchema = companyDetailsSchema;
|
|
52
59
|
var CreateCompany = class extends AbstractApiRequest {
|
|
53
60
|
constructor(input) {
|
|
@@ -193,6 +200,7 @@ export {
|
|
|
193
200
|
GetUserCompanies,
|
|
194
201
|
UpdateCompany,
|
|
195
202
|
companiesQuerySchema,
|
|
203
|
+
companyBillingDataSchema,
|
|
196
204
|
companyDetailsSchema,
|
|
197
205
|
companyIriSchema,
|
|
198
206
|
companyNullableIriSchema,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deliverart/sdk-js-company",
|
|
3
3
|
"description": "Deliverart JavaScript SDK for Company Management",
|
|
4
|
-
"version": "2.35.
|
|
4
|
+
"version": "2.35.4-dev.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -19,15 +19,16 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"zod": "4.3.5",
|
|
22
|
-
"@deliverart/sdk-js-core": "2.35.
|
|
23
|
-
"@deliverart/sdk-js-global-types": "2.35.
|
|
24
|
-
"@deliverart/sdk-js-user": "2.35.
|
|
22
|
+
"@deliverart/sdk-js-core": "2.35.4-dev.0",
|
|
23
|
+
"@deliverart/sdk-js-global-types": "2.35.4-dev.0",
|
|
24
|
+
"@deliverart/sdk-js-user": "2.35.4-dev.0"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "tsup src/index.ts --dts --format esm,cjs",
|
|
31
|
-
"dev": "tsup src/index.ts --dts --watch"
|
|
31
|
+
"dev": "tsup src/index.ts --dts --watch",
|
|
32
|
+
"test": "node --test src/*.test.mjs"
|
|
32
33
|
}
|
|
33
34
|
}
|