Skip to content

Commit 2c9051c

Browse files
committed
update
1 parent de89755 commit 2c9051c

24 files changed

+19217
-14
lines changed

.eslintrc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"extends": "eslint:recommended",
3+
"env": {
4+
"es2022": true,
5+
"node": true,
6+
"jest": true,
7+
"mocha": true
8+
},
9+
"globals": {
10+
"SELECT": true,
11+
"INSERT": true,
12+
"UPSERT": true,
13+
"UPDATE": true,
14+
"DELETE": true,
15+
"CREATE": true,
16+
"DROP": true,
17+
"CDL": true,
18+
"CQL": true,
19+
"CXL": true,
20+
"cds": true
21+
},
22+
"rules": {
23+
"no-console": "off",
24+
"require-atomic-updates": "off"
25+
}
26+
}

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# CAP invoices
2+
_out
3+
*.db
4+
*.sqlite
5+
connection.properties
6+
default-*.json
7+
.cdsrc-private.json
8+
gen/
9+
node_modules/
10+
target/
11+
12+
# Test Result
13+
coverage
14+
15+
# Web IDE, App Studio
16+
.che/
17+
.gen/
18+
19+
# MTA
20+
*_mta_build_tmp
21+
*.mtar
22+
mta_archives/
23+
24+
# Other
25+
.DS_Store
26+
*.orig
27+
*.log
28+
29+
*.iml
30+
*.flattened-pom.xml
31+
32+
# IDEs
33+
# .vscode
34+
# .idea
35+
36+
# @cap-js/cds-typer
37+
@cds-models

CHANGELOG.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
This project adheres to [Semantic Versioning](http://semver.org/).
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/).
6+
7+
## Version 1.0.9 - TBD
8+
9+
### Added
10+
11+
- License entry
12+
13+
### Fixed
14+
15+
- Handling of multiple records in one request
16+
17+
### Changed
18+
19+
- prepare for CDS9 in tests
20+
21+
## Version 1.0.8 - 28.03.25
22+
23+
### Added
24+
25+
- Added @UI.MultiLineText to value fields
26+
- Added support for Multi-Tenancy
27+
- Added configuration options to disable tracking of CREATE/UPDATE/DELETE operations on a project level
28+
29+
### Fixed
30+
31+
- Handling of numeric and boolean fields was faulty, when an initial value of `0` for numeric or `false` for boolean was supplied
32+
- Decimal values were handled differently for HANA and SQlite
33+
- Missing UI Label for one attribute (`ChangeLog.ID`) of the Changes UI facet
34+
- Support for @UI.HeaderInfo.TypeName as fallback for the UI Label of the key
35+
- Compilation error when an association is used as a key
36+
- Fixed handling of unmanaged composition of many
37+
- Proper casing of the operation enum type
38+
39+
40+
### Changed
41+
42+
- Added warning and mitigation for multi-tenant deployments with MTX
43+
- Added a disclaimer of upcoming new version having a minimum requirement of CDS 8.6 for multitenancy fix
44+
- Changed the default limit on non-HANA databases from 255 to 5000 characters for all String values
45+
- Updated peer dependency from CDS7 to CDS8
46+
47+
48+
## Version 1.0.7 - 20.08.24
49+
50+
### Added
51+
52+
- A global switch to preserve change logs for deleted data
53+
- For hierarchical entities, a method to determine their structure and a flag to indicate whether it is a root entity was introduced. For child entities, information about the parent is recorded.
54+
55+
56+
### Fixed
57+
58+
- CDS 8 does not support queries for draft-enabled entities on the application service anymore. This was causing: SqliteError: NOT NULL constraint failed: (...).DraftAdministrativeData_DraftUUID
59+
- CDS 8 deprecated cds.transaction, causing change logs of nested documents to be wrong, replaced with req.event
60+
- CDS 8 rejects all direct CRUD requests for auto-exposed Compositions in non-draft cases. This was affecting test cases, since the ChangeView falls into this category
61+
- req._params and req.context are not official APIs and stopped working with CDS 8, replaced with official APIs
62+
- When running test cases in CDS 8, some requests failed with a status code of 404
63+
- ServiceEntity is not captured in the ChangeLog table in some cases
64+
- When modeling an inline entity, a non-existent association and parent ID was recorded
65+
- Fixed handling, when reqData was undefined
66+
67+
### Changed
68+
69+
- Peer dependency to @sap/cds changed to ">=7"
70+
- Data marked as personal data using data privacy annotations won't get change-tracked anymore to satisfy product standards
71+
- Restructured Documentation
72+
73+
74+
## Version 1.0.6 - 29.04.24
75+
76+
### Fixed
77+
78+
- Storage of wrong ObjectID in some special scenarios
79+
- Missing localization of managed fields
80+
- Views without keys won't get the association and UI facet pushed anymore
81+
82+
### Added
83+
84+
- A method to disable automatic generation of the UI Facet
85+
86+
### Changed
87+
88+
- Improved documentation of the @changelog Annotation
89+
90+
## Version 1.0.5 - 15.01.24
91+
92+
### Fixed
93+
94+
- Error on HANA when logging Boolean or Numeric Data
95+
96+
## Version 1.0.4 - 08.01.24
97+
98+
### Added
99+
100+
- Side effect annotation now allows automatic refresh after a custom action caused changes
101+
102+
### Changed
103+
104+
- Added a check to disable change tracking for views with a UNION
105+
106+
### Fixed
107+
108+
- Handling of associations within change tracked entities
109+
- Handling of change log when custom actions on child entities are called
110+
111+
## Version 1.0.3 - 10.11.23
112+
113+
### Added
114+
115+
- Added note about using `SAPUI5 v1.120.0` or later for proper lazy loading of the *Change History* table.
116+
- In README, add warning about tracking personal data.
117+
118+
### Changed
119+
120+
- Support cases where parent/child entries are created simultaneously.
121+
- Allow for lazy loading of change history table (with SAP UI5 release 1.120.0).
122+
123+
## Version 1.0.2 - 31.10.23
124+
125+
### Changed
126+
127+
- In README, use view of the full change-tracking table instead of the customized one for the main image.
128+
129+
## Version 1.0.1 - 26.10.23
130+
131+
### Changed
132+
133+
- Flattened README structure.
134+
135+
### Fixed
136+
137+
- Labels are looked up from the service entity (not the db entity only).
138+
139+
## Version 1.0.0 - 18.10.23
140+
141+
### Added
142+
143+
- Initial release
144+

README.md

Lines changed: 131 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,143 @@
1-
[![REUSE status](https://api.reuse.software/badge/github.com/cap-js/print)](https://api.reuse.software/info/github.com/cap-js/print)
2-
3-
# print
1+
# Welcome to @print
42

53
## About this project
64

7-
Streamline document printing workflows with a lightweight, API-driven service. Supports cross-platform integration, queue management.
5+
`@print` is a CDS plugin providing print service features, [SAP Print Service](https://api.sap.com/api/PRINTAPI/overview).
6+
7+
8+
## Table of Contents
9+
10+
- [About this project](#about-this-project)
11+
- [Requirements](#requirements)
12+
- [Setup](#setup)
13+
14+
## Requirements
15+
16+
See [Getting Started](https://cap.cloud.sap/docs/get-started) on how to jumpstart your development and grow as you go with SAP Cloud Application Programming Model.
17+
18+
## Setup
19+
20+
To integrate the print functionality in your application, simply annotate any action with `@print`. This annotation automatically manages the process of sending documents to the print queues, requiring no additional setup for handling print jobs.
21+
22+
### Required Fields
23+
24+
The following three fields should be annotated with the corresponding `@print` annotations:
25+
26+
1. **`@print.queue`**: Specifies the queue to which the document should be sent for printing.
27+
2. **`@print.numberOfCopies`**: Defines the number of copies to be printed.
28+
3. **`@print.fileContent`**: Provides the file content to be printed. You can also specify the file name using the `fileNameField` property.
29+
30+
#### Example
31+
32+
```cds
33+
@print.fileContent: {
34+
fileNameField: '<Field Name>',
35+
}
36+
```
37+
38+
Multiple fields can be annotated with `@print.fileContent` to send several documents to the print queue in a single action.
39+
40+
### Main Document
41+
42+
To designate a specific document as the primary document for printing, annotate it with `@print.MainDocument`:
43+
44+
```cds
45+
@print.MainDocument
46+
invoiceContent,
47+
```
48+
49+
This ensures the specified document is treated as the main document when multiple documents are involved.
50+
51+
## Print Queue Configuration
52+
53+
You can retrieve all available print queues from the Print Service Application for selection by defining a `Queues` entity with **skip persistency**. This setup will offer a value help for the print queues, allowing users to select from available options.
54+
55+
### Define the `Queues` Entity
56+
57+
Define an entity like `Product` and associate it with the `Queues` entity as shown below:
58+
59+
#### Example
60+
```cds
61+
entity Product {
62+
qName : Association to one Queues;
63+
}
64+
65+
@cds.skip.persistence
66+
entity Queues {
67+
key ID : String;
68+
description : String;
69+
}
70+
```
71+
72+
#### Annotating with `@print.queue`
73+
74+
Once the `Queues` entity is defined, specify it in the `@print.queue` annotation like so:
75+
76+
```cds
77+
@print.queue: {
78+
SourceEntity: 'Queues'
79+
}
80+
qName
81+
```
82+
83+
### Parameterizing Print Queue in Actions
84+
85+
Alternatively, if the print queue is passed as a parameter in the action, you can annotate it directly within the action definition. This can be done as follows:
86+
87+
#### In Database Definition:
88+
89+
```cds
90+
entity Product {
91+
qName : Association to one Queues;
92+
}
93+
94+
@cds.skip.persistence
95+
entity Queues {
96+
key ID : String;
97+
description : String;
98+
}
99+
```
8100

9-
## Requirements and Setup
101+
#### In Service Definition:
10102

11-
*Insert a short description what is required to get your project running...*
103+
```cds
104+
service MyService {
105+
@print
106+
action print(
107+
@print.queue: {
108+
SourceEntity: 'Queues'
109+
}
110+
@Common: {
111+
ValueListWithFixedValues,
112+
ValueList: {
113+
$Type: 'Common.ValueListType',
114+
CollectionPath: 'Queues',
115+
Parameters: [{
116+
$Type: 'Common.ValueListParameterInOut',
117+
LocalDataProperty: qnameID,
118+
ValueListProperty: 'ID'
119+
}]
120+
},
121+
Label: 'Print Queues',
122+
}
123+
qnameID: String
124+
);
12125
13-
## Support, Feedback, Contributing
126+
entity Queues as projection on db.Queues;
127+
}
128+
```
14129

15-
This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/cap-js/<your-project>/issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](CONTRIBUTING.md).
130+
In this setup, the `qnameID` parameter will be used to dynamically select the print queue from the `Queues` entity. The `Common.ValueList` provides a drop-down selection for available queues during runtime.
16131

17-
## Security / Disclosure
18-
If you find any bug that may be a security problem, please follow our instructions at [in our security policy](https://github.com/cap-js/<your-project>/security/policy) on how to report it. Please do not create GitHub issues for security-related doubts or problems.
19132

20-
## Code of Conduct
133+
## Note
21134

22-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its [Code of Conduct](https://github.com/cap-js/.github/blob/main/CODE_OF_CONDUCT.md) at all times.
135+
If you are running the application in a production way locally(E.g. adding VCAP_SERVICES in `default-env.json`), add the environmental variable `SUBSCRIBER_SUBDOMAIN_FOR_LOCAL_TESTING=<Your subscriber subdomain name>` in the `package.json` as shown below.
23136

24-
## Licensing
137+
#### Example
25138

26-
Copyright 2025 SAP SE or an SAP affiliate company and print contributors. Please see our [LICENSE](LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/cap-js/<your-project>).
139+
```json
140+
"scripts": {
141+
"start": "SUBSCRIBER_SUBDOMAIN_FOR_LOCAL_TESTING=sub01 cds-serve"
142+
}
143+
```

0 commit comments

Comments
 (0)