@chift/chift-nodejs 1.0.17 → 1.0.19

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.
Files changed (48) hide show
  1. package/dist/src/types/public-api/schema.d.ts +15294 -0
  2. package/package.json +6 -2
  3. package/.eslintignore +0 -1
  4. package/.eslintrc.json +0 -25
  5. package/.github/workflows/ci.yml +0 -75
  6. package/.husky/pre-commit +0 -4
  7. package/.prettierignore +0 -1
  8. package/.prettierrc.json +0 -7
  9. package/CHANGELOG.md +0 -108
  10. package/jest.config.ts +0 -195
  11. package/src/helpers/openapi.ts +0 -22
  12. package/src/helpers/settings.ts +0 -3
  13. package/src/index.ts +0 -1
  14. package/src/modules/accounting.ts +0 -510
  15. package/src/modules/api.ts +0 -35
  16. package/src/modules/consumer.ts +0 -216
  17. package/src/modules/consumers.ts +0 -82
  18. package/src/modules/custom.ts +0 -36
  19. package/src/modules/datastores.ts +0 -19
  20. package/src/modules/ecommerce.ts +0 -129
  21. package/src/modules/flow.ts +0 -168
  22. package/src/modules/integrations.ts +0 -24
  23. package/src/modules/internalApi.ts +0 -182
  24. package/src/modules/invoicing.ts +0 -118
  25. package/src/modules/payment.ts +0 -59
  26. package/src/modules/pms.ts +0 -67
  27. package/src/modules/pos.ts +0 -144
  28. package/src/modules/sync.ts +0 -77
  29. package/src/modules/syncs.ts +0 -59
  30. package/src/modules/webhooks.ts +0 -86
  31. package/src/types/api.ts +0 -37
  32. package/src/types/consumers.ts +0 -9
  33. package/src/types/public-api/mappings.ts +0 -21
  34. package/src/types/sync.ts +0 -38
  35. package/test/data/accounting_invoice.pdf +0 -0
  36. package/test/modules/accounting.test.ts +0 -647
  37. package/test/modules/consumer.test.ts +0 -68
  38. package/test/modules/consumers.test.ts +0 -85
  39. package/test/modules/ecommerce.test.ts +0 -213
  40. package/test/modules/integrations.test.ts +0 -22
  41. package/test/modules/invoicing.test.ts +0 -98
  42. package/test/modules/payment.test.ts +0 -65
  43. package/test/modules/pms.test.ts +0 -69
  44. package/test/modules/pos.test.ts +0 -164
  45. package/test/modules/sync.test.ts +0 -74
  46. package/test/modules/syncs.test.ts +0 -23
  47. package/test/modules/webhooks.test.ts +0 -92
  48. package/tsconfig.json +0 -107
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "@chift/chift-nodejs",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "The Chift NodeJS library provides convenient access to the Chift API from applications written in the NodeJS language (Javascript/Typescript).",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "src/**/*.d.ts"
10
+ ],
7
11
  "scripts": {
8
12
  "dev": "chokidar src --command 'npm run build' --debounce=5000",
9
13
  "prepare": "husky install",
10
- "build": "tsc",
14
+ "build": "tsc && cp src/types/public-api/schema.d.ts dist/src/types/public-api/schema.d.ts",
11
15
  "test": "jest --maxWorkers 1"
12
16
  },
13
17
  "keywords": [],
package/.eslintignore DELETED
@@ -1 +0,0 @@
1
- dist
package/.eslintrc.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "env": {
3
- "es6": true,
4
- "node": true
5
- },
6
- "extends": [
7
- "eslint:recommended",
8
- "plugin:@typescript-eslint/recommended",
9
- "plugin:prettier/recommended"
10
- ],
11
- "globals": {
12
- "Atomics": "readonly",
13
- "SharedArrayBuffer": "readonly"
14
- },
15
- "parser": "@typescript-eslint/parser",
16
- "parserOptions": {
17
- "ecmaVersion": 11,
18
- "sourceType": "module"
19
- },
20
- "plugins": ["@typescript-eslint", "prettier"],
21
- "rules": {
22
- "@typescript-eslint/no-unused-vars": "error",
23
- "prettier/prettier": "error"
24
- }
25
- }
@@ -1,75 +0,0 @@
1
- name: Test and publish
2
-
3
- on:
4
- workflow_dispatch: {}
5
- push:
6
- branches:
7
- - main
8
- - feature/**
9
- tags:
10
- - v[0-9]+.[0-9]+.[0-9]+*
11
- pull_request:
12
- branches:
13
- - main
14
- - feature/**
15
-
16
- jobs:
17
- test:
18
- name: Test
19
- runs-on: ubuntu-latest
20
- steps:
21
- - name: Checkout
22
- uses: actions/checkout@v3
23
-
24
- - name: Use Node.js 16.x
25
- uses: actions/setup-node@v3
26
- with:
27
- node-version: 16.x
28
-
29
- - name: Install dependencies
30
- run: npm install
31
-
32
- - name: Test
33
- run: npm test --coverage && ./node_modules/coveralls/bin/coveralls.js < coverage/lcov.info
34
- env:
35
- CHIFT_BACKBONE_API: ${{ secrets.CHIFT_BACKBONE_API }}
36
- CHIFT_TESTING_CLIENTID: ${{ secrets.CHIFT_TESTING_CLIENTID }}
37
- CHIFT_TESTING_CLIENTSECRET: ${{ secrets.CHIFT_TESTING_CLIENTSECRET }}
38
- CHIFT_TESTING_ACCOUNTID: ${{ secrets.CHIFT_TESTING_ACCOUNTID }}
39
- CHIFT_TEST_SYNC_ID: ${{ secrets.CHIFT_TEST_SYNC_ID }}
40
- CHIFT_SYNC_CONSUMER_ID: ${{ secrets.CHIFT_SYNC_CONSUMER_ID }}
41
- CHIFT_ACCOUNTING_CONSUMER_ID: ${{ secrets.CHIFT_ACCOUNTING_CONSUMER_ID }}
42
- CHIFT_ECOMMERCE_CONSUMER_ID: ${{ secrets.CHIFT_ECOMMERCE_CONSUMER_ID }}
43
- CHIFT_POS_CONSUMER_ID: ${{ secrets.CHIFT_POS_CONSUMER_ID }}
44
- CHIFT_INVOICING_CONSUMER_ID: ${{ secrets.CHIFT_INVOICING_CONSUMER_ID }}
45
- CHIFT_PAYMENT_CONSUMER_ID: ${{ secrets.CHIFT_PAYMENT_CONSUMER_ID }}
46
- CHIFT_PMS_CONSUMER_ID: ${{ secrets.CHIFT_PMS_CONSUMER_ID }}
47
- COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
48
-
49
- - name: Report Coveralls
50
- uses: coverallsapp/github-action@v2
51
-
52
- publish:
53
- name: Publish
54
- if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v')
55
- runs-on: ubuntu-latest
56
- needs: test
57
- steps:
58
- - name: Checkout
59
- uses: actions/checkout@v3
60
-
61
- - name: Use Node.js 16.x
62
- uses: actions/setup-node@v3
63
- with:
64
- node-version: 16.x
65
-
66
- - name: Install dependencies
67
- run: npm install
68
-
69
- - name: Build
70
- run: npm run build
71
-
72
- - name: Publish
73
- uses: JS-DevTools/npm-publish@v1
74
- with:
75
- token: ${{ secrets.NPM_TOKEN }}
package/.husky/pre-commit DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npx lint-staged
package/.prettierignore DELETED
@@ -1 +0,0 @@
1
- dist
package/.prettierrc.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "printWidth": 100,
3
- "tabWidth": 4,
4
- "singleQuote": true,
5
- "jsxBracketSameLine": true,
6
- "trailingComma": "es5"
7
- }
package/CHANGELOG.md DELETED
@@ -1,108 +0,0 @@
1
- # Changelog
2
-
3
- ## 1.0.0 - 2023-09-14
4
-
5
- - First release with scopes of the 5 unified APIs (Accounting, POS, eCommerce, Invoicing & Payment) of Chift and the management of consumers, connections & webhooks.
6
- - Review of tests and CI-pipeline
7
-
8
- ## 1.0.1 - 2023-09-21
9
-
10
- - Update accounting model
11
- - add getOutstandings route
12
-
13
- ## 1.0.2 - 2023-10-02
14
-
15
- - add createFinancialEntry params
16
- - add createJournalEntry route
17
-
18
- ## 1.0.3 - 2023-10-09
19
-
20
- - fix missing accounting model definitions
21
-
22
- ## 1.0.4 - 2023-10-18
23
-
24
- - Update createFinancialEntry endpoint
25
- - Deprecate previous createFinancialEntry endpoint (changed to createFinancialEntryOld)
26
-
27
- ## 1.0.5 - 2023-10-26
28
-
29
- - Return correct error on authentication (promise)
30
-
31
- ## 1.0.6 - 2023-11-24
32
-
33
- - Update models & add new POS Routes
34
-
35
- ## 1.0.7 - 2024-03-26
36
-
37
- - [ACCOUNTING] Remove getAnalyticLinesOfAccount
38
- - [ACCOUNTING] Deprecate/Replace Create Journal Entry
39
- - [ACCOUNTING] Update create misc operation params
40
- - [ACCOUNTING] Update get misc operation params
41
- - [ACCOUNTING] Update get balance of accounts params
42
- - [ACCOUNTING] Update get employees params
43
- - [POS] Add getAccountingCategories
44
- - [POS] Fix getProductCategories type
45
- - [ECOMMERCE] Add getPaymentMethods
46
- - [ECOMMERCE] Add getProductCategories
47
- - [ECOMMERCE] Add getCountries
48
- - [ECOMMERCE] Add getTaxes
49
- - [SYNC] Add create sync
50
- - [SYNC] Add update sync
51
- - [CONSUMER] Add enable consumer flow
52
-
53
- ## 1.0.8 - 2024-04-04
54
-
55
- - [ACCOUNTING] Add params to getAnalyticPlans
56
- - [ACCOUNTING] Add params to getClients
57
- - [ACCOUNTING] Add params to getClient
58
- - [ACCOUNTING] Add params to updateClient
59
- - [ACCOUNTING] Add params to getSuppliers
60
- - [ACCOUNTING] Add params to getSupplier
61
- - [ACCOUNTING] Add params to updateSupplier
62
- - [ACCOUNTING] Add params to createAnalyticAccount
63
- - [ACCOUNTING] Add params to getAnalyticAccounts
64
- - [ACCOUNTING] Add params to createAnalyticAccountWithMultiplePlans
65
- - [ACCOUNTING] Add params to getAnalyticAccount
66
- - [ACCOUNTING] Add params to updateAnalyticAccount
67
- - [ACCOUNTING] Add params to getAnalyticAccountWithMultiplePlans
68
- - [ACCOUNTING] Add params to getAnalyticAccountsWithMultiplePlans
69
- - [ACCOUNTING] Add params to updateAnalyticAccountWithMultiplePlans
70
- - [ACCOUNTING] Add params to getPaymentsByInvoiceId
71
- - [ACCOUNTING] Add params to getJournals
72
- - [ACCOUNTING] Add params to getVatCodes
73
- - [ACCOUNTING] Add route getAttachments
74
- - [ACCOUNTING] Add route matchEntries
75
- - [ACCOUNTING] Add route getFolders
76
-
77
- ## 1.0.9 - 2024-04-10
78
-
79
- - Add getIntegrations params
80
-
81
- ### 1.0.12 - 2024-04-29
82
-
83
- - Remove pagination from route params as it is handled by the library
84
- - Make route params optional when they are not required
85
-
86
- ## 1.0.13 - 2024-05-07
87
-
88
- - Add X-Chift-ConnectionId header
89
- - Add X-Chift-IntegrationId header
90
-
91
- ## 1.0.14 - 2024-05-21
92
-
93
- - Enhance auto-pagination
94
-
95
- ## 1.0.15 - 2024-05-23
96
-
97
- - Support PMS vertical
98
-
99
- ## 1.0.16 - 2024-05-31
100
-
101
- - Update model - Get integrations
102
-
103
- ## 1.0.17 - 2024-09-20
104
-
105
- - Update models
106
- - Add payment API
107
- - Add payment API tests
108
- - Add PMS API tests
package/jest.config.ts DELETED
@@ -1,195 +0,0 @@
1
- /*
2
- * For a detailed explanation regarding each configuration property and type check, visit:
3
- * https://jestjs.io/docs/configuration
4
- */
5
-
6
- export default {
7
- // All imported modules in your tests should be mocked automatically
8
- // automock: false,
9
-
10
- // Stop running tests after `n` failures
11
- // bail: 0,
12
-
13
- // The directory where Jest should store its cached dependency information
14
- // cacheDirectory: "/private/var/folders/z7/d2q2nkfs49x74tqyg3t_7zt40000gn/T/jest_dx",
15
-
16
- // Automatically clear mock calls, instances, contexts and results before every test
17
- clearMocks: true,
18
-
19
- // Indicates whether the coverage information should be collected while executing the test
20
- collectCoverage: true,
21
-
22
- // An array of glob patterns indicating a set of files for which coverage information should be collected
23
- // collectCoverageFrom: undefined,
24
-
25
- // The directory where Jest should output its coverage files
26
- coverageDirectory: 'coverage',
27
-
28
- // An array of regexp pattern strings used to skip coverage collection
29
- // coveragePathIgnorePatterns: [
30
- // "/node_modules/"
31
- // ],
32
-
33
- // Indicates which provider should be used to instrument code for coverage
34
- coverageProvider: 'v8',
35
-
36
- // A list of reporter names that Jest uses when writing coverage reports
37
- // coverageReporters: [
38
- // "json",
39
- // "text",
40
- // "lcov",
41
- // "clover"
42
- // ],
43
-
44
- // An object that configures minimum threshold enforcement for coverage results
45
- // coverageThreshold: undefined,
46
-
47
- // A path to a custom dependency extractor
48
- // dependencyExtractor: undefined,
49
-
50
- // Make calling deprecated APIs throw helpful error messages
51
- // errorOnDeprecated: false,
52
-
53
- // The default configuration for fake timers
54
- // fakeTimers: {
55
- // "enableGlobally": false
56
- // },
57
-
58
- // Force coverage collection from ignored files using an array of glob patterns
59
- // forceCoverageMatch: [],
60
-
61
- // A path to a module which exports an async function that is triggered once before all test suites
62
- // globalSetup: undefined,
63
-
64
- // A path to a module which exports an async function that is triggered once after all test suites
65
- // globalTeardown: undefined,
66
-
67
- // A set of global variables that need to be available in all test environments
68
- // globals: {},
69
-
70
- // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
71
- // maxWorkers: "50%",
72
-
73
- // An array of directory names to be searched recursively up from the requiring module's location
74
- moduleDirectories: ['node_modules', 'src'],
75
-
76
- // An array of file extensions your modules use
77
- // moduleFileExtensions: [
78
- // "js",
79
- // "mjs",
80
- // "cjs",
81
- // "jsx",
82
- // "ts",
83
- // "tsx",
84
- // "json",
85
- // "node"
86
- // ],
87
-
88
- // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
89
- // moduleNameMapper: {},
90
-
91
- // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
92
- // modulePathIgnorePatterns: [],
93
-
94
- // Activates notifications for test results
95
- // notify: false,
96
-
97
- // An enum that specifies notification mode. Requires { notify: true }
98
- // notifyMode: "failure-change",
99
-
100
- // A preset that is used as a base for Jest's configuration
101
- preset: 'ts-jest',
102
-
103
- // Run tests from one or more projects
104
- // projects: undefined,
105
-
106
- // Use this configuration option to add custom reporters to Jest
107
- // reporters: undefined,
108
-
109
- // Automatically reset mock state before every test
110
- // resetMocks: false,
111
-
112
- // Reset the module registry before running each individual test
113
- // resetModules: false,
114
-
115
- // A path to a custom resolver
116
- // resolver: undefined,
117
-
118
- // Automatically restore mock state and implementation before every test
119
- // restoreMocks: false,
120
-
121
- // The root directory that Jest should scan for tests and modules within
122
- // rootDir: undefined,
123
-
124
- // A list of paths to directories that Jest should use to search for files in
125
- // roots: [
126
- // "<rootDir>"
127
- // ],
128
-
129
- // Allows you to use a custom runner instead of Jest's default test runner
130
- // runner: "jest-runner",
131
-
132
- // The paths to modules that run some code to configure or set up the testing environment before each test
133
- // setupFiles: [],
134
-
135
- // A list of paths to modules that run some code to configure or set up the testing framework before each test
136
- // setupFilesAfterEnv: [],
137
-
138
- // The number of seconds after which a test is considered as slow and reported as such in the results.
139
- // slowTestThreshold: 5,
140
-
141
- // A list of paths to snapshot serializer modules Jest should use for snapshot testing
142
- // snapshotSerializers: [],
143
-
144
- // The test environment that will be used for testing
145
- testEnvironment: 'node',
146
-
147
- // Options that will be passed to the testEnvironment
148
- // testEnvironmentOptions: {},
149
-
150
- // Adds a location field to test results
151
- // testLocationInResults: false,
152
-
153
- // The glob patterns Jest uses to detect test files
154
- // testMatch: [
155
- // "**/__tests__/**/*.[jt]s?(x)",
156
- // "**/?(*.)+(spec|test).[tj]s?(x)"
157
- // ],
158
-
159
- // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
160
- // testPathIgnorePatterns: [
161
- // "/node_modules/"
162
- // ],
163
-
164
- // The regexp pattern or array of patterns that Jest uses to detect test files
165
- // testRegex: [],
166
-
167
- // This option allows the use of a custom results processor
168
- // testResultsProcessor: undefined,
169
-
170
- // This option allows use of a custom test runner
171
- // testRunner: "jest-circus/runner",
172
-
173
- // A map from regular expressions to paths to transformers
174
- //transform: undefined,
175
-
176
- // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
177
- // transformIgnorePatterns: [
178
- // "/node_modules/",
179
- // "\\.pnp\\.[^\\/]+$"
180
- // ],
181
-
182
- // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
183
- // unmockedModulePathPatterns: undefined,
184
-
185
- // Indicates whether each individual test should be reported during the run
186
- // verbose: undefined,
187
-
188
- // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
189
- // watchPathIgnorePatterns: [],
190
-
191
- // Whether to use watchman for file crawling
192
- // watchman: true,
193
-
194
- testTimeout: 60000,
195
- };
@@ -1,22 +0,0 @@
1
- import { InternalAPI } from '../modules/internalApi';
2
- import { RequestFactory, ApiFor } from '../types/api';
3
-
4
- export function createApiFor<TFactory extends RequestFactory>(
5
- factory: TFactory,
6
- internalApi: InternalAPI,
7
- consumerName: string,
8
- consumerId: string
9
- ) {
10
- return new Proxy(factory, {
11
- get(target: any, property) {
12
- return (...args: any[]) => {
13
- const requestData = target[property](...args);
14
- requestData.property = property;
15
- requestData.consumerName = consumerName;
16
- requestData.consumerId = consumerId;
17
- requestData.url = requestData.url.replace('{consumer_id}', consumerId);
18
- return internalApi.makeRequest(requestData);
19
- };
20
- },
21
- }) as unknown as ApiFor<TFactory>;
22
- }
@@ -1,3 +0,0 @@
1
- export default {
2
- BASE_URL: 'https://api.chift.eu',
3
- };
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './modules/api';