@jwilleke/ngdpbase-types 5.25.0 → 5.27.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/README.md +1 -1
- package/lib/packages/ngdpbase-types/index.d.ts +9 -2
- package/lib/packages/ngdpbase-types/testing.d.ts +7 -3
- package/lib/packages/ngdpbase-types/testing.js +7 -3
- package/lib/src/converters/DocxConverter.d.ts +30 -0
- package/lib/src/converters/MarkdownConverter.d.ts +31 -0
- package/lib/src/export/ChromeServicePdfProvider.d.ts +52 -0
- package/lib/src/export/ChromeServicePdfProvider.js +153 -0
- package/lib/src/export/LocalChromePdfProvider.d.ts +25 -0
- package/lib/src/export/LocalChromePdfProvider.js +33 -0
- package/lib/src/export/PdfProvider.d.ts +51 -0
- package/lib/src/export/PdfProvider.js +37 -0
- package/lib/src/export/pdfEngine.d.ts +113 -0
- package/lib/src/export/pdfEngine.js +195 -0
- package/lib/src/http/egressPolicy.js +61 -0
- package/lib/src/http/guardedElasticsearch.d.ts +27 -0
- package/lib/src/http/guardedElasticsearch.js +99 -0
- package/lib/src/ice/converterShim.d.ts +5 -0
- package/lib/src/ice/fileHandling.d.ts +30 -0
- package/lib/src/ice/ledger.d.ts +37 -0
- package/lib/src/ice/runImport.d.ts +51 -0
- package/lib/src/ice/types.d.ts +262 -0
- package/lib/src/mail/MailProvider.d.ts +15 -0
- package/lib/src/mail/NodemailerMailProvider.d.ts +1 -1
- package/lib/src/managers/AddonsManager.d.ts +55 -3
- package/lib/src/managers/AttachmentManager.d.ts +4 -5
- package/lib/src/managers/AuthManager.d.ts +150 -32
- package/lib/src/managers/BackgroundJobManager.d.ts +22 -12
- package/lib/src/managers/BackupManager.d.ts +779 -0
- package/lib/src/managers/BackupManager.js +2042 -0
- package/lib/src/managers/BaseManager.d.ts +156 -6
- package/lib/src/managers/BaseManager.js +64 -2
- package/lib/src/managers/CommentManager.d.ts +6 -6
- package/lib/src/managers/ConsentManager.d.ts +130 -0
- package/lib/src/managers/DatabaseManager.d.ts +6 -0
- package/lib/src/managers/DatabaseManager.js +25 -15
- package/lib/src/managers/EmailManager.d.ts +32 -5
- package/lib/src/managers/ExportManager.d.ts +62 -0
- package/lib/src/managers/ExportManager.js +147 -2
- package/lib/src/managers/FootnoteManager.d.ts +6 -6
- package/lib/src/managers/ImportManager.d.ts +590 -0
- package/lib/src/managers/OrganizationManager.d.ts +8 -6
- package/lib/src/managers/PageManager.d.ts +61 -1
- package/lib/src/managers/PersonManager.d.ts +8 -6
- package/lib/src/managers/RoleManager.d.ts +6 -8
- package/lib/src/providers/BaseAttachmentProvider.d.ts +4 -4
- package/lib/src/providers/BaseBackupProvider.d.ts +77 -0
- package/lib/src/providers/BaseBackupProvider.js +52 -0
- package/lib/src/providers/BasicAttachmentProvider.d.ts +4 -4
- package/lib/src/providers/FileBackupProvider.d.ts +34 -0
- package/lib/src/providers/FileBackupProvider.js +116 -0
- package/lib/src/providers/FileConsentProvider.d.ts +18 -0
- package/lib/src/providers/SqliteDatabaseProvider.d.ts +2 -2
- package/lib/src/providers/SqliteDatabaseProvider.js +12 -11
- package/lib/src/providers/attachmentFilesBackup.d.ts +5 -4
- package/lib/src/providers/databaseMigrations.js +45 -0
- package/lib/src/security/PolicyDecisionPoint.d.ts +14 -0
- package/lib/src/security/PolicyInformationPoint.d.ts +25 -2
- package/lib/src/types/Config.d.ts +2 -0
- package/lib/src/types/Consent.d.ts +90 -0
- package/lib/src/types/express.d.ts +6 -0
- package/lib/src/utils/addonHost.d.ts +45 -2
- package/lib/src/utils/addonHost.js +39 -3
- package/lib/src/utils/auditEventNames.generated.d.ts +20 -0
- package/lib/src/utils/auditEventNames.generated.js +20 -0
- package/lib/src/utils/backupCrypto.js +275 -0
- package/lib/src/utils/backupDocument.d.ts +36 -0
- package/lib/src/utils/backupDocument.js +99 -0
- package/lib/src/utils/browserDescription.d.ts +11 -0
- package/lib/src/utils/directoryBackup.d.ts +48 -48
- package/lib/src/utils/directoryBackup.js +291 -0
- package/lib/src/utils/frontmatterAccess.d.ts +54 -11
- package/lib/src/utils/importRunSummary.d.ts +64 -0
- package/lib/src/utils/instanceEnvBackup.d.ts +46 -0
- package/lib/src/utils/instanceEnvBackup.js +120 -0
- package/lib/src/utils/instanceEnvSecret.js +79 -0
- package/lib/src/utils/ipLocation.d.ts +11 -0
- package/lib/src/utils/ncmNotify.d.ts +30 -0
- package/lib/src/utils/privateStoreImport.d.ts +58 -0
- package/lib/src/utils/schedule.js +171 -0
- package/lib/src/utils/secretFileMode.js +78 -0
- package/lib/src/utils/siteRestore.d.ts +13 -16
- package/lib/src/utils/siteRestore.js +33 -6
- package/lib/src/utils/treeArchive.d.ts +2 -0
- package/lib/src/utils/treeArchive.js +242 -0
- package/lib/src/utils/version.js +408 -0
- package/lib/src/utils/zipArchive.d.ts +71 -0
- package/package.json +6 -1
- package/lib/src/utils/administrators.d.ts +0 -21
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writing a zip archive from bytes already in hand (#1387).
|
|
3
|
+
*
|
|
4
|
+
* A takeout lands on the owner's laptop or phone, and that decides the format:
|
|
5
|
+
* iOS, iPadOS, Android, Windows and macOS all open a `.zip` by tapping it,
|
|
6
|
+
* while `.tar.gz` needs a third-party app on exactly the devices people carry.
|
|
7
|
+
*
|
|
8
|
+
* This is the only archive the system writes, and `readZip` below is the only
|
|
9
|
+
* one it reads: a takeout handed back for import (#1472). The instance backup does not use
|
|
10
|
+
* one: it carries private files as base64 inside the backup document (#1387),
|
|
11
|
+
* so there is nothing to unpack on restore.
|
|
12
|
+
*
|
|
13
|
+
* Bytes in, one Buffer out: a takeout is decrypted, and nothing decrypted may
|
|
14
|
+
* be staged on the server's disk, so there is no file for a packer to read.
|
|
15
|
+
*
|
|
16
|
+
* Written here rather than taken from a library because the zip container is
|
|
17
|
+
* small and completely specified, while every candidate library wants to read
|
|
18
|
+
* from or write to the filesystem. The tests extract each archive with an
|
|
19
|
+
* independent implementation and compare the bytes, so this is checked against
|
|
20
|
+
* a real reader rather than against its own assumptions.
|
|
21
|
+
*
|
|
22
|
+
* Deliberately NOT implemented: zip64. An archive over 4 GiB, a member over
|
|
23
|
+
* 4 GiB, or more than 65,535 members is refused with a clear error rather than
|
|
24
|
+
* written as something an extractor would mis-read. A store that large wants
|
|
25
|
+
* streaming and zip64 together, which is its own piece of work.
|
|
26
|
+
*/
|
|
27
|
+
/** One file to put in the archive. */
|
|
28
|
+
export type ZipEntry = {
|
|
29
|
+
/** Path inside the archive, `/`-separated, no leading slash. */
|
|
30
|
+
path: string;
|
|
31
|
+
bytes: Buffer;
|
|
32
|
+
/** Defaults to now. Zip stores 2-second resolution, and nothing before 1980. */
|
|
33
|
+
mtime?: Date;
|
|
34
|
+
};
|
|
35
|
+
export declare function crc32(buf: Buffer): number;
|
|
36
|
+
/**
|
|
37
|
+
* A zip archive of the given entries, as one Buffer.
|
|
38
|
+
*
|
|
39
|
+
* Entries are deflated when that makes them smaller — markdown compresses well,
|
|
40
|
+
* and a phone on mobile data is the expected destination — and stored as-is
|
|
41
|
+
* when it does not, which is the usual outcome for photos and other media.
|
|
42
|
+
*/
|
|
43
|
+
export declare function packZip(entries: readonly ZipEntry[]): Promise<Buffer>;
|
|
44
|
+
/** Limits on what `readZip` will unpack, so an upload cannot exhaust memory. */
|
|
45
|
+
export type ZipReadLimits = {
|
|
46
|
+
/** Most members accepted. */
|
|
47
|
+
maxEntries: number;
|
|
48
|
+
/** Most bytes accepted once everything is inflated. */
|
|
49
|
+
maxTotalBytes: number;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The files in a zip archive, as bytes in memory (#1472).
|
|
53
|
+
*
|
|
54
|
+
* Read from the central directory, which is the archive's own table of
|
|
55
|
+
* contents, so a member written with a data descriptor — what a streaming
|
|
56
|
+
* writer, or an OS re-zipping a folder, produces — is read the same as any
|
|
57
|
+
* other. Directory entries are dropped, and so is what macOS adds when it
|
|
58
|
+
* zips a folder (`__MACOSX/`, `.DS_Store`): they are not anyone's data.
|
|
59
|
+
*
|
|
60
|
+
* Refused, with an error naming why, rather than read as something else:
|
|
61
|
+
*
|
|
62
|
+
* - a path that would climb out of wherever it is extracted — absolute, or
|
|
63
|
+
* holding a `..` segment, with `\` read as the separator it is on Windows;
|
|
64
|
+
* - encryption, zip64, split archives, and any method but stored and deflate;
|
|
65
|
+
* - a member whose inflated bytes do not match the size or CRC the archive
|
|
66
|
+
* declares for it;
|
|
67
|
+
* - more members, or more inflated bytes, than `limits` allow. Inflating is
|
|
68
|
+
* capped per member at what is left of the budget, so a small archive
|
|
69
|
+
* that expands enormously stops at the budget, not at the machine's memory.
|
|
70
|
+
*/
|
|
71
|
+
export declare function readZip(archive: Buffer, limits: ZipReadLimits): ZipEntry[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jwilleke/ngdpbase-types",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.27.0",
|
|
4
4
|
"description": "TypeScript types for ngdpbase add-ons, and a test kit of core's own values. A dev dependency, versioned with ngdpbase.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Jim Willeke",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"node": ">=24.15.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@elastic/elasticsearch": "^8.19.2",
|
|
34
35
|
"@jwilleke/oidc-auth-server": "0.4.0",
|
|
35
36
|
"@simplewebauthn/server": "^14.0.3",
|
|
36
37
|
"@types/express": "^5.0.5",
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
"@types/multer": "^2.3.0",
|
|
41
42
|
"@types/node": "^24.19.2",
|
|
42
43
|
"better-sqlite3-multiple-ciphers": "^13.0.3",
|
|
44
|
+
"dotenv": "^18.0.8",
|
|
43
45
|
"express": "^5.3.0",
|
|
44
46
|
"express-session": "^1.19.0",
|
|
45
47
|
"fs-extra": "^11.4.1",
|
|
@@ -50,6 +52,9 @@
|
|
|
50
52
|
"minimatch": "^10.2.6",
|
|
51
53
|
"minisearch": "7.2.0",
|
|
52
54
|
"multer": "^2.4.0",
|
|
55
|
+
"rrule-temporal": "2.2.8",
|
|
56
|
+
"tar": "^7.5.22",
|
|
57
|
+
"temporal-polyfill": "1.0.6",
|
|
53
58
|
"winston": "^3.17.0"
|
|
54
59
|
}
|
|
55
60
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Who an administrator notification goes to.
|
|
3
|
-
*
|
|
4
|
-
* __An administrator is whoever holds `admin-system`__, asked per user through
|
|
5
|
-
* the policy (#1431 7b) — never a role name. Used by every report that must
|
|
6
|
-
* reach administrators and nobody else: a damaged page (#1431 step 7) and
|
|
7
|
-
* failing outbound email (#1916).
|
|
8
|
-
*
|
|
9
|
-
* An empty answer means "nobody to tell", and the caller must then log only:
|
|
10
|
-
* an empty `targetUsers` list means ALL users in NotificationManager, which
|
|
11
|
-
* would announce an operator problem to every reader.
|
|
12
|
-
*
|
|
13
|
-
* Null when the managers needed to answer are not registered (tests, a
|
|
14
|
-
* half-booted engine) — the caller treats that like "nobody to tell".
|
|
15
|
-
*/
|
|
16
|
-
type EngineLike = {
|
|
17
|
-
getManager: (name: string) => unknown;
|
|
18
|
-
} | null | undefined;
|
|
19
|
-
/** Usernames of every user who holds `admin-system`; null when it cannot be asked. */
|
|
20
|
-
export declare function administratorUsernames(engine: EngineLike): Promise<string[] | null>;
|
|
21
|
-
export {};
|