@deliverart/sdk-js-point-of-sale 0.1.1 → 1.1.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.
package/package.json CHANGED
@@ -1,35 +1,26 @@
1
1
  {
2
2
  "name": "@deliverart/sdk-js-point-of-sale",
3
3
  "description": "Deliverart JavaScript SDK for Point of Sale Management",
4
- "version": "0.1.1",
4
+ "version": "1.1.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
+ "tsup": {
9
+ "tsconfig": "./tsconfig.json"
10
+ },
8
11
  "exports": {
9
12
  ".": {
10
13
  "import": "./dist/index.js",
11
14
  "require": "./dist/index.cjs"
12
15
  }
13
16
  },
17
+ "files": [
18
+ "dist"
19
+ ],
14
20
  "dependencies": {
15
- "@deliverart/sdk-js-company": "0.1.3",
16
- "@deliverart/sdk-js-core": "0.2.0",
17
- "@deliverart/sdk-js-global-types": "0.0.18",
18
- "axios": "1.9.0",
19
- "zod": "3.25.67"
20
- },
21
- "devDependencies": {
22
- "@changesets/cli": "^2.29.4",
23
- "@eslint/js": "9.28.0",
24
- "@types/node": "22.15.30",
25
- "@typescript-eslint/eslint-plugin": "8.33.1",
26
- "@typescript-eslint/parser": "8.33.1",
27
- "eslint": "9.28.0",
28
- "eslint-config-prettier": "10.1.5",
29
- "eslint-plugin-simple-import-sort": "12.1.1",
30
- "prettier": "3.5.3",
31
- "tsup": "8.5.0",
32
- "typescript": "5.8.3"
21
+ "@deliverart/sdk-js-company": "1.1.1",
22
+ "@deliverart/sdk-js-core": "1.1.1",
23
+ "@deliverart/sdk-js-global-types": "1.1.1"
33
24
  },
34
25
  "publishConfig": {
35
26
  "access": "public"
@@ -37,11 +28,6 @@
37
28
  "scripts": {
38
29
  "build": "tsup src/index.ts --dts --format esm,cjs",
39
30
  "dev": "tsup src/index.ts --dts --watch",
40
- "lint": "eslint .",
41
- "lint:fix": "eslint . --fix",
42
- "prettier": "prettier --check .",
43
- "prettier:fix": "prettier --write .",
44
- "version": "@changesets/cli version",
45
- "release": "@changesets/cli publish"
31
+ "clean": "rm -rf dist"
46
32
  }
47
33
  }
@@ -1,11 +0,0 @@
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
- }
@@ -1,47 +0,0 @@
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 DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "semi": false,
3
- "singleQuote": true,
4
- "printWidth": 100,
5
- "trailingComma": "all",
6
- "arrowParens": "avoid"
7
- }
package/CHANGELOG.md DELETED
@@ -1,55 +0,0 @@
1
- # @deliverart/sdk-js-point-of-sale
2
-
3
- ## 0.1.1
4
-
5
- ### Patch Changes
6
-
7
- - 2b4fb65: fix iri
8
-
9
- ## 0.1.0
10
-
11
- ### Minor Changes
12
-
13
- - 4b22ab7: update code with new sdk version
14
-
15
- ## 0.0.8
16
-
17
- ### Patch Changes
18
-
19
- - b073e46: fix uuid version
20
-
21
- ## 0.0.7
22
-
23
- ### Patch Changes
24
-
25
- - d97b57a: increase version pkg
26
-
27
- ## 0.0.6
28
-
29
- ### Patch Changes
30
-
31
- - 2da2f96: upgrade package version
32
-
33
- ## 0.0.5
34
-
35
- ### Patch Changes
36
-
37
- - 235e493: upgrade package version
38
-
39
- ## 0.0.4
40
-
41
- ### Patch Changes
42
-
43
- - 473f5df: update dependencies
44
-
45
- ## 0.0.3
46
-
47
- ### Patch Changes
48
-
49
- - 27c1b05: Expose pointOfSale path schema
50
-
51
- ## 0.0.2
52
-
53
- ### Patch Changes
54
-
55
- - fedc834: Fix naming
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # sdk-js-point-of-sale
2
-
3
- Point of sale requests and models for SDK
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('/point_of_sales/:id')
17
- export type PointOfSaleIri = z.infer<typeof pointOfSaleIriSchema>
18
-
19
- export const pointOfSaleNullableIriSchema = iriNullableSchema('/point_of_sales/: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
- }