@aidc-toolkit/app-extension 0.9.19-beta

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 (112) hide show
  1. package/LICENSE +174 -0
  2. package/README.md +17 -0
  3. package/app-extension.iml +9 -0
  4. package/dist/app-extension.d.ts +169 -0
  5. package/dist/app-extension.d.ts.map +1 -0
  6. package/dist/app-extension.js +148 -0
  7. package/dist/app-extension.js.map +1 -0
  8. package/dist/app-utility-proxy.d.ts +66 -0
  9. package/dist/app-utility-proxy.d.ts.map +1 -0
  10. package/dist/app-utility-proxy.js +233 -0
  11. package/dist/app-utility-proxy.js.map +1 -0
  12. package/dist/descriptor.d.ts +168 -0
  13. package/dist/descriptor.d.ts.map +1 -0
  14. package/dist/descriptor.js +175 -0
  15. package/dist/descriptor.js.map +1 -0
  16. package/dist/gs1/character-set-proxy.d.ts +10 -0
  17. package/dist/gs1/character-set-proxy.d.ts.map +1 -0
  18. package/dist/gs1/character-set-proxy.js +47 -0
  19. package/dist/gs1/character-set-proxy.js.map +1 -0
  20. package/dist/gs1/check-proxy.d.ts +11 -0
  21. package/dist/gs1/check-proxy.d.ts.map +1 -0
  22. package/dist/gs1/check-proxy.js +120 -0
  23. package/dist/gs1/check-proxy.js.map +1 -0
  24. package/dist/gs1/idkey-proxy.d.ts +135 -0
  25. package/dist/gs1/idkey-proxy.d.ts.map +1 -0
  26. package/dist/gs1/idkey-proxy.js +779 -0
  27. package/dist/gs1/idkey-proxy.js.map +1 -0
  28. package/dist/gs1/index.d.ts +4 -0
  29. package/dist/gs1/index.d.ts.map +1 -0
  30. package/dist/gs1/index.js +4 -0
  31. package/dist/gs1/index.js.map +1 -0
  32. package/dist/index.d.ts +25 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +25 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/lib-proxy.d.ts +135 -0
  37. package/dist/lib-proxy.d.ts.map +1 -0
  38. package/dist/lib-proxy.js +235 -0
  39. package/dist/lib-proxy.js.map +1 -0
  40. package/dist/locale/en/locale-strings.d.ts +616 -0
  41. package/dist/locale/en/locale-strings.d.ts.map +1 -0
  42. package/dist/locale/en/locale-strings.js +616 -0
  43. package/dist/locale/en/locale-strings.js.map +1 -0
  44. package/dist/locale/fr/locale-strings.d.ts +616 -0
  45. package/dist/locale/fr/locale-strings.d.ts.map +1 -0
  46. package/dist/locale/fr/locale-strings.js +616 -0
  47. package/dist/locale/fr/locale-strings.js.map +1 -0
  48. package/dist/locale/i18n.d.ts +27 -0
  49. package/dist/locale/i18n.d.ts.map +1 -0
  50. package/dist/locale/i18n.js +39 -0
  51. package/dist/locale/i18n.js.map +1 -0
  52. package/dist/types.d.ts +127 -0
  53. package/dist/types.d.ts.map +1 -0
  54. package/dist/types.js +13 -0
  55. package/dist/types.js.map +1 -0
  56. package/dist/utility/character-set-descriptor.d.ts +6 -0
  57. package/dist/utility/character-set-descriptor.d.ts.map +1 -0
  58. package/dist/utility/character-set-descriptor.js +28 -0
  59. package/dist/utility/character-set-descriptor.js.map +1 -0
  60. package/dist/utility/character-set-proxy.d.ts +26 -0
  61. package/dist/utility/character-set-proxy.d.ts.map +1 -0
  62. package/dist/utility/character-set-proxy.js +167 -0
  63. package/dist/utility/character-set-proxy.js.map +1 -0
  64. package/dist/utility/index.d.ts +4 -0
  65. package/dist/utility/index.d.ts.map +1 -0
  66. package/dist/utility/index.js +4 -0
  67. package/dist/utility/index.js.map +1 -0
  68. package/dist/utility/reg-exp-proxy.d.ts +7 -0
  69. package/dist/utility/reg-exp-proxy.d.ts.map +1 -0
  70. package/dist/utility/reg-exp-proxy.js +61 -0
  71. package/dist/utility/reg-exp-proxy.js.map +1 -0
  72. package/dist/utility/string-descriptor.d.ts +4 -0
  73. package/dist/utility/string-descriptor.d.ts.map +1 -0
  74. package/dist/utility/string-descriptor.js +12 -0
  75. package/dist/utility/string-descriptor.js.map +1 -0
  76. package/dist/utility/string-proxy.d.ts +8 -0
  77. package/dist/utility/string-proxy.d.ts.map +1 -0
  78. package/dist/utility/string-proxy.js +12 -0
  79. package/dist/utility/string-proxy.js.map +1 -0
  80. package/dist/utility/transformer-descriptor.d.ts +6 -0
  81. package/dist/utility/transformer-descriptor.d.ts.map +1 -0
  82. package/dist/utility/transformer-descriptor.js +24 -0
  83. package/dist/utility/transformer-descriptor.js.map +1 -0
  84. package/dist/utility/transformer-proxy.d.ts +8 -0
  85. package/dist/utility/transformer-proxy.d.ts.map +1 -0
  86. package/dist/utility/transformer-proxy.js +74 -0
  87. package/dist/utility/transformer-proxy.js.map +1 -0
  88. package/eslint.config.ts +21 -0
  89. package/package.json +37 -0
  90. package/src/app-extension.ts +244 -0
  91. package/src/app-utility-proxy.ts +266 -0
  92. package/src/descriptor.ts +314 -0
  93. package/src/gs1/character-set-proxy.ts +41 -0
  94. package/src/gs1/check-proxy.ts +122 -0
  95. package/src/gs1/idkey-proxy.ts +815 -0
  96. package/src/gs1/index.ts +3 -0
  97. package/src/index.ts +24 -0
  98. package/src/lib-proxy.ts +256 -0
  99. package/src/locale/en/locale-strings.ts +615 -0
  100. package/src/locale/fr/locale-strings.ts +615 -0
  101. package/src/locale/i18n.ts +48 -0
  102. package/src/locale/i18next.d.ts +20 -0
  103. package/src/types.ts +144 -0
  104. package/src/utility/character-set-descriptor.ts +32 -0
  105. package/src/utility/character-set-proxy.ts +185 -0
  106. package/src/utility/index.ts +3 -0
  107. package/src/utility/reg-exp-proxy.ts +51 -0
  108. package/src/utility/string-descriptor.ts +13 -0
  109. package/src/utility/string-proxy.ts +15 -0
  110. package/src/utility/transformer-descriptor.ts +27 -0
  111. package/src/utility/transformer-proxy.ts +72 -0
  112. package/tsconfig.json +6 -0
package/LICENSE ADDED
@@ -0,0 +1,174 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # App Extension Package
2
+
3
+ **Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit contributors**
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
6
+
7
+ https://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
10
+
11
+ ## Overview
12
+
13
+ > [!WARNING]
14
+ >
15
+ > **This software is in beta**, with production release is scheduled for 2025Q4. To follow the status of this and other projects, go to the AIDC Toolkit [projects](https://github.com/orgs/aidc-toolkit/projects) page.
16
+
17
+ The AIDC Toolkit `app-extension` package is the bridge between the AIDC Toolkit and applications such s Microsoft Excel and Google Sheets. It provides little functionality of its own.
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+ <exclude-output />
5
+ <content url="file://$MODULE_DIR$" />
6
+ <orderEntry type="inheritedJdk" />
7
+ <orderEntry type="sourceFolder" forTests="false" />
8
+ </component>
9
+ </module>
@@ -0,0 +1,169 @@
1
+ import type { ErrorExtends, ResultError, SheetAddress, SheetRange, TypedAsyncFunction, TypedFunction, TypedSyncFunction } from "./types.js";
2
+ /**
3
+ * Application extension.
4
+ *
5
+ * @template TBigInt
6
+ * Type to which big integer is mapped.
7
+ *
8
+ * @template ThrowError
9
+ * If true, errors are reported through the throw/catch mechanism.
10
+ *
11
+ * @template TError
12
+ * Error type.
13
+ */
14
+ export declare abstract class AppExtension<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> {
15
+ /**
16
+ * Application version.
17
+ */
18
+ private readonly _version;
19
+ /**
20
+ * Maximum sequence count supported by application.
21
+ */
22
+ private readonly _maximumSequenceCount;
23
+ /**
24
+ * If true, errors are reported through the throw/catch mechanism.
25
+ */
26
+ private readonly _throwError;
27
+ /**
28
+ * Maximum width supported by application.
29
+ */
30
+ private _maximumWidth?;
31
+ /**
32
+ * Maximum height supported by application.
33
+ */
34
+ private _maximumHeight?;
35
+ /**
36
+ * Constructor.
37
+ *
38
+ * @param version
39
+ * Application version.
40
+ *
41
+ * @param maximumSequenceCount
42
+ * Maximum sequence count supported by application.
43
+ *
44
+ * @param throwError
45
+ * If true, errors are reported through the throw/catch mechanism.
46
+ */
47
+ protected constructor(version: string, maximumSequenceCount: number, throwError: ThrowError);
48
+ /**
49
+ * Get the version.
50
+ *
51
+ * @returns
52
+ * Version.
53
+ */
54
+ get version(): string;
55
+ /**
56
+ * Determine if errors are reported through the throw/catch mechanism.
57
+ */
58
+ get throwError(): ThrowError;
59
+ /**
60
+ * Get the maximum width supported by the application.
61
+ *
62
+ * @returns
63
+ * Maximum width supported by the application.
64
+ */
65
+ maximumWidth(): Promise<number>;
66
+ /**
67
+ * Get the maximum width supported by the application.
68
+ *
69
+ * @returns
70
+ * Maximum width supported by the application.
71
+ */
72
+ protected abstract getMaximumWidth(): Promise<number>;
73
+ /**
74
+ * Get the maximum height supported by the application.
75
+ *
76
+ * @returns
77
+ * Maximum height supported by the application.
78
+ */
79
+ maximumHeight(): Promise<number>;
80
+ /**
81
+ * Get the maximum height supported by the application.
82
+ *
83
+ * @returns
84
+ * Maximum height supported by the application.
85
+ */
86
+ protected abstract getMaximumHeight(): Promise<number>;
87
+ /**
88
+ * Get the sheet address from an invocation context.
89
+ *
90
+ * @param invocationContext
91
+ * Invocation context.
92
+ *
93
+ * @returns
94
+ * Sheet address.
95
+ */
96
+ abstract getSheetAddress(invocationContext: TInvocationContext): Promise<SheetAddress>;
97
+ /**
98
+ * Get a parameter range from an invocation context.
99
+ *
100
+ * @param invocationContext
101
+ * Invocation context.
102
+ *
103
+ * @param parameterNumber
104
+ * Parameter number.
105
+ *
106
+ * @returns
107
+ * Sheet range or null if parameter is not a range.
108
+ */
109
+ abstract getParameterSheetRange(invocationContext: TInvocationContext, parameterNumber: number): Promise<SheetRange | null>;
110
+ /**
111
+ * Validate a sequence count against the maximum supported by application.
112
+ *
113
+ * @param sequenceCount
114
+ * Sequence count.
115
+ */
116
+ validateSequenceCount(sequenceCount: number): void;
117
+ /**
118
+ * Map big integer to another type if necessary.
119
+ *
120
+ * @param value
121
+ * Big integer value to map.
122
+ *
123
+ * @returns
124
+ * Mapped big integer value.
125
+ */
126
+ abstract mapBigInt(value: bigint): ResultError<TBigInt, ThrowError, TError>;
127
+ /**
128
+ * Map a range error (thrown by the library) to an application-specific error. If errors are reported through the
129
+ * throw/catch mechanism, the implementation may return the range error unmodified if that is supported.
130
+ *
131
+ * @param rangeError
132
+ */
133
+ abstract mapRangeError(rangeError: RangeError): TError;
134
+ /**
135
+ * Handle an error with a message; called when an exception occurs outside the control of the AIDC Toolkit library.
136
+ * Implementation must not return, most likely by throwing the message wrapped in an error type.
137
+ *
138
+ * @param message
139
+ * Message to include in the error.
140
+ */
141
+ abstract handleError(message: string): never;
142
+ /**
143
+ * Bind a synchronous method and wrap it in a try/catch for comprehensive error handling.
144
+ *
145
+ * @param thisArg
146
+ * The value to be passed as the `this` parameter to the method.
147
+ *
148
+ * @param method
149
+ * Method to call.
150
+ *
151
+ * @returns
152
+ * Function wrapped around the method.
153
+ */
154
+ bindSync<TMethod extends TypedSyncFunction<TMethod>>(thisArg: ThisParameterType<TMethod>, method: TMethod): TypedFunction<TMethod>;
155
+ /**
156
+ * Bind an asynchronous method and wrap it in a try/catch for comprehensive error handling.
157
+ *
158
+ * @param thisArg
159
+ * The value to be passed as the `this` parameter to the method.
160
+ *
161
+ * @param method
162
+ * Method to call.
163
+ *
164
+ * @returns
165
+ * Function wrapped around the method.
166
+ */
167
+ bindAsync<TMethod extends TypedAsyncFunction<TMethod>>(thisArg: ThisParameterType<TMethod>, method: TMethod): TypedAsyncFunction<TMethod>;
168
+ }
169
+ //# sourceMappingURL=app-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-extension.d.ts","sourceRoot":"","sources":["../src/app-extension.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACpB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;GAWG;AACH,8BAAsB,YAAY,CAAC,UAAU,SAAS,OAAO,EAAE,MAAM,SAAS,YAAY,CAAC,UAAU,CAAC,EAAE,kBAAkB,EAAE,OAAO;IAC/H;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAElC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAS;IAE/C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IAEzC;;OAEG;IACH,OAAO,CAAC,aAAa,CAAC,CAAS;IAE/B;;OAEG;IACH,OAAO,CAAC,cAAc,CAAC,CA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E,MAAM,EAAE,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;IAelI;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,OAAO,SAAS,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC;CAU5I"}
@@ -0,0 +1,148 @@
1
+ import { i18nextAppExtension } from "./locale/i18n.js";
2
+ /**
3
+ * Application extension.
4
+ *
5
+ * @template TBigInt
6
+ * Type to which big integer is mapped.
7
+ *
8
+ * @template ThrowError
9
+ * If true, errors are reported through the throw/catch mechanism.
10
+ *
11
+ * @template TError
12
+ * Error type.
13
+ */
14
+ export class AppExtension {
15
+ /**
16
+ * Application version.
17
+ */
18
+ _version;
19
+ /**
20
+ * Maximum sequence count supported by application.
21
+ */
22
+ _maximumSequenceCount;
23
+ /**
24
+ * If true, errors are reported through the throw/catch mechanism.
25
+ */
26
+ _throwError;
27
+ /**
28
+ * Maximum width supported by application.
29
+ */
30
+ _maximumWidth;
31
+ /**
32
+ * Maximum height supported by application.
33
+ */
34
+ _maximumHeight;
35
+ /**
36
+ * Constructor.
37
+ *
38
+ * @param version
39
+ * Application version.
40
+ *
41
+ * @param maximumSequenceCount
42
+ * Maximum sequence count supported by application.
43
+ *
44
+ * @param throwError
45
+ * If true, errors are reported through the throw/catch mechanism.
46
+ */
47
+ constructor(version, maximumSequenceCount, throwError) {
48
+ this._version = version;
49
+ this._maximumSequenceCount = maximumSequenceCount;
50
+ this._throwError = throwError;
51
+ }
52
+ /**
53
+ * Get the version.
54
+ *
55
+ * @returns
56
+ * Version.
57
+ */
58
+ get version() {
59
+ return this._version;
60
+ }
61
+ /**
62
+ * Determine if errors are reported through the throw/catch mechanism.
63
+ */
64
+ get throwError() {
65
+ return this._throwError;
66
+ }
67
+ /**
68
+ * Get the maximum width supported by the application.
69
+ *
70
+ * @returns
71
+ * Maximum width supported by the application.
72
+ */
73
+ async maximumWidth() {
74
+ this._maximumWidth ??= await this.getMaximumWidth();
75
+ return this._maximumWidth;
76
+ }
77
+ /**
78
+ * Get the maximum height supported by the application.
79
+ *
80
+ * @returns
81
+ * Maximum height supported by the application.
82
+ */
83
+ async maximumHeight() {
84
+ this._maximumHeight ??= await this.getMaximumHeight();
85
+ return this._maximumHeight;
86
+ }
87
+ /**
88
+ * Validate a sequence count against the maximum supported by application.
89
+ *
90
+ * @param sequenceCount
91
+ * Sequence count.
92
+ */
93
+ validateSequenceCount(sequenceCount) {
94
+ const absoluteSequenceCount = Math.abs(sequenceCount);
95
+ if (absoluteSequenceCount > this._maximumSequenceCount) {
96
+ throw new RangeError(i18nextAppExtension.t("AppExtension.sequenceCountMustBeLessThanOrEqualTo", {
97
+ sequenceCount: absoluteSequenceCount,
98
+ maximumSequenceCount: this._maximumSequenceCount
99
+ }));
100
+ }
101
+ }
102
+ /**
103
+ * Bind a synchronous method and wrap it in a try/catch for comprehensive error handling.
104
+ *
105
+ * @param thisArg
106
+ * The value to be passed as the `this` parameter to the method.
107
+ *
108
+ * @param method
109
+ * Method to call.
110
+ *
111
+ * @returns
112
+ * Function wrapped around the method.
113
+ */
114
+ bindSync(thisArg, method) {
115
+ const boundMethod = method.bind(thisArg);
116
+ return (...args) => {
117
+ try {
118
+ return boundMethod(...args);
119
+ }
120
+ catch (e) {
121
+ // eslint-disable-next-line no-console -- Necessary for diagnostics.
122
+ console.error(e);
123
+ this.handleError(e instanceof Error ? e.message : String(e));
124
+ }
125
+ };
126
+ }
127
+ /**
128
+ * Bind an asynchronous method and wrap it in a try/catch for comprehensive error handling.
129
+ *
130
+ * @param thisArg
131
+ * The value to be passed as the `this` parameter to the method.
132
+ *
133
+ * @param method
134
+ * Method to call.
135
+ *
136
+ * @returns
137
+ * Function wrapped around the method.
138
+ */
139
+ bindAsync(thisArg, method) {
140
+ const boundMethod = method.bind(thisArg);
141
+ return async (...args) => await boundMethod(...args).catch((e) => {
142
+ // eslint-disable-next-line no-console -- Necessary for diagnostics.
143
+ console.error(e);
144
+ this.handleError(e instanceof Error ? e.message : String(e));
145
+ });
146
+ }
147
+ }
148
+ //# sourceMappingURL=app-extension.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-extension.js","sourceRoot":"","sources":["../src/app-extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAWvD;;;;;;;;;;;GAWG;AACH,MAAM,OAAgB,YAAY;IAC9B;;OAEG;IACc,QAAQ,CAAS;IAElC;;OAEG;IACc,qBAAqB,CAAS;IAE/C;;OAEG;IACc,WAAW,CAAa;IAEzC;;OAEG;IACK,aAAa,CAAU;IAE/B;;OAEG;IACK,cAAc,CAAU;IAEhC;;;;;;;;;;;OAWG;IACH,YAAsB,OAAe,EAAE,oBAA4B,EAAE,UAAsB;QACvF,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,qBAAqB,GAAG,oBAAoB,CAAC;QAClD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IAED;;;;;OAKG;IACH,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY;QACd,IAAI,CAAC,aAAa,KAAK,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAEpD,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAUD;;;;;OAKG;IACH,KAAK,CAAC,aAAa;QACf,IAAI,CAAC,cAAc,KAAK,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAEtD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAmCD;;;;;OAKG;IACH,qBAAqB,CAAC,aAAqB;QACvC,MAAM,qBAAqB,GAAG,IAAI,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AC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -0,0 +1,66 @@
1
+ import { LibProxy } from "./lib-proxy.js";
2
+ import { type ErrorExtends, type Matrix, type Nullishable } from "./types.js";
3
+ /**
4
+ * Application utilities.
5
+ */
6
+ export declare class AppUtilityProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends LibProxy<ThrowError, TError, TInvocationContext, TBigInt> {
7
+ /**
8
+ * Get the version.
9
+ *
10
+ * @returns
11
+ * Version.
12
+ */
13
+ version(): string;
14
+ /**
15
+ * Provide default values for maximum width and height if required.
16
+ *
17
+ * @param maximumDimensions
18
+ * Maximum dimensions provided to function.
19
+ *
20
+ * @param invocationContext
21
+ * Invocation context.
22
+ *
23
+ * @returns
24
+ * Array of maximum width and maximum height.
25
+ */
26
+ private defaultMaximums;
27
+ /**
28
+ * Spill a horizontal matrix vertically to fit within a maximum width and height.
29
+ *
30
+ * @param hMatrixValues
31
+ * Horizontal matrix values. Matrix has length 1 and contains a single array with the values.
32
+ *
33
+ * @param maximumWidth
34
+ * Maximum width.
35
+ *
36
+ * @param maximumHeight
37
+ * Maximum height.
38
+ *
39
+ * @param invocationContext
40
+ * Invocation context.
41
+ *
42
+ * @returns
43
+ * Matrix spilled within maximum width and maximum height.
44
+ */
45
+ vSpill(hMatrixValues: Matrix<unknown>, maximumWidth: Nullishable<number>, maximumHeight: Nullishable<number>, invocationContext: Nullishable<TInvocationContext>): Promise<Matrix<unknown>>;
46
+ /**
47
+ * Spill a vertical matrix horizontally to fit within a maximum width and height.
48
+ *
49
+ * @param vMatrixValues
50
+ * Vertical matrix values. Matrix contains arrays of length 1 with the values.
51
+ *
52
+ * @param maximumHeight
53
+ * Maximum height.
54
+ *
55
+ * @param maximumWidth
56
+ * Maximum width.
57
+ *
58
+ * @param invocationContext
59
+ * Invocation context.
60
+ *
61
+ * @returns
62
+ * Matrix spilled within maximum height and maximum width.
63
+ */
64
+ hSpill(vMatrixValues: Matrix<unknown>, maximumHeight: Nullishable<number>, maximumWidth: Nullishable<number>, invocationContext: Nullishable<TInvocationContext>): Promise<Matrix<unknown>>;
65
+ }
66
+ //# sourceMappingURL=app-utility-proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-utility-proxy.d.ts","sourceRoot":"","sources":["../src/app-utility-proxy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,KAAK,YAAY,EAAa,KAAK,MAAM,EAAuB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AA2C9G;;GAEG;AACH,qBACa,eAAe,CAAC,UAAU,SAAS,OAAO,EAAE,MAAM,SAAS,YAAY,CAAC,UAAU,CAAC,EAAE,kBAAkB,EAAE,OAAO,CAAE,SAAQ,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC;IAC5L;;;;;OAKG;IAKH,OAAO,IAAI,MAAM;IAIjB;;;;;;;;;;;OAWG;YACW,eAAe;IA6B7B;;;;;;;;;;;;;;;;;OAiBG;IAMG,MAAM,CACqB,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,EACL,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,EACzF,iBAAiB,EAAE,WAAW,CAAC,kBAAkB,CAAC,GACnD,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAmD3B;;;;;;;;;;;;;;;;;OAiBG;IAMG,MAAM,CACqB,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,EACJ,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,EACnC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,EACvF,iBAAiB,EAAE,WAAW,CAAC,kBAAkB,CAAC,GACnD,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CAoD9B"}