@camox/api-contract 0.57.0 → 0.58.1
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/dist/index.d.ts +6 -0
- package/dist/index.js +12 -1
- package/dist/router.d.ts +198 -129
- package/package.json +1 -1
- package/src/artifact.ts +12 -0
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,12 @@ export declare const UNTITLED_ARTIFACT = "Untitled artifact";
|
|
|
10
10
|
export declare function artifactSourceTitle(source: string): string | undefined;
|
|
11
11
|
/** The artifact's name: its source's `<title>`, or "Untitled artifact". */
|
|
12
12
|
export declare function artifactTitle(source: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* The hash an artifact source is stored and served under: the SHA-256 of its UTF-8 bytes, in
|
|
15
|
+
* URL-safe base64 without padding. Shared by the API, which stores sources under it, and the SDK,
|
|
16
|
+
* which names the URLs public pages load artifacts from.
|
|
17
|
+
*/
|
|
18
|
+
export declare function artifactSourceHash(source: string): Promise<string>;
|
|
13
19
|
//#endregion
|
|
14
20
|
//#region src/record-templates.d.ts
|
|
15
21
|
/**
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,17 @@ function artifactSourceTitle(source) {
|
|
|
31
31
|
function artifactTitle(source) {
|
|
32
32
|
return artifactSourceTitle(source) ?? "Untitled artifact";
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* The hash an artifact source is stored and served under: the SHA-256 of its UTF-8 bytes, in
|
|
36
|
+
* URL-safe base64 without padding. Shared by the API, which stores sources under it, and the SDK,
|
|
37
|
+
* which names the URLs public pages load artifacts from.
|
|
38
|
+
*/
|
|
39
|
+
async function artifactSourceHash(source) {
|
|
40
|
+
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(source));
|
|
41
|
+
let binary = "";
|
|
42
|
+
for (const byte of new Uint8Array(digest)) binary += String.fromCharCode(byte);
|
|
43
|
+
return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
|
|
44
|
+
}
|
|
34
45
|
|
|
35
46
|
//#endregion
|
|
36
47
|
//#region src/record-templates.ts
|
|
@@ -133,4 +144,4 @@ function isSettingCondition(value) {
|
|
|
133
144
|
}
|
|
134
145
|
|
|
135
146
|
//#endregion
|
|
136
|
-
export { ARTICLE_TYPES, ICON_CATALOG_VERSION, PAGE_TEXT_LINK_PREFIX, QUERY_LIMIT_CAP, SYSTEM_ORDER_KEYS, UNTITLED_ARTIFACT, artifactSourceTitle, artifactTitle, generateUuidv7, isPageUrlMarker, isQueryBacked, isSettingCondition, isSystemOrderKey, linkedRecordId, nonStringTemplateFields, projectIdSchema, recordLink, recordText, referenceQueryProblem, scopeIconSvgIds, templateFields, uuidv7JsonSchema, uuidv7Schema, validateIconValue };
|
|
147
|
+
export { ARTICLE_TYPES, ICON_CATALOG_VERSION, PAGE_TEXT_LINK_PREFIX, QUERY_LIMIT_CAP, SYSTEM_ORDER_KEYS, UNTITLED_ARTIFACT, artifactSourceHash, artifactSourceTitle, artifactTitle, generateUuidv7, isPageUrlMarker, isQueryBacked, isSettingCondition, isSystemOrderKey, linkedRecordId, nonStringTemplateFields, projectIdSchema, recordLink, recordText, referenceQueryProblem, scopeIconSvgIds, templateFields, uuidv7JsonSchema, uuidv7Schema, validateIconValue };
|