@deliverart/sdk-js-point-of-sale 0.1.0 → 1.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/dist/index.js DELETED
@@ -1,261 +0,0 @@
1
- // src/models.ts
2
- import { companyIriSchema } from "@deliverart/sdk-js-company";
3
- import {
4
- addressSchema,
5
- datetimeSchema,
6
- dayOfWeekSchema,
7
- sortDirSchema
8
- } from "@deliverart/sdk-js-global-types";
9
- import { z as z2 } from "zod";
10
-
11
- // src/types.ts
12
- import { iriNullableSchema, iriSchema } from "@deliverart/sdk-js-global-types";
13
- import { z } from "zod";
14
- var pointOfSaleOpeningStatuses = ["OPEN", "CLOSED"];
15
- var pointOfSaleOpeningStatusSchema = z.enum(pointOfSaleOpeningStatuses);
16
- var pointOfSaleCapabilities = ["DELIVERY_OPTIMIZATION"];
17
- var pointOfSaleCapabilitySchema = z.enum(pointOfSaleCapabilities);
18
- var pointOfSaleUserRoles = ["ROLE_ADMIN", "ROLE_READER"];
19
- var pointOfSaleUserRoleSchema = z.enum(pointOfSaleUserRoles);
20
- var pointOfSaleIriSchema = iriSchema("/customers/:id");
21
- var pointOfSaleNullableIriSchema = iriNullableSchema("/customers/:id");
22
-
23
- // src/models.ts
24
- var timeSettingSchema = z2.object({
25
- dayOfWeek: dayOfWeekSchema,
26
- times: z2.object({
27
- startTime: z2.string().regex(/^\d{2}:\d{2}$/),
28
- endTime: z2.string().regex(/^\d{2}:\d{2}$/)
29
- }).array()
30
- });
31
- var deliveryTimeSettingSchema = z2.object({
32
- dayOfWeek: dayOfWeekSchema,
33
- times: z2.object({
34
- startTime: z2.string().regex(/^\d{2}:\d{2}$/),
35
- endTime: z2.string().regex(/^\d{2}:\d{2}$/),
36
- availableCouriers: z2.number().nonnegative()
37
- }).array()
38
- });
39
- var pointOfSaleSchema = z2.object({
40
- id: z2.string(),
41
- name: z2.string(),
42
- address: addressSchema,
43
- timezone: z2.string(),
44
- location: z2.object({
45
- latitude: z2.number(),
46
- longitude: z2.number()
47
- }),
48
- capabilities: pointOfSaleCapabilitySchema.array(),
49
- openingStatus: pointOfSaleOpeningStatusSchema,
50
- createdAt: datetimeSchema,
51
- updatedAt: datetimeSchema
52
- });
53
- var userPointOfSaleSchema = z2.object({
54
- pointOfSale: pointOfSaleSchema,
55
- role: pointOfSaleUserRoleSchema
56
- });
57
- var pointOfSaleIntervalValues = [5, 10, 15, 20, 30, 60];
58
- var pointOfSaleAutoAcceptOrderValues = [0, 5, 10, 15];
59
- var pointOfSaleDetailsSchema = pointOfSaleSchema.extend({
60
- company: companyIriSchema,
61
- settings: z2.object({
62
- menuLocales: z2.any().array(),
63
- deliveryTimesInterval: z2.number().positive().refine((value) => pointOfSaleIntervalValues.includes(value)),
64
- takeAwayTimesInterval: z2.number().positive().refine((value) => pointOfSaleIntervalValues.includes(value)),
65
- numberMinutesToPrecessFirstOrder: z2.number().positive(),
66
- numberMinutesTimeChangeTolerance: z2.number().positive(),
67
- maxCountableItemsPerBundle: z2.number().positive(),
68
- maxOrdersPerBundle: z2.number().positive(),
69
- preventOrderTakingIfTheMaxCountableItemsExceeded: z2.boolean(),
70
- numberMinutesBeforeAutoAcceptOrder: z2.number().nonnegative().refine((value) => pointOfSaleAutoAcceptOrderValues.includes(value))
71
- }),
72
- openingTimeSettings: timeSettingSchema.array(),
73
- deliveryTimeSettings: deliveryTimeSettingSchema.array(),
74
- takeAwayTimeSettings: timeSettingSchema.array(),
75
- numberOfCouriers: z2.number().nonnegative()
76
- });
77
- var writablePointOfSaleSchema = pointOfSaleDetailsSchema.pick({
78
- name: true,
79
- address: true,
80
- timezone: true,
81
- settings: true,
82
- openingTimeSettings: true,
83
- deliveryTimeSettings: true,
84
- takeAwayTimeSettings: true,
85
- capabilities: true,
86
- openingStatus: true
87
- });
88
- var writableCreatePointOfSaleSchema = z2.object({
89
- ...writablePointOfSaleSchema.shape,
90
- ...pointOfSaleDetailsSchema.pick({
91
- company: true
92
- }).shape
93
- });
94
- var pointOfSalesQuerySchema = z2.object({
95
- name: z2.string().optional(),
96
- openingStatus: pointOfSaleOpeningStatusSchema.optional(),
97
- "integrationActivationRequests.connectionId": z2.string().optional(),
98
- "address.city": z2.string().optional(),
99
- "address.postalCode": z2.string().optional(),
100
- "order[name]": sortDirSchema.optional(),
101
- "order[createdAt]": sortDirSchema.optional(),
102
- "order[updatedAt]": sortDirSchema.optional(),
103
- page: z2.coerce.number().optional()
104
- });
105
-
106
- // src/requests/CreatePointOfSale.ts
107
- import { AbstractApiRequest } from "@deliverart/sdk-js-core";
108
- var createPointOfSaleInputSchema = writableCreatePointOfSaleSchema.required();
109
- var createPointOfSaleResponseSchema = pointOfSaleDetailsSchema;
110
- var CreatePointOfSale = class extends AbstractApiRequest {
111
- method = "POST";
112
- contentType = "application/json";
113
- accept = "application/json";
114
- inputSchema = createPointOfSaleInputSchema;
115
- outputSchema = createPointOfSaleResponseSchema;
116
- querySchema = void 0;
117
- headersSchema = void 0;
118
- constructor(input) {
119
- super(input);
120
- }
121
- getPath() {
122
- return "/point_of_sales";
123
- }
124
- };
125
-
126
- // src/requests/DeletePointOfSale.ts
127
- import { AbstractApiRequest as AbstractApiRequest2 } from "@deliverart/sdk-js-core";
128
- import { z as z3 } from "zod";
129
- var deletePointOfSaleInputSchema = z3.undefined();
130
- var deletePointOfSaleResponseSchema = z3.undefined();
131
- var DeletePointOfSale = class extends AbstractApiRequest2 {
132
- method = "DELETE";
133
- contentType = "application/json";
134
- accept = "application/json";
135
- inputSchema = deletePointOfSaleInputSchema;
136
- outputSchema = deletePointOfSaleResponseSchema;
137
- querySchema = void 0;
138
- headersSchema = void 0;
139
- pointOfSaleId;
140
- constructor(pointOfSaleId) {
141
- super(void 0);
142
- this.pointOfSaleId = pointOfSaleId;
143
- }
144
- getPath() {
145
- return `/point_of_sales/${this.pointOfSaleId}`;
146
- }
147
- };
148
-
149
- // src/requests/GetPointOfSaleDetails.ts
150
- import { AbstractApiRequest as AbstractApiRequest3 } from "@deliverart/sdk-js-core";
151
- import { z as z4 } from "zod";
152
- var getPointOfSaleDetailsInputSchema = z4.undefined();
153
- var getPointOfSaleDetailsResponseSchema = pointOfSaleDetailsSchema;
154
- var GetPointOfSaleDetails = class extends AbstractApiRequest3 {
155
- method = "GET";
156
- contentType = "application/json";
157
- accept = "application/json";
158
- inputSchema = getPointOfSaleDetailsInputSchema;
159
- outputSchema = getPointOfSaleDetailsResponseSchema;
160
- querySchema = void 0;
161
- headersSchema = void 0;
162
- pointOfSaleId;
163
- constructor(pointOfSaleId) {
164
- super(void 0);
165
- this.pointOfSaleId = pointOfSaleId;
166
- }
167
- getPath() {
168
- return `/point_of_sales/${this.pointOfSaleId}`;
169
- }
170
- };
171
-
172
- // src/requests/GetPointOfSales.ts
173
- import { AbstractApiRequest as AbstractApiRequest4 } from "@deliverart/sdk-js-core";
174
- import {
175
- createPaginatedSchema,
176
- responseToPagination
177
- } from "@deliverart/sdk-js-global-types";
178
- import { z as z5 } from "zod";
179
- var getPointOfSalesQuerySchema = pointOfSalesQuerySchema;
180
- var getPointOfSalesInputSchema = z5.undefined();
181
- var getPointOfSalesResponseSchema = createPaginatedSchema(pointOfSaleSchema);
182
- var GetPointOfSales = class extends AbstractApiRequest4 {
183
- method = "GET";
184
- contentType = "application/json";
185
- accept = "application/json";
186
- inputSchema = getPointOfSalesInputSchema;
187
- outputSchema = getPointOfSalesResponseSchema;
188
- querySchema = getPointOfSalesQuerySchema;
189
- headersSchema = void 0;
190
- constructor(options) {
191
- super(void 0, options);
192
- }
193
- getPath() {
194
- return "/point_of_sales";
195
- }
196
- parseResponse(data, rawResponse) {
197
- const pointOfSales = z5.array(pointOfSaleSchema).parse(data);
198
- return this.validateOutput({
199
- data: pointOfSales,
200
- pagination: responseToPagination(rawResponse)
201
- });
202
- }
203
- };
204
-
205
- // src/requests/UpdatePointOfSale.ts
206
- import { AbstractApiRequest as AbstractApiRequest5 } from "@deliverart/sdk-js-core";
207
- var updatePointOfSaleInputSchema = writablePointOfSaleSchema.partial();
208
- var updatePointOfSaleResponseSchema = pointOfSaleDetailsSchema;
209
- var UpdatePointOfSale = class extends AbstractApiRequest5 {
210
- method = "PATCH";
211
- contentType = "application/merge-patch+json";
212
- accept = "application/json";
213
- inputSchema = updatePointOfSaleInputSchema;
214
- outputSchema = updatePointOfSaleResponseSchema;
215
- querySchema = void 0;
216
- headersSchema = void 0;
217
- pointOfSaleId;
218
- constructor(pointOfSaleId, input) {
219
- super(input);
220
- this.pointOfSaleId = pointOfSaleId;
221
- }
222
- getPath() {
223
- return `/point_of_sales/${this.pointOfSaleId}`;
224
- }
225
- };
226
- export {
227
- CreatePointOfSale,
228
- DeletePointOfSale,
229
- GetPointOfSaleDetails,
230
- GetPointOfSales,
231
- UpdatePointOfSale,
232
- createPointOfSaleInputSchema,
233
- createPointOfSaleResponseSchema,
234
- deletePointOfSaleInputSchema,
235
- deletePointOfSaleResponseSchema,
236
- deliveryTimeSettingSchema,
237
- getPointOfSaleDetailsInputSchema,
238
- getPointOfSaleDetailsResponseSchema,
239
- getPointOfSalesInputSchema,
240
- getPointOfSalesQuerySchema,
241
- getPointOfSalesResponseSchema,
242
- pointOfSaleAutoAcceptOrderValues,
243
- pointOfSaleCapabilities,
244
- pointOfSaleCapabilitySchema,
245
- pointOfSaleDetailsSchema,
246
- pointOfSaleIntervalValues,
247
- pointOfSaleIriSchema,
248
- pointOfSaleNullableIriSchema,
249
- pointOfSaleOpeningStatusSchema,
250
- pointOfSaleOpeningStatuses,
251
- pointOfSaleSchema,
252
- pointOfSaleUserRoleSchema,
253
- pointOfSaleUserRoles,
254
- pointOfSalesQuerySchema,
255
- timeSettingSchema,
256
- updatePointOfSaleInputSchema,
257
- updatePointOfSaleResponseSchema,
258
- userPointOfSaleSchema,
259
- writableCreatePointOfSaleSchema,
260
- writablePointOfSaleSchema
261
- };
package/eslint.config.js DELETED
@@ -1,41 +0,0 @@
1
- /* eslint-disable */
2
- // eslint.config.js per @typescript-eslint v8
3
- import js from '@eslint/js'
4
- import prettier from 'eslint-config-prettier'
5
- import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort'
6
- import tsPlugin from '@typescript-eslint/eslint-plugin'
7
- import tsParser from '@typescript-eslint/parser'
8
-
9
- export default [
10
- js.configs.recommended,
11
- {
12
- files: ['**/*.ts'],
13
- languageOptions: {
14
- parser: tsParser,
15
- globals: {
16
- process: 'readonly',
17
- fetch: 'readonly',
18
- Request: 'readonly',
19
- Response: 'readonly',
20
- Headers: 'readonly',
21
- },
22
- parserOptions: {
23
- project: ['./tsconfig.json'],
24
- tsconfigRootDir: process.cwd(),
25
- sourceType: 'module',
26
- },
27
- },
28
- plugins: {
29
- '@typescript-eslint': tsPlugin,
30
- 'simple-import-sort': simpleImportSortPlugin,
31
- },
32
- rules: {
33
- 'simple-import-sort/imports': 'error',
34
- 'simple-import-sort/exports': 'error',
35
- '@typescript-eslint/no-unused-vars': 'warn',
36
- },
37
- },
38
- prettier,
39
- ]
40
-
41
- export const ignores = ['dist', 'node_modules']
package/src/index.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './models'
2
- export * from './requests'
3
- export * from './types'
package/src/models.ts DELETED
@@ -1,125 +0,0 @@
1
- import { companyIriSchema } from '@deliverart/sdk-js-company'
2
- import {
3
- addressSchema,
4
- datetimeSchema,
5
- dayOfWeekSchema,
6
- sortDirSchema,
7
- } from '@deliverart/sdk-js-global-types'
8
- import { z } from 'zod'
9
-
10
- import {
11
- pointOfSaleCapabilitySchema,
12
- pointOfSaleOpeningStatusSchema,
13
- pointOfSaleUserRoleSchema,
14
- } from './types'
15
-
16
- export const timeSettingSchema = z.object({
17
- dayOfWeek: dayOfWeekSchema,
18
- times: z
19
- .object({
20
- startTime: z.string().regex(/^\d{2}:\d{2}$/),
21
- endTime: z.string().regex(/^\d{2}:\d{2}$/),
22
- })
23
- .array(),
24
- })
25
- export type TimeSetting = z.infer<typeof timeSettingSchema>
26
-
27
- export const deliveryTimeSettingSchema = z.object({
28
- dayOfWeek: dayOfWeekSchema,
29
- times: z
30
- .object({
31
- startTime: z.string().regex(/^\d{2}:\d{2}$/),
32
- endTime: z.string().regex(/^\d{2}:\d{2}$/),
33
- availableCouriers: z.number().nonnegative(),
34
- })
35
- .array(),
36
- })
37
- export type DeliveryTimeSetting = z.infer<typeof deliveryTimeSettingSchema>
38
-
39
- export const pointOfSaleSchema = z.object({
40
- id: z.string(),
41
- name: z.string(),
42
- address: addressSchema,
43
- timezone: z.string(),
44
- location: z.object({
45
- latitude: z.number(),
46
- longitude: z.number(),
47
- }),
48
- capabilities: pointOfSaleCapabilitySchema.array(),
49
- openingStatus: pointOfSaleOpeningStatusSchema,
50
- createdAt: datetimeSchema,
51
- updatedAt: datetimeSchema,
52
- })
53
- export type PointOfSale = z.infer<typeof pointOfSaleSchema>
54
-
55
- export const userPointOfSaleSchema = z.object({
56
- pointOfSale: pointOfSaleSchema,
57
- role: pointOfSaleUserRoleSchema,
58
- })
59
- export type UserPointOfSale = z.infer<typeof userPointOfSaleSchema>
60
-
61
- export const pointOfSaleIntervalValues = [5, 10, 15, 20, 30, 60]
62
- export const pointOfSaleAutoAcceptOrderValues = [0, 5, 10, 15]
63
-
64
- export const pointOfSaleDetailsSchema = pointOfSaleSchema.extend({
65
- company: companyIriSchema,
66
- settings: z.object({
67
- menuLocales: z.any().array(),
68
- deliveryTimesInterval: z
69
- .number()
70
- .positive()
71
- .refine(value => pointOfSaleIntervalValues.includes(value)),
72
- takeAwayTimesInterval: z
73
- .number()
74
- .positive()
75
- .refine(value => pointOfSaleIntervalValues.includes(value)),
76
- numberMinutesToPrecessFirstOrder: z.number().positive(),
77
- numberMinutesTimeChangeTolerance: z.number().positive(),
78
- maxCountableItemsPerBundle: z.number().positive(),
79
- maxOrdersPerBundle: z.number().positive(),
80
- preventOrderTakingIfTheMaxCountableItemsExceeded: z.boolean(),
81
- numberMinutesBeforeAutoAcceptOrder: z
82
- .number()
83
- .nonnegative()
84
- .refine(value => pointOfSaleAutoAcceptOrderValues.includes(value)),
85
- }),
86
- openingTimeSettings: timeSettingSchema.array(),
87
- deliveryTimeSettings: deliveryTimeSettingSchema.array(),
88
- takeAwayTimeSettings: timeSettingSchema.array(),
89
- numberOfCouriers: z.number().nonnegative(),
90
- })
91
- export type PointOfSaleDetails = z.infer<typeof pointOfSaleDetailsSchema>
92
-
93
- export const writablePointOfSaleSchema = pointOfSaleDetailsSchema.pick({
94
- name: true,
95
- address: true,
96
- timezone: true,
97
- settings: true,
98
- openingTimeSettings: true,
99
- deliveryTimeSettings: true,
100
- takeAwayTimeSettings: true,
101
- capabilities: true,
102
- openingStatus: true,
103
- })
104
- export type WritablePointOfSale = z.infer<typeof writablePointOfSaleSchema>
105
-
106
- export const writableCreatePointOfSaleSchema = z.object({
107
- ...writablePointOfSaleSchema.shape,
108
- ...pointOfSaleDetailsSchema.pick({
109
- company: true,
110
- }).shape,
111
- })
112
- export type WritableCreatePointOfSale = z.infer<typeof writableCreatePointOfSaleSchema>
113
-
114
- export const pointOfSalesQuerySchema = z.object({
115
- name: z.string().optional(),
116
- openingStatus: pointOfSaleOpeningStatusSchema.optional(),
117
- 'integrationActivationRequests.connectionId': z.string().optional(),
118
- 'address.city': z.string().optional(),
119
- 'address.postalCode': z.string().optional(),
120
- 'order[name]': sortDirSchema.optional(),
121
- 'order[createdAt]': sortDirSchema.optional(),
122
- 'order[updatedAt]': sortDirSchema.optional(),
123
- page: z.coerce.number().optional(),
124
- })
125
- export type PointOfSalesQueryParams = z.infer<typeof pointOfSalesQuerySchema>
@@ -1,32 +0,0 @@
1
- import { AbstractApiRequest } from '@deliverart/sdk-js-core'
2
- import { z } from 'zod'
3
-
4
- import { pointOfSaleDetailsSchema, writableCreatePointOfSaleSchema } from '../models'
5
-
6
- export const createPointOfSaleInputSchema = writableCreatePointOfSaleSchema.required()
7
- export type CreatePointOfSaleInput = z.input<typeof createPointOfSaleInputSchema>
8
-
9
- export const createPointOfSaleResponseSchema = pointOfSaleDetailsSchema
10
- export type CreatePointOfSaleResponse = z.infer<typeof createPointOfSaleResponseSchema>
11
-
12
- export class CreatePointOfSale extends AbstractApiRequest<
13
- typeof createPointOfSaleInputSchema,
14
- typeof createPointOfSaleResponseSchema
15
- > {
16
- readonly method = 'POST'
17
- readonly contentType = 'application/json'
18
- readonly accept = 'application/json'
19
-
20
- readonly inputSchema = createPointOfSaleInputSchema
21
- readonly outputSchema = createPointOfSaleResponseSchema
22
- readonly querySchema = undefined
23
- readonly headersSchema = undefined
24
-
25
- constructor(input: CreatePointOfSaleInput) {
26
- super(input)
27
- }
28
-
29
- getPath(): string {
30
- return '/point_of_sales'
31
- }
32
- }
@@ -1,30 +0,0 @@
1
- import { AbstractApiRequest } from '@deliverart/sdk-js-core'
2
- import { z } from 'zod'
3
-
4
- export const deletePointOfSaleInputSchema = z.undefined()
5
- export const deletePointOfSaleResponseSchema = z.undefined()
6
-
7
- export class DeletePointOfSale extends AbstractApiRequest<
8
- typeof deletePointOfSaleInputSchema,
9
- typeof deletePointOfSaleResponseSchema
10
- > {
11
- readonly method = 'DELETE'
12
- readonly contentType = 'application/json'
13
- readonly accept = 'application/json'
14
-
15
- readonly inputSchema = deletePointOfSaleInputSchema
16
- readonly outputSchema = deletePointOfSaleResponseSchema
17
- readonly querySchema = undefined
18
- readonly headersSchema = undefined
19
-
20
- private readonly pointOfSaleId: string
21
-
22
- constructor(pointOfSaleId: string) {
23
- super(undefined)
24
- this.pointOfSaleId = pointOfSaleId
25
- }
26
-
27
- getPath(): string {
28
- return `/point_of_sales/${this.pointOfSaleId}`
29
- }
30
- }
@@ -1,34 +0,0 @@
1
- import { AbstractApiRequest } from '@deliverart/sdk-js-core'
2
- import { z } from 'zod'
3
-
4
- import { pointOfSaleDetailsSchema } from '../models'
5
-
6
- export const getPointOfSaleDetailsInputSchema = z.undefined()
7
- export type GetPointOfSaleDetailsInput = z.input<typeof getPointOfSaleDetailsInputSchema>
8
-
9
- export const getPointOfSaleDetailsResponseSchema = pointOfSaleDetailsSchema
10
- export type GetPointOfSaleDetailsResponse = z.infer<typeof getPointOfSaleDetailsResponseSchema>
11
-
12
- export class GetPointOfSaleDetails extends AbstractApiRequest<
13
- typeof getPointOfSaleDetailsInputSchema,
14
- typeof getPointOfSaleDetailsResponseSchema
15
- > {
16
- readonly method = 'GET'
17
- readonly contentType = 'application/json'
18
- readonly accept = 'application/json'
19
- readonly inputSchema = getPointOfSaleDetailsInputSchema
20
- readonly outputSchema = getPointOfSaleDetailsResponseSchema
21
- readonly querySchema = undefined
22
- readonly headersSchema = undefined
23
-
24
- private readonly pointOfSaleId: string
25
-
26
- constructor(pointOfSaleId: string) {
27
- super(undefined)
28
- this.pointOfSaleId = pointOfSaleId
29
- }
30
-
31
- getPath(): string {
32
- return `/point_of_sales/${this.pointOfSaleId}`
33
- }
34
- }
@@ -1,50 +0,0 @@
1
- import { AbstractApiRequest } from '@deliverart/sdk-js-core'
2
- import {
3
- createPaginatedSchema,
4
- Paginated,
5
- responseToPagination,
6
- } from '@deliverart/sdk-js-global-types'
7
- import { AxiosResponse } from 'axios'
8
- import { z } from 'zod'
9
-
10
- import { PointOfSale, pointOfSaleSchema, pointOfSalesQuerySchema } from '../models'
11
-
12
- export const getPointOfSalesQuerySchema = pointOfSalesQuerySchema
13
- export type GetPointOfSalesQueryParams = z.infer<typeof getPointOfSalesQuerySchema>
14
-
15
- export const getPointOfSalesInputSchema = z.undefined()
16
- export type GetPointOfSalesInput = z.input<typeof getPointOfSalesInputSchema>
17
-
18
- export const getPointOfSalesResponseSchema = createPaginatedSchema(pointOfSaleSchema)
19
- export type GetPointOfSalesResponse = z.infer<typeof getPointOfSalesResponseSchema>
20
-
21
- export class GetPointOfSales extends AbstractApiRequest<
22
- typeof getPointOfSalesInputSchema,
23
- typeof getPointOfSalesResponseSchema,
24
- GetPointOfSalesQueryParams
25
- > {
26
- readonly method = 'GET'
27
- readonly contentType = 'application/json'
28
- readonly accept = 'application/json'
29
-
30
- readonly inputSchema = getPointOfSalesInputSchema
31
- readonly outputSchema = getPointOfSalesResponseSchema
32
- readonly querySchema = getPointOfSalesQuerySchema
33
- readonly headersSchema = undefined
34
-
35
- constructor(options?: { query?: GetPointOfSalesQueryParams }) {
36
- super(undefined, options)
37
- }
38
-
39
- getPath(): string {
40
- return '/point_of_sales'
41
- }
42
-
43
- parseResponse(data: unknown, rawResponse: AxiosResponse): Paginated<PointOfSale> {
44
- const pointOfSales = z.array(pointOfSaleSchema).parse(data)
45
- return this.validateOutput({
46
- data: pointOfSales,
47
- pagination: responseToPagination(rawResponse),
48
- })
49
- }
50
- }
@@ -1,35 +0,0 @@
1
- import { AbstractApiRequest } from '@deliverart/sdk-js-core'
2
- import { z } from 'zod'
3
-
4
- import { pointOfSaleDetailsSchema, writablePointOfSaleSchema } from '../models'
5
-
6
- export const updatePointOfSaleInputSchema = writablePointOfSaleSchema.partial()
7
- export type UpdatePointOfSaleInput = z.input<typeof updatePointOfSaleInputSchema>
8
-
9
- export const updatePointOfSaleResponseSchema = pointOfSaleDetailsSchema
10
- export type UpdatePointOfSaleResponse = z.infer<typeof updatePointOfSaleResponseSchema>
11
-
12
- export class UpdatePointOfSale extends AbstractApiRequest<
13
- typeof updatePointOfSaleInputSchema,
14
- typeof updatePointOfSaleResponseSchema
15
- > {
16
- readonly method = 'PATCH'
17
- readonly contentType = 'application/merge-patch+json'
18
- readonly accept = 'application/json'
19
-
20
- readonly inputSchema = updatePointOfSaleInputSchema
21
- readonly outputSchema = updatePointOfSaleResponseSchema
22
- readonly querySchema = undefined
23
- readonly headersSchema = undefined
24
-
25
- private readonly pointOfSaleId: string
26
-
27
- constructor(pointOfSaleId: string, input: UpdatePointOfSaleInput) {
28
- super(input)
29
- this.pointOfSaleId = pointOfSaleId
30
- }
31
-
32
- getPath(): string {
33
- return `/point_of_sales/${this.pointOfSaleId}`
34
- }
35
- }
@@ -1,5 +0,0 @@
1
- export * from './CreatePointOfSale'
2
- export * from './DeletePointOfSale'
3
- export * from './GetPointOfSaleDetails'
4
- export * from './GetPointOfSales'
5
- export * from './UpdatePointOfSale'
package/src/types.ts DELETED
@@ -1,20 +0,0 @@
1
- import { iriNullableSchema, iriSchema } from '@deliverart/sdk-js-global-types'
2
- import { z } from 'zod'
3
-
4
- export const pointOfSaleOpeningStatuses = ['OPEN', 'CLOSED'] as const
5
- export const pointOfSaleOpeningStatusSchema = z.enum(pointOfSaleOpeningStatuses)
6
- export type PointOfSaleOpeningStatus = z.infer<typeof pointOfSaleOpeningStatusSchema>
7
-
8
- export const pointOfSaleCapabilities = ['DELIVERY_OPTIMIZATION'] as const
9
- export const pointOfSaleCapabilitySchema = z.enum(pointOfSaleCapabilities)
10
- export type PointOfSaleCapability = z.infer<typeof pointOfSaleCapabilitySchema>
11
-
12
- export const pointOfSaleUserRoles = ['ROLE_ADMIN', 'ROLE_READER'] as const
13
- export const pointOfSaleUserRoleSchema = z.enum(pointOfSaleUserRoles)
14
- export type PointOfSaleUserRole = z.infer<typeof pointOfSaleUserRoleSchema>
15
-
16
- export const pointOfSaleIriSchema = iriSchema('/customers/:id')
17
- export type PointOfSaleIri = z.infer<typeof pointOfSaleIriSchema>
18
-
19
- export const pointOfSaleNullableIriSchema = iriNullableSchema('/customers/:id')
20
- export type PointOfSaleNullableIri = z.infer<typeof pointOfSaleNullableIriSchema>
package/tsconfig.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "Node",
6
- "esModuleInterop": true,
7
- "forceConsistentCasingInFileNames": true,
8
- "strict": true,
9
- "skipLibCheck": true,
10
- "outDir": "dist",
11
- "declaration": true,
12
- "declarationMap": true
13
- },
14
- "include": ["src"]
15
- }