@jini-ai/cms 0.3.1 → 0.3.3
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.
- package/LICENSE +201 -0
- package/dist/core/tools/registration-kit.d.ts.map +1 -1
- package/dist/core/tools/registration-kit.js +17 -1
- package/dist/core/tools/registration-kit.js.map +1 -1
- package/dist/media/image-transformer.sharp.d.ts +16 -0
- package/dist/media/image-transformer.sharp.d.ts.map +1 -1
- package/dist/media/image-transformer.sharp.js +39 -11
- package/dist/media/image-transformer.sharp.js.map +1 -1
- package/dist/media/index.d.ts +1 -1
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +1 -1
- package/dist/media/index.js.map +1 -1
- package/dist/media/tool-registrations.d.ts +57 -0
- package/dist/media/tool-registrations.d.ts.map +1 -1
- package/dist/media/tool-registrations.js +20 -2
- package/dist/media/tool-registrations.js.map +1 -1
- package/package.json +10 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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 describing the origin of the Work and
|
|
141
|
+
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 Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend,
|
|
172
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
173
|
+
or claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Open Design contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registration-kit.d.ts","sourceRoot":"","sources":["../../../src/core/tools/registration-kit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAkB,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAQxF,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK1E,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;AAE9C;;;;;;;;;;;;;;GA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AY,EAAE,qBAAqB,CAAC;IACpC,WAAW,EAAE,mBAAmB,CAAC;CAClC,GAAG,IAAI,CAkBP;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IACpD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACtC,WAAW,EAAE,mBAAmB,CAAC;IACjC,cAAc,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACtC,GAAG,gBAAgB,EAAE,CA8CrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,mBAAmB,CAAA;CAAE,EAAE,GAAG,mBAAmB,CAkB1H"}
|
|
@@ -331,7 +331,23 @@ export function buildDomainRegistrations(spec) {
|
|
|
331
331
|
throw new Error(`tool-registrations: wired tool '${id}' publishes no inputSchema — add one to its entry in ${spec.catalogModule} so the model gets a contract, or leave the tool unwired`);
|
|
332
332
|
}
|
|
333
333
|
registrations.push({
|
|
334
|
-
descriptor: {
|
|
334
|
+
descriptor: {
|
|
335
|
+
id,
|
|
336
|
+
description: catalogEntry.description,
|
|
337
|
+
inputSchema: catalogEntry.inputSchema,
|
|
338
|
+
// The ONE place a domain's declared risk becomes the descriptor flag every read-only gate
|
|
339
|
+
// reads (`@jini-ai/core`'s `isReadOnlyTool`). Placed here rather than in each domain's
|
|
340
|
+
// `tool-registrations.ts` for the same reason the drift tripwire is: twelve copies of this
|
|
341
|
+
// line is twelve chances for one to say something different. Change what counts as
|
|
342
|
+
// read-only and every domain follows.
|
|
343
|
+
//
|
|
344
|
+
// Safe to derive from the declaration only because `assertToolIsWirable` has ALREADY run
|
|
345
|
+
// two lines above and refused any tool whose declared `sideEffects` disagrees with the
|
|
346
|
+
// wiring layer's own `DERIVED_RISK_BY_TOOL_ID` classification — so by this point the
|
|
347
|
+
// declaration has been independently corroborated, and a catalog entry cannot make itself
|
|
348
|
+
// read-only by editing one word.
|
|
349
|
+
readOnly: catalogEntry.sideEffects === "none",
|
|
350
|
+
},
|
|
335
351
|
handler,
|
|
336
352
|
policy: { authorize: () => "allow" },
|
|
337
353
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registration-kit.js","sourceRoot":"","sources":["../../../src/core/tools/registration-kit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,cAAc,EAA2C,MAAM,eAAe,CAAC;AAExF,oGAAoG;AACpG,sGAAsG;AACtG,sGAAsG;AACtG,uGAAuG;AACvG,qGAAqG;AACrG,+FAA+F;AAC/F,OAAO,EAAE,cAAc,EAAoB,MAAM,wBAAwB,CAAC;AA+D1E;;;;;;;;;;GAUG;AACH,iGAAiG;AACjG,iGAAiG;AACjG,2EAA2E;AAC3E,MAAM,CAAC,MAAM,yBAAyB,GAAY,OAAO,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,kDAAkD,GAAG,IAAI,GAAG,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC;AAEpH;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAA6B,OAAqB;IAChF,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,8EAA8E;AAC9E,yEAAyE;AACzE,8EAA8E;AAE9E,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,K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AC;IAEhD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YAC9C,MAAM,KAAK,GAAG,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACxC,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,IAAI,KAAK,CACb,gCAAgC,MAAM,0BAA0B,KAAK,QAAQ,KAAK,CAAC,MAAM,gJAAgJ,CAC1O,CAAC;YACJ,CAAC;YACD,aAAa,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YACxC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -2,6 +2,22 @@ import type { ImageTransformerPort, TransformImageInput, TransformImageOutput }
|
|
|
2
2
|
/** Thrown by {@link SharpImageTransformer.transform} when the `sharp` package cannot be loaded. */
|
|
3
3
|
export declare class ImageTransformUnavailableError extends Error {
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* Thrown by {@link SharpImageTransformer.transform} when `sharp` itself rejects the SOURCE bytes —
|
|
7
|
+
* a decode/re-encode failure the codec surfaces (a corrupt file, a format-specific edge case libvips
|
|
8
|
+
* won't process, truncated data, ...), as opposed to {@link ImageTransformUnavailableError}'s
|
|
9
|
+
* "the codec itself couldn't even be loaded".
|
|
10
|
+
*
|
|
11
|
+
* This is a DATA condition on the stored blob, not a server fault: bytes can pass this package's own
|
|
12
|
+
* allowlist upload check and even its magic-byte sniff (`content-type-sniffer.ts`) while still being
|
|
13
|
+
* bytes libvips refuses to decode (an intentionally-crafted upload, a partial/interrupted write, a
|
|
14
|
+
* container variant this codec build doesn't support, ...). A caller (a serving route) is expected to
|
|
15
|
+
* catch this specifically and answer a controlled 4xx, never an opaque 500 — same "named, thrown
|
|
16
|
+
* error, never a silently faked/passed-through image" discipline this file's own header already
|
|
17
|
+
* states for the sibling `ImageTransformUnavailableError` case.
|
|
18
|
+
*/
|
|
19
|
+
export declare class ImageSourceCorruptError extends Error {
|
|
20
|
+
}
|
|
5
21
|
/**
|
|
6
22
|
* Real `ImageTransformerPort` adapter. Applies `params.width`/`height`
|
|
7
23
|
* (via `sharp().resize(...)`, only when at least one is set) then
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-transformer.sharp.d.ts","sourceRoot":"","sources":["../../src/media/image-transformer.sharp.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAK9G,mGAAmG;AACnG,qBAAa,8BAA+B,SAAQ,KAAK;CAAG;
|
|
1
|
+
{"version":3,"file":"image-transformer.sharp.d.ts","sourceRoot":"","sources":["../../src/media/image-transformer.sharp.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAK9G,mGAAmG;AACnG,qBAAa,8BAA+B,SAAQ,KAAK;CAAG;AAE5D;;;;;;;;;;;;;GAaG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;CAAG;AAoCrD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,qBAAsB,YAAW,oBAAoB;IAC1D,SAAS,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAgC3E"}
|
|
@@ -33,6 +33,22 @@ const require = createRequire(import.meta.url);
|
|
|
33
33
|
/** Thrown by {@link SharpImageTransformer.transform} when the `sharp` package cannot be loaded. */
|
|
34
34
|
export class ImageTransformUnavailableError extends Error {
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Thrown by {@link SharpImageTransformer.transform} when `sharp` itself rejects the SOURCE bytes —
|
|
38
|
+
* a decode/re-encode failure the codec surfaces (a corrupt file, a format-specific edge case libvips
|
|
39
|
+
* won't process, truncated data, ...), as opposed to {@link ImageTransformUnavailableError}'s
|
|
40
|
+
* "the codec itself couldn't even be loaded".
|
|
41
|
+
*
|
|
42
|
+
* This is a DATA condition on the stored blob, not a server fault: bytes can pass this package's own
|
|
43
|
+
* allowlist upload check and even its magic-byte sniff (`content-type-sniffer.ts`) while still being
|
|
44
|
+
* bytes libvips refuses to decode (an intentionally-crafted upload, a partial/interrupted write, a
|
|
45
|
+
* container variant this codec build doesn't support, ...). A caller (a serving route) is expected to
|
|
46
|
+
* catch this specifically and answer a controlled 4xx, never an opaque 500 — same "named, thrown
|
|
47
|
+
* error, never a silently faked/passed-through image" discipline this file's own header already
|
|
48
|
+
* states for the sibling `ImageTransformUnavailableError` case.
|
|
49
|
+
*/
|
|
50
|
+
export class ImageSourceCorruptError extends Error {
|
|
51
|
+
}
|
|
36
52
|
/**
|
|
37
53
|
* Lazily resolves the `sharp` module. See file header for why this is a
|
|
38
54
|
* deferred, untyped `require()` (via `createRequire`) rather than a
|
|
@@ -74,18 +90,30 @@ function loadSharpFactory() {
|
|
|
74
90
|
export class SharpImageTransformer {
|
|
75
91
|
async transform(input) {
|
|
76
92
|
const sharpFactory = loadSharpFactory();
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
93
|
+
// Pipeline construction through `toBuffer()` all live in one try/catch: any of these steps can
|
|
94
|
+
// reject on bad SOURCE bytes (`sharp`'s decode is lazy — a malformed file often only surfaces
|
|
95
|
+
// once a downstream operation like `toBuffer()` actually reads it), and every such rejection
|
|
96
|
+
// means the same thing to a caller — "this source could not be processed" — regardless of which
|
|
97
|
+
// call in the chain actually threw. See {@link ImageSourceCorruptError}'s own doc for why this is
|
|
98
|
+
// named/rethrown rather than left as an undifferentiated `sharp` error.
|
|
99
|
+
try {
|
|
100
|
+
let pipeline = sharpFactory(Buffer.from(input.bytes));
|
|
101
|
+
if (input.params.width !== undefined || input.params.height !== undefined) {
|
|
102
|
+
pipeline = pipeline.resize(input.params.width, input.params.height, {
|
|
103
|
+
fit: input.params.fit ?? "cover",
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
pipeline = pipeline.toFormat(input.params.format);
|
|
107
|
+
const outBuffer = await pipeline.toBuffer();
|
|
108
|
+
return {
|
|
109
|
+
bytes: new Uint8Array(outBuffer),
|
|
110
|
+
contentType: mimeForTransformFormat(input.params.format),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
115
|
+
throw new ImageSourceCorruptError(`the source image could not be decoded/re-encoded (target format '${input.params.format}'): ${detail}`);
|
|
82
116
|
}
|
|
83
|
-
pipeline = pipeline.toFormat(input.params.format);
|
|
84
|
-
const outBuffer = await pipeline.toBuffer();
|
|
85
|
-
return {
|
|
86
|
-
bytes: new Uint8Array(outBuffer),
|
|
87
|
-
contentType: mimeForTransformFormat(input.params.format),
|
|
88
|
-
};
|
|
89
117
|
}
|
|
90
118
|
}
|
|
91
119
|
//# sourceMappingURL=image-transformer.sharp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-transformer.sharp.js","sourceRoot":"","sources":["../../src/media/image-transformer.sharp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,mGAAmG;AACnG,MAAM,OAAO,8BAA+B,SAAQ,KAAK;CAAG;
|
|
1
|
+
{"version":3,"file":"image-transformer.sharp.js","sourceRoot":"","sources":["../../src/media/image-transformer.sharp.ts"],"names":[],"mappings":"A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AAM,CAAC,GAAG,IAAI,OAAO;iBACjC,CAAC,CAAC;YACL,CAAC;YAED,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAClD,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAC;YAE5C,OAAO;gBACL,KAAK,EAAE,IAAI,UAAU,CAAC,SAAS,CAAC;gBAChC,WAAW,EAAE,sBAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;aACzD,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAChE,MAAM,IAAI,uBAAuB,CAC/B,oEAAoE,KAAK,CAAC,MAAM,CAAC,MAAM,OAAO,MAAM,EAAE,CACvG,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
package/dist/media/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export { registerTransform, getLatestTransformDefinition, isLatestTransformVersi
|
|
|
28
28
|
export { resolveMediaRendition, type ResolveMediaRenditionDeps, type ResolveMediaRenditionInput, type ResolveMediaRenditionResult, } from "./rendition-service.js";
|
|
29
29
|
export type { ImageTransformerPort, TransformImageInput, TransformImageOutput } from "./image-transformer.js";
|
|
30
30
|
export { InMemoryImageTransformer } from "./image-transformer.js";
|
|
31
|
-
export { SharpImageTransformer, ImageTransformUnavailableError } from "./image-transformer.sharp.js";
|
|
31
|
+
export { SharpImageTransformer, ImageTransformUnavailableError, ImageSourceCorruptError } from "./image-transformer.sharp.js";
|
|
32
32
|
export { sniffContentType, type SniffedContentType } from "./content-type-sniffer.js";
|
|
33
33
|
/** The agent-tool catalog for this domain (see `agent-tools.ts` for what is deliberately omitted). */
|
|
34
34
|
export { mediaAgentToolCatalog, type AgentToolDefinition as MediaAgentToolDefinition, type AgentToolSideEffect as MediaAgentToolSideEffect, type AgentToolActorClassRule as MediaAgentToolActorClassRule, } from "./agent-tools.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/media/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,YAAY,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,2BAA2B,GAC5B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,yBAAyB,EACzB,+BAA+B,GAChC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,sBAAsB,EACtB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,eA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,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9G,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAO9H,OAAO,EAAE,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,sGAAsG;AACtG,OAAO,EACL,qBAAqB,EACrB,KAAK,mBAAmB,IAAI,wBAAwB,EACpD,KAAK,mBAAmB,IAAI,wBAAwB,EACpD,KAAK,uBAAuB,IAAI,4BAA4B,GAC7D,MAAM,kBAAkB,CAAC;AAE1B;;;;;;GAMG;AACH,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,KAAK,aAAa,GACnB,MAAM,yBAAyB,CAAC"}
|
package/dist/media/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export { withRenditionLock, withTransformRegistryLock } from "./transform-lock.j
|
|
|
11
11
|
export { registerTransform, getLatestTransformDefinition, isLatestTransformVersion, isReferencedByPublishedContent, } from "./transform-registry.js";
|
|
12
12
|
export { resolveMediaRendition, } from "./rendition-service.js";
|
|
13
13
|
export { InMemoryImageTransformer } from "./image-transformer.js";
|
|
14
|
-
export { SharpImageTransformer, ImageTransformUnavailableError } from "./image-transformer.sharp.js";
|
|
14
|
+
export { SharpImageTransformer, ImageTransformUnavailableError, ImageSourceCorruptError } from "./image-transformer.sharp.js";
|
|
15
15
|
// -----------------------------------------------------------------------------
|
|
16
16
|
// Original-bytes admin preview route support. See `content-type-sniffer.ts`'s
|
|
17
17
|
// file header for the disclosed scope: an allowlist magic-byte sniffer, not a
|
package/dist/media/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/media/index.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,EACz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,CAAC;AAEtF,sGAAsG;AACtG,OAAO,EACL,qBAAqB,GAItB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;GAMG;AACH,OAAO,EACL,uBAAuB,EACvB,gBAAgB,GAEjB,MAAM,yBAAyB,CAAC"}
|
|
@@ -8,10 +8,29 @@
|
|
|
8
8
|
* internal `authorize()` call of their own — every admin HTTP route a host builds gates inline
|
|
9
9
|
* instead. Every handler here does the same via the kit's `requireToolPermission`, which is the
|
|
10
10
|
* single evaluation for these tools, located where a real route would locate it.
|
|
11
|
+
*
|
|
12
|
+
* `publicUrl` (2026-09-02, closing the same capability gap `features/post/tool-registrations.ts`'s
|
|
13
|
+
* own `publicUrl` addition closed there: an agent could upload/list an asset but had no tool-facing
|
|
14
|
+
* way to learn a URL usable to embed it in a post/page). Unlike `post`, this package has no host to
|
|
15
|
+
* resolve a public URL against — the `/m/{assetId}/{transformName}.v{version}/...` contract
|
|
16
|
+
* (ADR-027 §4) is a HOST decision (which URL prefix, which transform pipeline, whether one even
|
|
17
|
+
* exists), not a `@jini-ai/cms` one; this package deliberately has zero `/m/`-shaped string
|
|
18
|
+
* literals anywhere. So `publicUrl` is resolved through an OPTIONAL, host-injected
|
|
19
|
+
* {@link MediaToolDeps.resolvePublicUrls}, batch-shaped (one call per `media_list_assets`/
|
|
20
|
+
* `media_upload_asset` invocation, not one per asset) so a host backing it with a real lookup
|
|
21
|
+
* (content-type/blob-store reads) never pays N queries for an N-row list. A host that omits it gets
|
|
22
|
+
* today's exact behavior unchanged — `publicUrl` simply never appears on the response, which is why
|
|
23
|
+
* this stays additive rather than a breaking change to every existing consumer of this file.
|
|
24
|
+
*
|
|
25
|
+
* Deliberately NOT added to `media_update_metadata`/`media_trash_asset` — mirrors
|
|
26
|
+
* `features/post/tool-registrations.ts`'s identical reasoning for skipping `content_post_update`/
|
|
27
|
+
* `content_post_delete`: those two return the row incidentally, to confirm what was just
|
|
28
|
+
* edited/trashed, not to answer "where does this live".
|
|
11
29
|
*/
|
|
12
30
|
import type { AuthorizeFn } from "../core/commands/command.js";
|
|
13
31
|
import { type DerivedRiskByToolId, type ToolRegistration } from "../core/tools/registration-kit.js";
|
|
14
32
|
import type { AssetBlobRepoPort, AssetRenditionRepoPort, BlobStorePort, MediaRepoPort } from "./ports.js";
|
|
33
|
+
import type { MediaRecord } from "./types.js";
|
|
15
34
|
/**
|
|
16
35
|
* The exact slice of a host's route-deps bag Media's tool handlers read. Declared structurally
|
|
17
36
|
* (rather than importing any host's own route-deps type) so this module carries no back-edge into
|
|
@@ -31,6 +50,44 @@ export interface MediaToolDeps {
|
|
|
31
50
|
assetBlobRepo: AssetBlobRepoPort;
|
|
32
51
|
assetRenditionRepo: AssetRenditionRepoPort;
|
|
33
52
|
blobStore: BlobStorePort;
|
|
53
|
+
/**
|
|
54
|
+
* Optional, batch-shaped resolver for each listed asset's host-served public URL — see this
|
|
55
|
+
* file's header, "`publicUrl`". Called with every asset `media_list_assets`/`media_upload_asset`
|
|
56
|
+
* is about to return, at most once per tool call; the returned map's key is `MediaRecord.id`, and
|
|
57
|
+
* a missing/`null` entry means "no public URL for this asset" (e.g. trashed, or the host's own
|
|
58
|
+
* resolution failed soft). Omitted entirely: every response's `publicUrl` is `null`, matching this
|
|
59
|
+
* field's own pre-2026-09-02 absence for every host that has not opted in yet.
|
|
60
|
+
*/
|
|
61
|
+
resolvePublicUrls?: (assets: readonly MediaRecord[]) => Promise<ReadonlyMap<string, string | null>>;
|
|
62
|
+
/**
|
|
63
|
+
* Optional hook run once, right after `media_upload_asset`'s own `uploadMedia()` call succeeds —
|
|
64
|
+
* the fix for a defect where a tool-driven upload recorded NO content type anywhere. `uploadMedia`
|
|
65
|
+
* (`media-service.ts`) validates the caller's `contentType` string against an advisory allowlist
|
|
66
|
+
* and then discards it by design (see that file's own header) — neither `AssetBlobRecord` nor
|
|
67
|
+
* `MediaRecord` has a field for it, so this package cannot persist one itself. A host that wants
|
|
68
|
+
* one recorded (e.g. so an admin "Images"/"Videos" filter or a public rendition route can answer
|
|
69
|
+
* "what type is this blob") wires this hook to its own content-type store, exactly the same
|
|
70
|
+
* pattern {@link resolvePublicUrls} already established for `publicUrl`.
|
|
71
|
+
*
|
|
72
|
+
* Deliberately given the RAW UPLOADED BYTES, not the caller's declared `contentType` string: a
|
|
73
|
+
* host is expected to derive the real type from bytes (a magic-byte sniff), never trust the
|
|
74
|
+
* declared string outright — the same "an attacker-controlled `contentType` header is trusted,
|
|
75
|
+
* which the real ingress policy would never do" gap `uploadMedia`'s own header already discloses
|
|
76
|
+
* for the validation step. This hook is this package's only chance to hand a host those bytes
|
|
77
|
+
* before they go out of scope; asking a host to re-read them later would mean either persisting
|
|
78
|
+
* the client-declared string untrusted (the exact gap this hook exists to avoid) or a second blob
|
|
79
|
+
* read the host does not otherwise need.
|
|
80
|
+
*
|
|
81
|
+
* Any rejection from this hook propagates out of the `media_upload_asset` handler uncaught — a
|
|
82
|
+
* failure to record the type is a real failure, not swallowed to report a false success (mirrors
|
|
83
|
+
* `resolveCredentialForProvider`'s "never silently fall through" discipline elsewhere in this
|
|
84
|
+
* package's siblings). Omitted entirely: never called, matching this field's own pre-fix absence
|
|
85
|
+
* for every host that has not opted in yet — the exact `resolvePublicUrls`-precedent contract.
|
|
86
|
+
*/
|
|
87
|
+
recordUploadContentType?: (params: {
|
|
88
|
+
media: MediaRecord;
|
|
89
|
+
bytes: Uint8Array;
|
|
90
|
+
}) => Promise<void>;
|
|
34
91
|
}
|
|
35
92
|
/**
|
|
36
93
|
* This wiring layer's OWN risk classification, authored from what each handler below actually
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-registrations.d.ts","sourceRoot":"","sources":["../../src/media/tool-registrations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool-registrations.d.ts","sourceRoot":"","sources":["../../src/media/tool-registrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,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ch-resolves `publicUrl` for every listed asset via {@link MediaToolDeps.resolvePublicUrls},
|
|
44
|
+
* then projects each into {@link MediaToolViewWithPublicUrl}. A single call regardless of
|
|
45
|
+
* `records.length` — see this file's header for why this is batch-shaped rather than per-asset.
|
|
46
|
+
* When `routeDeps.resolvePublicUrls` is not provided, every row's `publicUrl` is `null` (the field
|
|
47
|
+
* still appears — the caller always gets the same shape back, only the value differs).
|
|
48
|
+
*
|
|
49
|
+
* @complexity O(1) beyond the injected resolver's own cost (documented as its own caller's
|
|
50
|
+
* responsibility — see `MediaToolDeps.resolvePublicUrls`'s own doc).
|
|
51
|
+
*/
|
|
52
|
+
async function toMediaToolViewsWithPublicUrls(routeDeps, records) {
|
|
53
|
+
const urls = routeDeps.resolvePublicUrls ? await routeDeps.resolvePublicUrls(records) : new Map();
|
|
54
|
+
return records.map((record) => ({ ...toMediaToolView(record), publicUrl: urls.get(record.id) ?? null }));
|
|
55
|
+
}
|
|
42
56
|
export function buildMediaRegistrations(routeDeps) {
|
|
43
57
|
const mediaWriteDeps = () => ({
|
|
44
58
|
clock: routeDeps.clock,
|
|
@@ -52,7 +66,7 @@ export function buildMediaRegistrations(routeDeps) {
|
|
|
52
66
|
media_list_assets: async (ctx) => {
|
|
53
67
|
await requireToolPermission(routeDeps, { principalId: ctx.principal.id, permission: "media.read", entityType: "media" });
|
|
54
68
|
const { media } = await listMedia({ deps: { mediaRepo: routeDeps.mediaRepo }, input: { workspaceId: routeDeps.workspaceId } });
|
|
55
|
-
return { media: media
|
|
69
|
+
return { media: await toMediaToolViewsWithPublicUrls(routeDeps, media) };
|
|
56
70
|
},
|
|
57
71
|
media_upload_asset: async (ctx) => {
|
|
58
72
|
const input = requireInputRecord(ctx.input);
|
|
@@ -79,7 +93,11 @@ export function buildMediaRegistrations(routeDeps) {
|
|
|
79
93
|
createdByPrincipal: ctx.principal.id,
|
|
80
94
|
},
|
|
81
95
|
});
|
|
82
|
-
|
|
96
|
+
if (routeDeps.recordUploadContentType) {
|
|
97
|
+
await routeDeps.recordUploadContentType({ media, bytes });
|
|
98
|
+
}
|
|
99
|
+
const [view] = await toMediaToolViewsWithPublicUrls(routeDeps, [media]);
|
|
100
|
+
return { media: view };
|
|
83
101
|
});
|
|
84
102
|
},
|
|
85
103
|
media_update_metadata: async (ctx) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-registrations.js","sourceRoot":"","sources":["../../src/media/tool-registrations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-registrations.js","sourceRoot":"","sources":["../../src/media/tool-registrations.ts"],"names":[],"mappings":"AA8BA,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,qBAAqB,GAKtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,UAAU,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAInH,MAAM,aAAa,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;AAsD9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAA8B;IACxF,kEAAkE;IAClE,CAAC,mBAAmB,EAAE,MAAM,CAAC;IAC7B,kGAAkG;IAClG,CAAC,oBAAoB,EAAE,uBAAuB,CAAC;IAC/C,oFAAoF;IACpF,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;IAClD,8FAA8F;IAC9F,+EAA+E;IAC/E,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;CAC/C,CAAC,CAAC;AAEH,yHAAyH;AACzH,SAAS,qBAAqB,CAAC,KAAc;IAC3C,OAAO,KAAK,YAAY,oBAAoB,CAAC;AAC/C,CAAC;AAcD;;;;GAIG;AACH,SAAS,eAAe,CAAC,MAAmB;IAC1C,OAAO;QACL,EAAE,EAAE,MA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E,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE;gBAChE,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE;aAC3D,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3C,CAAC;KACF,CAAC;IAEF,0FAA0F;IAC1F,OAAO,wBAAwB,CAAC;QAC9B,MAAM,EAAE,OAAO;QACf,aAAa,EAAE,sBAAsB;QACrC,OAAO,EAAE,aAAa;QACtB,QAAQ;QACR,WAAW,EAAE,gBAAgB;KAC9B,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/cms",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Content-model capability for Jini-hosted products: framework-free contracts, ports, and domain services in `/core` and per-domain subpaths; Node-bound persistence adapters in `/server`.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -119,20 +119,13 @@
|
|
|
119
119
|
"access": "public",
|
|
120
120
|
"registry": "https://registry.npmjs.org"
|
|
121
121
|
},
|
|
122
|
-
"scripts": {
|
|
123
|
-
"build": "tsc -p tsconfig.json",
|
|
124
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
125
|
-
"test": "vitest run",
|
|
126
|
-
"test:coverage": "vitest run --coverage",
|
|
127
|
-
"check:packaging": "node scripts/check-packaging.mjs"
|
|
128
|
-
},
|
|
129
122
|
"devDependencies": {
|
|
130
123
|
"@vitest/coverage-v8": "^2.1.9",
|
|
131
124
|
"argon2": "^0.44.0",
|
|
132
125
|
"sharp": "^0.35.3"
|
|
133
126
|
},
|
|
134
127
|
"dependencies": {
|
|
135
|
-
"@jini-ai/core": "
|
|
128
|
+
"@jini-ai/core": "0.3.1"
|
|
136
129
|
},
|
|
137
130
|
"peerDependencies": {
|
|
138
131
|
"argon2": "^0.44.0",
|
|
@@ -145,5 +138,12 @@
|
|
|
145
138
|
"sharp": {
|
|
146
139
|
"optional": true
|
|
147
140
|
}
|
|
141
|
+
},
|
|
142
|
+
"scripts": {
|
|
143
|
+
"build": "tsc -p tsconfig.json",
|
|
144
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
145
|
+
"test": "vitest run",
|
|
146
|
+
"test:coverage": "vitest run --coverage",
|
|
147
|
+
"check:packaging": "node scripts/check-packaging.mjs"
|
|
148
148
|
}
|
|
149
|
-
}
|
|
149
|
+
}
|