pdfdancer-client-typescript 1.0.16 → 1.0.17

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 (60) hide show
  1. package/dist/image-builder.d.ts +1 -0
  2. package/dist/image-builder.d.ts.map +1 -1
  3. package/dist/image-builder.js +4 -0
  4. package/dist/image-builder.js.map +1 -1
  5. package/package.json +18 -2
  6. package/.claude/commands/discuss.md +0 -4
  7. package/.eslintrc.js +0 -27
  8. package/.github/workflows/ci.yml +0 -86
  9. package/.github/workflows/daily-tests.yml +0 -54
  10. package/NOTICE +0 -8
  11. package/docs/openapi.yml +0 -2640
  12. package/fixtures/DancingScript-Regular.ttf +0 -0
  13. package/fixtures/Empty.pdf +0 -0
  14. package/fixtures/JetBrainsMono-Regular.ttf +0 -0
  15. package/fixtures/ObviouslyAwesome.pdf +0 -0
  16. package/fixtures/README.md +0 -23
  17. package/fixtures/Showcase.pdf +0 -0
  18. package/fixtures/basic-paths.pdf +0 -0
  19. package/fixtures/form-xobject-example.pdf +0 -0
  20. package/fixtures/logo-80.png +0 -0
  21. package/fixtures/mixed-form-types.pdf +0 -0
  22. package/jest.config.js +0 -27
  23. package/scripts/release.js +0 -91
  24. package/scripts/test-release.js +0 -59
  25. package/src/__tests__/assertions.ts +0 -12
  26. package/src/__tests__/client-v1.test.ts +0 -70
  27. package/src/__tests__/e2e/acroform.test.ts +0 -166
  28. package/src/__tests__/e2e/context-manager-showcase.test.ts +0 -267
  29. package/src/__tests__/e2e/create-new.test.ts +0 -133
  30. package/src/__tests__/e2e/form_x_object.test.ts +0 -87
  31. package/src/__tests__/e2e/image-showcase.test.ts +0 -133
  32. package/src/__tests__/e2e/image.test.ts +0 -147
  33. package/src/__tests__/e2e/line-showcase.test.ts +0 -113
  34. package/src/__tests__/e2e/line.test.ts +0 -187
  35. package/src/__tests__/e2e/page-showcase.test.ts +0 -154
  36. package/src/__tests__/e2e/page.test.ts +0 -47
  37. package/src/__tests__/e2e/paragraph-showcase.test.ts +0 -515
  38. package/src/__tests__/e2e/paragraph.test.ts +0 -681
  39. package/src/__tests__/e2e/path.test.ts +0 -108
  40. package/src/__tests__/e2e/pdf-assertions.ts +0 -248
  41. package/src/__tests__/e2e/pdfdancer-showcase.test.ts +0 -40
  42. package/src/__tests__/e2e/snapshot-showcase.test.ts +0 -158
  43. package/src/__tests__/e2e/snapshot.test.ts +0 -296
  44. package/src/__tests__/e2e/test-helpers.ts +0 -152
  45. package/src/__tests__/e2e/token_from_env.test.ts +0 -80
  46. package/src/__tests__/fingerprint.test.ts +0 -36
  47. package/src/__tests__/retry-mechanism.test.ts +0 -642
  48. package/src/__tests__/standard-fonts.test.ts +0 -87
  49. package/src/__tests__/url-builder.test.ts +0 -44
  50. package/src/exceptions.ts +0 -63
  51. package/src/fingerprint.ts +0 -182
  52. package/src/image-builder.ts +0 -59
  53. package/src/index.ts +0 -49
  54. package/src/models.ts +0 -1051
  55. package/src/page-builder.ts +0 -130
  56. package/src/paragraph-builder.ts +0 -644
  57. package/src/pdfdancer_v1.ts +0 -2283
  58. package/src/types.ts +0 -407
  59. package/tsconfig.json +0 -20
  60. package/update-api-spec.sh +0 -3
@@ -1,130 +0,0 @@
1
- import {PDFDancer} from './pdfdancer_v1';
2
- import {AddPageRequest, Orientation, PageRef, PageSize, STANDARD_PAGE_SIZES} from './models';
3
- import {ValidationException} from './exceptions';
4
-
5
- interface PDFDancerInternals {
6
- addPage(request?: AddPageRequest | null): Promise<PageRef>;
7
- }
8
-
9
- const normalizeOrientation = (value: Orientation | string): Orientation => {
10
- if (typeof value === 'string') {
11
- const normalized = value.trim().toUpperCase();
12
- if (!(normalized in Orientation)) {
13
- throw new ValidationException(`Invalid orientation: ${value}`);
14
- }
15
- return Orientation[normalized as keyof typeof Orientation];
16
- }
17
- return value;
18
- };
19
-
20
- const normalizePageSize = (value: PageSize | string): PageSize => {
21
- if (typeof value === 'string') {
22
- const normalized = value.trim().toUpperCase();
23
- const standard = STANDARD_PAGE_SIZES[normalized];
24
- if (!standard) {
25
- throw new ValidationException(`Unknown page size: ${value}`);
26
- }
27
- return {name: normalized, width: standard.width, height: standard.height};
28
- }
29
-
30
- const width = value.width;
31
- const height = value.height;
32
- if (width === undefined || height === undefined) {
33
- throw new ValidationException('Custom page size must include width and height');
34
- }
35
- if (width <= 0 || height <= 0) {
36
- throw new ValidationException('Page size width and height must be positive numbers');
37
- }
38
- return {
39
- name: value.name?.toUpperCase(),
40
- width,
41
- height
42
- };
43
- };
44
-
45
- export class PageBuilder {
46
- private readonly _client: PDFDancer;
47
- private readonly _internals: PDFDancerInternals;
48
- private _pageIndex?: number;
49
- private _orientation?: Orientation;
50
- private _pageSize?: PageSize;
51
-
52
- constructor(client: PDFDancer) {
53
- if (!client) {
54
- throw new ValidationException('Client cannot be null');
55
- }
56
- this._client = client;
57
- this._internals = this._client as unknown as PDFDancerInternals;
58
- }
59
-
60
- atIndex(pageIndex: number): this {
61
- if (pageIndex === null || pageIndex === undefined) {
62
- throw new ValidationException('Page index cannot be null');
63
- }
64
- if (!Number.isInteger(pageIndex) || pageIndex < 0) {
65
- throw new ValidationException('Page index must be a non-negative integer');
66
- }
67
- this._pageIndex = pageIndex;
68
- return this;
69
- }
70
-
71
- orientation(orientation: Orientation | string): this {
72
- this._orientation = normalizeOrientation(orientation);
73
- return this;
74
- }
75
-
76
- portrait(): this {
77
- this._orientation = Orientation.PORTRAIT;
78
- return this;
79
- }
80
-
81
- landscape(): this {
82
- this._orientation = Orientation.LANDSCAPE;
83
- return this;
84
- }
85
-
86
- pageSize(pageSize: PageSize | string): this {
87
- this._pageSize = normalizePageSize(pageSize);
88
- return this;
89
- }
90
-
91
- a4(): this {
92
- return this.pageSize('A4');
93
- }
94
-
95
- letter(): this {
96
- return this.pageSize('LETTER');
97
- }
98
-
99
- a3(): this {
100
- return this.pageSize('A3');
101
- }
102
-
103
- a5(): this {
104
- return this.pageSize('A5');
105
- }
106
-
107
- legal(): this {
108
- return this.pageSize('LEGAL');
109
- }
110
-
111
- customSize(width: number, height: number): this {
112
- if (width <= 0 || height <= 0) {
113
- throw new ValidationException('Custom page size dimensions must be positive');
114
- }
115
- this._pageSize = {width, height};
116
- return this;
117
- }
118
-
119
- async add(): Promise<PageRef> {
120
- const request = this._buildRequest();
121
- return this._internals.addPage(request);
122
- }
123
-
124
- private _buildRequest(): AddPageRequest | null {
125
- if (this._pageIndex === undefined && this._orientation === undefined && this._pageSize === undefined) {
126
- return null;
127
- }
128
- return new AddPageRequest(this._pageIndex, this._pageSize, this._orientation);
129
- }
130
- }