Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
6b73313bbc | |||
d58f21f5de | |||
4c13cae34d | |||
f800d61576 | |||
679d1cf9c4 | |||
ce060f0cf9 | |||
4d4d46ef7c | |||
696d56067c | |||
fa3f4b4ccf | |||
5b823b09ac | |||
ebd50b0bed | |||
9f70eba74a |
139
.gitlab-ci.yml
139
.gitlab-ci.yml
@@ -1,139 +0,0 @@
|
|||||||
# gitzone ci_default
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .npmci_cache/
|
|
||||||
key: '$CI_BUILD_STAGE'
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- security
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- metadata
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- npm install -g @shipzone/npmci
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# security stage
|
|
||||||
# ====================
|
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
auditProductionDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --production --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=prod --production
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
auditDevDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=dev
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# test stage
|
|
||||||
# ====================
|
|
||||||
|
|
||||||
testStable:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
testBuild:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command npm run build
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# metadata stage
|
|
||||||
# ====================
|
|
||||||
codequality:
|
|
||||||
stage: metadata
|
|
||||||
allow_failure: true
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
script:
|
|
||||||
- npmci command npm install -g typescript
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
pages:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command npm run buildDocs
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
allow_failure: true
|
|
113
changelog.md
Normal file
113
changelog.md
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-04-28 - 1.0.21 - fix(metadata)
|
||||||
|
Update repository, package, and branding details to reflect new project ownership and naming
|
||||||
|
|
||||||
|
- Changed author in package.json from 'Lossless GmbH' to 'Task Venture Capital GmbH'
|
||||||
|
- Updated repository URL, issues URL, and homepage in package.json
|
||||||
|
- Revised npmextra.json with updated githost, gitscope, npmPackagename, and projectDomain
|
||||||
|
- Updated readme.md to replace '@mojoio/letterxpress' with '@apiclient.xyz/letterxpress' and adjust corresponding links
|
||||||
|
- Replaced old license file with new license.md reflecting updated copyright information
|
||||||
|
|
||||||
|
## 2025-03-15 - 1.0.20 - fix(letterxpress)
|
||||||
|
Update dependencies, adjust PDF generation parameters, and remove obsolete CI configuration
|
||||||
|
|
||||||
|
- Updated @push.rocks/smartbuffer from ^2.0.1 to ^3.0.4
|
||||||
|
- Updated @tsclass/tsclass from ^4.0.54 to ^5.0.0
|
||||||
|
- Updated @types/node from ^20.12.7 to ^22.13.10
|
||||||
|
- Changed dees-document import path to use the 'node' entry point
|
||||||
|
- Modified sendLetter to pass an object with letterData and documentSettings to createPdfFromLetterObject
|
||||||
|
- Removed obsolete .gitlab-ci.yml file
|
||||||
|
|
||||||
|
## 2024-04-17 - 1.0.18 - core
|
||||||
|
fix(core): update
|
||||||
|
|
||||||
|
- Core module updated.
|
||||||
|
|
||||||
|
## 2024-02-19 - 1.0.17 - core
|
||||||
|
fix(core): update
|
||||||
|
|
||||||
|
- Core module updated.
|
||||||
|
|
||||||
|
## 2024-02-17 - 1.0.16 - core
|
||||||
|
fix(core): update
|
||||||
|
|
||||||
|
- Core module updated.
|
||||||
|
|
||||||
|
## 2024-02-16 - 1.0.15 - core
|
||||||
|
fix(core): update
|
||||||
|
|
||||||
|
- Core module updated.
|
||||||
|
|
||||||
|
## 2022-06-29 - 1.0.14 - core
|
||||||
|
fix(core): update
|
||||||
|
|
||||||
|
- Core module update applied.
|
||||||
|
|
||||||
|
## 2022-06-16 - 1.0.13 - core
|
||||||
|
fix(core): update
|
||||||
|
|
||||||
|
- Core module update applied.
|
||||||
|
|
||||||
|
## 2022-06-16 - 1.0.12 - core
|
||||||
|
fix(core): update
|
||||||
|
|
||||||
|
- Core module update applied.
|
||||||
|
|
||||||
|
## 2022-06-16 - 1.0.11 - core
|
||||||
|
fix(core): update
|
||||||
|
|
||||||
|
- Core module update applied.
|
||||||
|
|
||||||
|
## 2019-11-22 - 1.0.10 - build
|
||||||
|
fix(build): now including all necessary types
|
||||||
|
|
||||||
|
- Included all necessary type definitions in the build process.
|
||||||
|
|
||||||
|
## 2019-11-22 - 1.0.09 - security
|
||||||
|
fix(security): update snyk
|
||||||
|
|
||||||
|
- Updated snyk for improved security.
|
||||||
|
|
||||||
|
## 2019-11-22 - 1.0.08 - core
|
||||||
|
fix(core): update
|
||||||
|
|
||||||
|
- Core module updated.
|
||||||
|
|
||||||
|
## 2019-11-21 - 1.0.07 - core
|
||||||
|
fix(core): update
|
||||||
|
|
||||||
|
- Core module updated.
|
||||||
|
|
||||||
|
## 2019-11-18 - 1.0.06 - readme
|
||||||
|
fix(readme): show how to instantiate account
|
||||||
|
|
||||||
|
- Updated documentation to show how to instantiate an account.
|
||||||
|
|
||||||
|
## 2019-11-18 - 1.0.05 - readme
|
||||||
|
fix(readme): add links to documentation
|
||||||
|
|
||||||
|
- Added links to documentation in the readme.
|
||||||
|
|
||||||
|
## 2019-11-18 - 1.0.04 - test
|
||||||
|
fix(test): add first account test
|
||||||
|
|
||||||
|
- Added the first account test.
|
||||||
|
|
||||||
|
## 2019-11-18 - 1.0.03 - core
|
||||||
|
fix(core): update
|
||||||
|
|
||||||
|
- Core module updated.
|
||||||
|
|
||||||
|
## 2019-11-16 - 1.0.02 - core
|
||||||
|
fix(core): update
|
||||||
|
|
||||||
|
- Core module updated.
|
||||||
|
|
||||||
|
## 2019-11-13 - 1.0.01 - core
|
||||||
|
fix(core): update
|
||||||
|
|
||||||
|
- Core module updated.
|
||||||
|
|
||||||
|
## Other versions (omitted)
|
||||||
|
The following version(s) included only version bump commits without additional changes: 1.0.19.
|
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2019 Lossless GmbH (hello@lossless.com)
|
Copyright (c) 2019 Task Venture Capital GmbH (hello@task.vc)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -2,13 +2,13 @@
|
|||||||
"gitzone": {
|
"gitzone": {
|
||||||
"projectType": "npm",
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "code.foss.global",
|
||||||
"gitscope": "mojoio",
|
"gitscope": "apiclient.xyz",
|
||||||
"gitrepo": "letterxpress",
|
"gitrepo": "letterxpress",
|
||||||
"description": "an unofficial API package for the letterxpress API",
|
"description": "an unofficial API package for the letterxpress API",
|
||||||
"npmPackagename": "@mojoio/letterxpress",
|
"npmPackagename": "@apiclient.xyz/letterxpress",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"projectDomain": "mojo.io"
|
"projectDomain": "apiclient.xyz"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npmci": {
|
"npmci": {
|
||||||
|
14464
package-lock.json
generated
14464
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
50
package.json
50
package.json
@@ -1,33 +1,42 @@
|
|||||||
{
|
{
|
||||||
"name": "@mojoio/letterxpress",
|
"name": "@apiclient.xyz/letterxpress",
|
||||||
"version": "1.0.15",
|
"version": "1.0.21",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "an unofficial API package for the letterxpress API",
|
"description": "an unofficial API package for the letterxpress API",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"author": "Lossless GmbH",
|
"author": "Task Venture Capital GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://code.foss.global/apiclient.xyz/letterxpress.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://code.foss.global/apiclient.xyz/letterxpress/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://code.foss.global/apiclient.xyz/letterxpress#readme",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild --web --allowimplicitany)",
|
"build": "(tsbuild --web --allowimplicitany)",
|
||||||
"format": "(gitzone format)",
|
"format": "(gitzone format)",
|
||||||
"buildDocs": "tsdoc"
|
"localPublish": "gitzone commit && pnpm run build && pnpm publish && pnpm publish --access public --registry=\"https://registry.npmjs.org\""
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.63",
|
"@git.zone/tsbuild": "^2.1.63",
|
||||||
"@gitzone/tstest": "^1.0.71",
|
"@git.zone/tsrun": "^1.2.46",
|
||||||
"@pushrocks/qenv": "^4.0.10",
|
"@git.zone/tstest": "^1.0.88",
|
||||||
"@pushrocks/tapbundle": "^5.0.3",
|
"@push.rocks/qenv": "^6.0.5",
|
||||||
"@types/node": "^18.0.0"
|
"@push.rocks/tapbundle": "^5.0.23",
|
||||||
|
"@types/node": "^22.13.10"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartbuffer": "^1.0.3",
|
"@design.estate/dees-document": "^1.0.99",
|
||||||
"@pushrocks/smarthash": "^3.0.1",
|
"@push.rocks/smartbuffer": "^3.0.4",
|
||||||
"@pushrocks/smartletter": "^2.0.13",
|
"@push.rocks/smarthash": "^3.0.1",
|
||||||
"@pushrocks/smartpromise": "^3.1.7",
|
"@push.rocks/smartpromise": "^4.0.3",
|
||||||
"@pushrocks/smartrequest": "^1.1.56",
|
"@push.rocks/smartrequest": "^2.0.22",
|
||||||
"@pushrocks/smartrx": "^2.0.25",
|
"@push.rocks/smartrx": "^3.0.7",
|
||||||
"@tsclass/tsclass": "^4.0.17"
|
"@tsclass/tsclass": "^5.0.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
@@ -44,5 +53,12 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
]
|
],
|
||||||
|
"pnpm": {
|
||||||
|
"onlyBuiltDependencies": [
|
||||||
|
"esbuild",
|
||||||
|
"mongodb-memory-server",
|
||||||
|
"puppeteer"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
10054
pnpm-lock.yaml
generated
Normal file
10054
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
0
readme.hints.md
Normal file
0
readme.hints.md
Normal file
39
readme.md
39
readme.md
@@ -1,27 +1,11 @@
|
|||||||
# @mojoio/letterxpress
|
# @apiclient.xyz/letterxpress
|
||||||
an unofficial API package for the letterxpress API
|
an unofficial API package for the letterxpress API
|
||||||
|
|
||||||
## Availabililty and Links
|
## Availability and Links
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@mojoio/letterxpress)
|
* [npm package](https://www.npmjs.com/package/@apiclient.xyz/letterxpress)
|
||||||
* [gitlab.com (source)](https://gitlab.com/mojoio/letterxpress)
|
* [Source code (Code.Foss.Global)](https://code.foss.global/apiclient.xyz/letterxpress)
|
||||||
* [github.com (source mirror)](https://github.com/mojoio/letterxpress)
|
* [Issue tracker](https://code.foss.global/apiclient.xyz/letterxpress/issues)
|
||||||
* [docs (typedoc)](https://mojoio.gitlab.io/letterxpress/)
|
|
||||||
|
|
||||||
## Status for master
|
|
||||||
|
|
||||||
Status Category | Status Badge
|
|
||||||
-- | --
|
|
||||||
GitLab Pipelines | [](https://lossless.cloud)
|
|
||||||
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
|
||||||
npm | [](https://lossless.cloud)
|
|
||||||
Snyk | [](https://lossless.cloud)
|
|
||||||
TypeScript Support | [](https://lossless.cloud)
|
|
||||||
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
|
||||||
Code Style | [](https://lossless.cloud)
|
|
||||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
|
||||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
|
||||||
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
|
||||||
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -30,7 +14,7 @@ Use TypeScript for best in class intellisense.
|
|||||||
letterxpress implements the LXP API documented here: [LXP API Documentation](https://www.letterxpress.de/briefe-uebertragen/api)
|
letterxpress implements the LXP API documented here: [LXP API Documentation](https://www.letterxpress.de/briefe-uebertragen/api)
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import * as letterxpress from '@mojoio/letterxpress';
|
import * as letterxpress from '@apiclient.xyz/letterxpress';
|
||||||
|
|
||||||
const account = new letterxpress.LetterXpressAccount({
|
const account = new letterxpress.LetterXpressAccount({
|
||||||
email: 'myemail@example.com',
|
email: 'myemail@example.com',
|
||||||
@@ -38,13 +22,8 @@ const account = new letterxpress.LetterXpressAccount({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contribution
|
## Contributing
|
||||||
|
|
||||||
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
Contributions, bug reports, and feature requests are welcome! Please open an issue or submit a pull request at [Code.Foss.Global](https://code.foss.global/apiclient.xyz/letterxpress/issues).
|
||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
> MIT licensed | © Task Venture Capital GmbH
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
|
||||||
|
|
||||||
[](https://maintainedby.lossless.com)
|
|
||||||
|
@@ -1,17 +1,17 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
import * as letterxpress from '../ts/index.js';
|
import * as letterxpress from '../ts/index.js';
|
||||||
import * as tsclass from '@tsclass/tsclass';
|
import * as tsclass from '@tsclass/tsclass';
|
||||||
|
|
||||||
import { Qenv } from '@pushrocks/qenv';
|
import { Qenv } from '@push.rocks/qenv';
|
||||||
let testQenv = new Qenv('./', './.nogit/');
|
let testQenv = new Qenv('./', './.nogit/');
|
||||||
|
|
||||||
let testAccount: letterxpress.LetterXpressAccount;
|
let testAccount: letterxpress.LetterXpressAccount;
|
||||||
let testLetter: tsclass.business.ILetter;
|
let testLetter: tsclass.business.ILetter;
|
||||||
|
|
||||||
tap.test('should create a valid account', async () => {
|
tap.test('should create a valid account', async () => {
|
||||||
testAccount = await letterxpress.LetterXpressAccount.createAndInit({
|
testAccount = await letterxpress.LetterXpressAccount.createAndStart({
|
||||||
apiKey: testQenv.getEnvVarOnDemand('API_TOKEN'),
|
apiKey: await testQenv.getEnvVarOnDemand('API_TOKEN'),
|
||||||
username: testQenv.getEnvVarOnDemand('API_USERNAME'),
|
username: await testQenv.getEnvVarOnDemand('API_USERNAME'),
|
||||||
});
|
});
|
||||||
expect(testAccount).toBeInstanceOf(letterxpress.LetterXpressAccount);
|
expect(testAccount).toBeInstanceOf(letterxpress.LetterXpressAccount);
|
||||||
});
|
});
|
||||||
@@ -75,31 +75,36 @@ tap.test('should send an actual letter', async () => {
|
|||||||
vatId: 'DE293580420',
|
vatId: 'DE293580420',
|
||||||
},
|
},
|
||||||
subject: 'General Terms - Update',
|
subject: 'General Terms - Update',
|
||||||
text: [
|
content: {
|
||||||
`
|
textData: [`
|
||||||
To whome it may concern,
|
To whome it may concern,
|
||||||
|
|
||||||
**this is a testmessage.** we write to inform you about a change in our General Terms.
|
**this is a testmessage.** we write to inform you about a change in our General Terms.
|
||||||
As of December 1st 2019 we will start storing IPs that connect to our app for a period of 3 month.
|
As of December 1st 2019 we will start storing IPs that connect to our app for a period of 3 month.
|
||||||
|
|
||||||
Regards
|
Regards
|
||||||
Lossless GmbH - Legal Department
|
Lossless GmbH - Legal Department
|
||||||
|
|
||||||
`,
|
`],
|
||||||
],
|
timesheetData: null,
|
||||||
|
},
|
||||||
date: Date.now(),
|
date: Date.now(),
|
||||||
language: 'DE',
|
language: 'DE',
|
||||||
logoUrl: '',
|
logoUrl: '',
|
||||||
needsCoverSheet: true,
|
needsCoverSheet: true,
|
||||||
objectActions: [],
|
objectActions: [],
|
||||||
pdfAttachments: [],
|
pdfAttachments: [],
|
||||||
timesheetData: null,
|
type: 'notice',
|
||||||
|
versionInfo: {
|
||||||
|
type: 'final',
|
||||||
|
version: '1.0.0',
|
||||||
|
}
|
||||||
};
|
};
|
||||||
await testAccount.sendLetter(testLetter);
|
const result = await testAccount.sendLetter(testLetter);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should be able to delete the sending job', async (toolsArg) => {
|
tap.test('should be able to delete the sending job', async (toolsArg) => {
|
||||||
await toolsArg.delayFor(3000);
|
await toolsArg.delayFor(5000);
|
||||||
await testAccount.cancelLetter(testLetter);
|
await testAccount.cancelLetter(testLetter);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* autocreated commitinfo by @pushrocks/commitinfo
|
* autocreated commitinfo by @push.rocks/commitinfo
|
||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@mojoio/letterxpress',
|
name: '@apiclient.xyz/letterxpress',
|
||||||
version: '1.0.15',
|
version: '1.0.21',
|
||||||
description: 'an unofficial API package for the letterxpress API'
|
description: 'an unofficial API package for the letterxpress API'
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
import { IObjectAction } from '@tsclass/tsclass/dist_ts/database/objectaction.js';
|
|
||||||
|
|
||||||
import * as plugins from './letterxpress.plugins.js';
|
import * as plugins from './letterxpress.plugins.js';
|
||||||
|
|
||||||
export interface ILetterXpressConstructorOptions {
|
export interface ILetterXpressConstructorOptions {
|
||||||
@@ -9,16 +7,16 @@ export interface ILetterXpressConstructorOptions {
|
|||||||
|
|
||||||
export class LetterXpressAccount {
|
export class LetterXpressAccount {
|
||||||
// STATIC
|
// STATIC
|
||||||
public static async createAndInit(optionsArg: ConstructorParameters<typeof LetterXpressAccount>[0]) {
|
public static async createAndStart(optionsArg: ConstructorParameters<typeof LetterXpressAccount>[0]) {
|
||||||
const letterXpressInstance = new LetterXpressAccount(optionsArg);
|
const letterXpressInstance = new LetterXpressAccount(optionsArg);
|
||||||
await letterXpressInstance.init();
|
await letterXpressInstance.start();
|
||||||
return letterXpressInstance;
|
return letterXpressInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
public baseApiUrl = 'https://api.letterxpress.de/v1';
|
public baseApiUrl = 'https://api.letterxpress.de/v2';
|
||||||
public options: ILetterXpressConstructorOptions;
|
public options: ILetterXpressConstructorOptions;
|
||||||
public smartletterInstance: plugins.smartletter.Smartletter;
|
public deesDocumentInstance: plugins.deesDocument.PdfService;
|
||||||
|
|
||||||
public letterSentObservable = new plugins.smartrx.rxjs.Subject<plugins.tsclass.business.ILetter>();
|
public letterSentObservable = new plugins.smartrx.rxjs.Subject<plugins.tsclass.business.ILetter>();
|
||||||
|
|
||||||
@@ -27,8 +25,8 @@ export class LetterXpressAccount {
|
|||||||
this.options = optionsArg;
|
this.options = optionsArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async init() {
|
public async start() {
|
||||||
this.smartletterInstance = await plugins.smartletter.Smartletter.createAndInit();
|
this.deesDocumentInstance = await plugins.deesDocument.PdfService.createAndStart({});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,18 +34,17 @@ export class LetterXpressAccount {
|
|||||||
* @param letterArg
|
* @param letterArg
|
||||||
*/
|
*/
|
||||||
public async sendLetter(letterArg: plugins.tsclass.business.ILetter) {
|
public async sendLetter(letterArg: plugins.tsclass.business.ILetter) {
|
||||||
const letter = await this.smartletterInstance.createLetterFromData(letterArg);
|
const pdfToSend = await this.deesDocumentInstance.createPdfFromLetterObject({letterData: letterArg, documentSettings: {}});
|
||||||
const pdfToSend = await letter.getCombinedPdf();
|
const response = await this.request('/printjobs', 'POST', {
|
||||||
const response = await this.request('/setJob', 'POST', {
|
|
||||||
letter: {
|
letter: {
|
||||||
base64_file: plugins.smartbuffer.arrayBufferToBase64(pdfToSend.buffer),
|
base64_file: plugins.smartbuffer.uInt8ArrayToBase64(pdfToSend.buffer),
|
||||||
base64_checksum: await plugins.smarthash.md5FromString(
|
base64_file_checksum: await plugins.smarthash.md5FromString(
|
||||||
plugins.smartbuffer.arrayBufferToBase64(pdfToSend.buffer)
|
plugins.smartbuffer.uInt8ArrayToBase64(pdfToSend.buffer)
|
||||||
),
|
),
|
||||||
specification: {
|
specification: {
|
||||||
color: '4',
|
color: '4',
|
||||||
mode: 'simplex',
|
mode: 'simplex',
|
||||||
ship: letterArg.to.address.country === 'Germany' ? 'national' : 'international',
|
shipping: letterArg.to.address.country === 'Germany' ? 'national' : 'international',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -55,7 +52,7 @@ export class LetterXpressAccount {
|
|||||||
name: 'letterxpress-sent',
|
name: 'letterxpress-sent',
|
||||||
message: 'requested letterxpress to send the letter',
|
message: 'requested letterxpress to send the letter',
|
||||||
privateMessage: null,
|
privateMessage: null,
|
||||||
data: response.body.letter.job_id,
|
data: response.body.data.id,
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
userId: null
|
userId: null
|
||||||
})
|
})
|
||||||
@@ -74,9 +71,7 @@ export class LetterXpressAccount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async cancelLetterByProcessingId(processingId: string) {
|
public async cancelLetterByProcessingId(processingId: string) {
|
||||||
const response = await this.request(`/deleteJob/${processingId}`, 'DELETE', {
|
const response = await this.request(`/printjobs/${processingId}`, 'DELETE', {});
|
||||||
letter: {}
|
|
||||||
});
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,23 +83,27 @@ export class LetterXpressAccount {
|
|||||||
console.log(requestUrl);
|
console.log(requestUrl);
|
||||||
const requestData = {
|
const requestData = {
|
||||||
auth: {
|
auth: {
|
||||||
|
mode: "live",
|
||||||
username: this.options.username,
|
username: this.options.username,
|
||||||
apikey: this.options.apiKey,
|
apikey: this.options.apiKey,
|
||||||
},
|
},
|
||||||
...payload,
|
...payload,
|
||||||
};
|
};
|
||||||
|
// console.log(methodArg);
|
||||||
|
// console.log(requestData);
|
||||||
const response = await plugins.smartrequest.request(requestUrl, {
|
const response = await plugins.smartrequest.request(requestUrl, {
|
||||||
method: methodArg,
|
method: methodArg,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
requestBody: JSON.stringify(requestData),
|
requestBody: JSON.stringify(requestData),
|
||||||
|
keepAlive: false,
|
||||||
});
|
});
|
||||||
console.log(response.body);
|
console.log(response.body);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async stop() {
|
public async stop() {
|
||||||
await this.smartletterInstance.stop();
|
await this.deesDocumentInstance.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,17 @@
|
|||||||
import * as smartbuffer from '@pushrocks/smartbuffer';
|
import * as smartbuffer from '@push.rocks/smartbuffer';
|
||||||
import * as smarthash from '@pushrocks/smarthash';
|
import * as smarthash from '@push.rocks/smarthash';
|
||||||
import * as smartletter from '@pushrocks/smartletter';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartrequest from '@push.rocks/smartrequest';
|
||||||
import * as smartrequest from '@pushrocks/smartrequest';
|
import * as smartrx from '@push.rocks/smartrx';
|
||||||
import * as smartrx from '@pushrocks/smartrx';
|
|
||||||
|
|
||||||
export { smartbuffer, smarthash, smartletter, smartpromise, smartrequest, smartrx };
|
export { smartbuffer, smarthash, smartpromise, smartrequest, smartrx };
|
||||||
|
|
||||||
|
// @design.estate scope
|
||||||
|
import * as deesDocument from '@design.estate/dees-document/node';
|
||||||
|
|
||||||
|
export {
|
||||||
|
deesDocument
|
||||||
|
}
|
||||||
|
|
||||||
// tsclass scope
|
// tsclass scope
|
||||||
import * as tsclass from '@tsclass/tsclass';
|
import * as tsclass from '@tsclass/tsclass';
|
||||||
|
@@ -3,7 +3,12 @@
|
|||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"useDefineForClassFields": false,
|
"useDefineForClassFields": false,
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "ES2022",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "nodenext"
|
"moduleResolution": "NodeNext",
|
||||||
}
|
"esModuleInterop": true,
|
||||||
|
"verbatimModuleSyntax": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"dist_*/**/*.d.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user