apostrophe 4.31.1-beta.1 → 4.32.0
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/CHANGELOG.md +43 -2
- package/claude-tools/run-mocha-file.sh +29 -0
- package/modules/@apostrophecms/area/index.js +14 -5
- package/modules/@apostrophecms/area/ui/apos/apps/AposAreas.js +72 -3
- package/modules/@apostrophecms/asset/index.js +170 -21
- package/modules/@apostrophecms/asset/lib/build/external-module-api.js +7 -16
- package/modules/@apostrophecms/asset/lib/build/internals.js +1 -3
- package/modules/@apostrophecms/asset/lib/build/task.js +7 -13
- package/modules/@apostrophecms/command-menu/ui/apos/components/TheAposCommandMenu.vue +21 -1
- package/modules/@apostrophecms/doc-type/index.js +73 -15
- package/modules/@apostrophecms/http/index.js +175 -139
- package/modules/@apostrophecms/image/index.js +16 -7
- package/modules/@apostrophecms/image/ui/apos/components/AposMediaManager.vue +9 -1
- package/modules/@apostrophecms/job/index.js +3 -1
- package/modules/@apostrophecms/oembed/index.js +12 -45
- package/modules/@apostrophecms/page/index.js +17 -1
- package/modules/@apostrophecms/rich-text-widget/ui/apos/components/AposRichTextWidgetEditor.vue +10 -1
- package/modules/@apostrophecms/rich-text-widget/ui/apos/components/AposTiptapInsertItem.vue +3 -14
- package/modules/@apostrophecms/rich-text-widget/ui/apos/lib/remove-slash.js +18 -0
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputDateAndTime.vue +37 -6
- package/modules/@apostrophecms/url/index.js +54 -0
- package/package.json +11 -12
- package/test/asset-external.js +3 -0
- package/test/asset-lock-cache.js +243 -0
- package/test/assets.js +25 -2
- package/test/config-cascade-merge.js +73 -0
- package/test/files.js +10 -11
- package/test/image-tags.js +103 -0
- package/test/modules/collision-piece/index.js +23 -0
- package/test/oembed.js +0 -98
- package/test/pages-move-permissions.js +317 -0
- package/test/pages.js +12 -15
- package/test/pieces-public-api-relationship-choices.js +245 -0
- package/test/pieces.js +12 -15
- package/test-lib/test.js +32 -0
package/test-lib/test.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const fs = require('fs-extra');
|
|
2
2
|
const path = require('path');
|
|
3
|
+
const http = require('node:http');
|
|
3
4
|
|
|
4
5
|
const setupPackages = ({ folder = 'test' }) => {
|
|
5
6
|
const testNodeModules = path.join(__dirname, '../', folder, 'node_modules/');
|
|
@@ -57,5 +58,36 @@ const setupPackages = ({ folder = 'test' }) => {
|
|
|
57
58
|
};
|
|
58
59
|
setupPackages({ folder: 'test' });
|
|
59
60
|
|
|
61
|
+
// Performs a GET via the raw node:http client, sending `headers` to the server
|
|
62
|
+
// verbatim. Use this in tests that must control headers the built-in fetch
|
|
63
|
+
// (used by apos.http) would otherwise refuse or rewrite: e.g. a forbidden
|
|
64
|
+
// `Host` header, or the `Cache-Control: no-cache` it adds to any request that
|
|
65
|
+
// carries a conditional header (If-None-Match / If-Modified-Since). `url` may
|
|
66
|
+
// be absolute or site-relative (resolved against `apos.http.getBase()`).
|
|
67
|
+
// Resolves with a fullResponse-shaped { status, headers, body }.
|
|
68
|
+
const rawGet = (apos, url, headers = {}) => {
|
|
69
|
+
const target = url.startsWith('/') ? `${apos.http.getBase()}${url}` : url;
|
|
70
|
+
return new Promise((resolve, reject) => {
|
|
71
|
+
// Pass the URL string (rather than a split hostname/port) so an IPv6 base
|
|
72
|
+
// such as `http://[::1]:3000` from getBase() is handled correctly; a
|
|
73
|
+
// bracketed hostname passed on its own is treated as a name to DNS-resolve.
|
|
74
|
+
const req = http.request(target, {
|
|
75
|
+
method: 'GET',
|
|
76
|
+
headers
|
|
77
|
+
}, (res) => {
|
|
78
|
+
const chunks = [];
|
|
79
|
+
res.on('data', (chunk) => chunks.push(chunk));
|
|
80
|
+
res.on('end', () => resolve({
|
|
81
|
+
status: res.statusCode,
|
|
82
|
+
headers: res.headers,
|
|
83
|
+
body: Buffer.concat(chunks).toString()
|
|
84
|
+
}));
|
|
85
|
+
});
|
|
86
|
+
req.on('error', reject);
|
|
87
|
+
req.end();
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
60
91
|
module.exports = require('./util.js');
|
|
61
92
|
module.exports.setupPackages = setupPackages;
|
|
93
|
+
module.exports.rawGet = rawGet;
|