@camox/api-contract 0.57.0 → 0.58.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/dist/index.d.ts +6 -0
- package/dist/index.js +12 -1
- package/dist/router.d.ts +36 -10
- 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 };
|
package/dist/router.d.ts
CHANGED
|
@@ -6904,6 +6904,8 @@ type BlockRow = typeof blocks.$inferSelect;
|
|
|
6904
6904
|
type ShownBlock = Conformed<BlockRow> & {
|
|
6905
6905
|
summary: string;
|
|
6906
6906
|
title: string;
|
|
6907
|
+
/** The hash of each artifact source in its content, by field (`artifactHashesOf`). */
|
|
6908
|
+
artifactHashes: Record<string, string>;
|
|
6907
6909
|
};
|
|
6908
6910
|
//#endregion
|
|
6909
6911
|
//#region ../../apps/api/src/domains/content/structured-data.d.ts
|
|
@@ -8097,6 +8099,7 @@ declare const router: {
|
|
|
8097
8099
|
afterBlockIds: string[];
|
|
8098
8100
|
} | null;
|
|
8099
8101
|
blocks: (Omit<{
|
|
8102
|
+
type: string;
|
|
8100
8103
|
draftId: string | null;
|
|
8101
8104
|
id: string;
|
|
8102
8105
|
deleted: boolean;
|
|
@@ -8104,7 +8107,6 @@ declare const router: {
|
|
|
8104
8107
|
locale: string;
|
|
8105
8108
|
pageId: string | null;
|
|
8106
8109
|
layoutId: string | null;
|
|
8107
|
-
type: string;
|
|
8108
8110
|
content: unknown;
|
|
8109
8111
|
createdAt: number;
|
|
8110
8112
|
updatedAt: number;
|
|
@@ -8122,6 +8124,7 @@ declare const router: {
|
|
|
8122
8124
|
} & {
|
|
8123
8125
|
summary: string;
|
|
8124
8126
|
title: string;
|
|
8127
|
+
artifactHashes: Record<string, string>;
|
|
8125
8128
|
} & {
|
|
8126
8129
|
references: ResolvedReferences;
|
|
8127
8130
|
})[];
|
|
@@ -8152,6 +8155,7 @@ declare const router: {
|
|
|
8152
8155
|
blockId: string;
|
|
8153
8156
|
summary: string;
|
|
8154
8157
|
title: string;
|
|
8158
|
+
artifactHashes: Record<string, string>;
|
|
8155
8159
|
} & {
|
|
8156
8160
|
references: ResolvedReferences;
|
|
8157
8161
|
})[];
|
|
@@ -8202,6 +8206,7 @@ declare const router: {
|
|
|
8202
8206
|
afterBlockIds: string[];
|
|
8203
8207
|
} | null;
|
|
8204
8208
|
blocks: (Omit<{
|
|
8209
|
+
type: string;
|
|
8205
8210
|
draftId: string | null;
|
|
8206
8211
|
id: string;
|
|
8207
8212
|
deleted: boolean;
|
|
@@ -8209,7 +8214,6 @@ declare const router: {
|
|
|
8209
8214
|
locale: string;
|
|
8210
8215
|
pageId: string | null;
|
|
8211
8216
|
layoutId: string | null;
|
|
8212
|
-
type: string;
|
|
8213
8217
|
content: unknown;
|
|
8214
8218
|
createdAt: number;
|
|
8215
8219
|
updatedAt: number;
|
|
@@ -8227,6 +8231,7 @@ declare const router: {
|
|
|
8227
8231
|
} & {
|
|
8228
8232
|
summary: string;
|
|
8229
8233
|
title: string;
|
|
8234
|
+
artifactHashes: Record<string, string>;
|
|
8230
8235
|
} & {
|
|
8231
8236
|
references: ResolvedReferences;
|
|
8232
8237
|
})[];
|
|
@@ -8257,6 +8262,7 @@ declare const router: {
|
|
|
8257
8262
|
blockId: string;
|
|
8258
8263
|
summary: string;
|
|
8259
8264
|
title: string;
|
|
8265
|
+
artifactHashes: Record<string, string>;
|
|
8260
8266
|
} & {
|
|
8261
8267
|
references: ResolvedReferences;
|
|
8262
8268
|
})[];
|
|
@@ -9450,6 +9456,7 @@ declare const router: {
|
|
|
9450
9456
|
id: import("zod").ZodUUID;
|
|
9451
9457
|
}, import("zod/v4/core").$strip>, import("@orpc/server").Schema<{
|
|
9452
9458
|
block: Omit<{
|
|
9459
|
+
type: string;
|
|
9453
9460
|
draftId: string | null;
|
|
9454
9461
|
id: string;
|
|
9455
9462
|
deleted: boolean;
|
|
@@ -9457,7 +9464,6 @@ declare const router: {
|
|
|
9457
9464
|
locale: string;
|
|
9458
9465
|
pageId: string | null;
|
|
9459
9466
|
layoutId: string | null;
|
|
9460
|
-
type: string;
|
|
9461
9467
|
content: unknown;
|
|
9462
9468
|
createdAt: number;
|
|
9463
9469
|
updatedAt: number;
|
|
@@ -9475,6 +9481,7 @@ declare const router: {
|
|
|
9475
9481
|
} & {
|
|
9476
9482
|
summary: string;
|
|
9477
9483
|
title: string;
|
|
9484
|
+
artifactHashes: Record<string, string>;
|
|
9478
9485
|
} & {
|
|
9479
9486
|
references: ResolvedReferences;
|
|
9480
9487
|
};
|
|
@@ -9505,12 +9512,14 @@ declare const router: {
|
|
|
9505
9512
|
blockId: string;
|
|
9506
9513
|
summary: string;
|
|
9507
9514
|
title: string;
|
|
9515
|
+
artifactHashes: Record<string, string>;
|
|
9508
9516
|
} & {
|
|
9509
9517
|
references: ResolvedReferences;
|
|
9510
9518
|
})[];
|
|
9511
9519
|
files: FileView[];
|
|
9512
9520
|
}, {
|
|
9513
9521
|
block: Omit<{
|
|
9522
|
+
type: string;
|
|
9514
9523
|
draftId: string | null;
|
|
9515
9524
|
id: string;
|
|
9516
9525
|
deleted: boolean;
|
|
@@ -9518,7 +9527,6 @@ declare const router: {
|
|
|
9518
9527
|
locale: string;
|
|
9519
9528
|
pageId: string | null;
|
|
9520
9529
|
layoutId: string | null;
|
|
9521
|
-
type: string;
|
|
9522
9530
|
content: unknown;
|
|
9523
9531
|
createdAt: number;
|
|
9524
9532
|
updatedAt: number;
|
|
@@ -9536,6 +9544,7 @@ declare const router: {
|
|
|
9536
9544
|
} & {
|
|
9537
9545
|
summary: string;
|
|
9538
9546
|
title: string;
|
|
9547
|
+
artifactHashes: Record<string, string>;
|
|
9539
9548
|
} & {
|
|
9540
9549
|
references: ResolvedReferences;
|
|
9541
9550
|
};
|
|
@@ -9566,6 +9575,7 @@ declare const router: {
|
|
|
9566
9575
|
blockId: string;
|
|
9567
9576
|
summary: string;
|
|
9568
9577
|
title: string;
|
|
9578
|
+
artifactHashes: Record<string, string>;
|
|
9569
9579
|
} & {
|
|
9570
9580
|
references: ResolvedReferences;
|
|
9571
9581
|
})[];
|
|
@@ -9646,6 +9656,7 @@ declare const router: {
|
|
|
9646
9656
|
type: import("zod").ZodString;
|
|
9647
9657
|
}, import("zod/v4/core").$strip>, import("@orpc/server").Schema<{
|
|
9648
9658
|
block: Omit<{
|
|
9659
|
+
type: string;
|
|
9649
9660
|
draftId: string | null;
|
|
9650
9661
|
id: string;
|
|
9651
9662
|
deleted: boolean;
|
|
@@ -9653,7 +9664,6 @@ declare const router: {
|
|
|
9653
9664
|
locale: string;
|
|
9654
9665
|
pageId: string | null;
|
|
9655
9666
|
layoutId: string | null;
|
|
9656
|
-
type: string;
|
|
9657
9667
|
content: unknown;
|
|
9658
9668
|
createdAt: number;
|
|
9659
9669
|
updatedAt: number;
|
|
@@ -9671,6 +9681,7 @@ declare const router: {
|
|
|
9671
9681
|
} & {
|
|
9672
9682
|
summary: string;
|
|
9673
9683
|
title: string;
|
|
9684
|
+
artifactHashes: Record<string, string>;
|
|
9674
9685
|
} & {
|
|
9675
9686
|
references: ResolvedReferences;
|
|
9676
9687
|
};
|
|
@@ -9701,12 +9712,14 @@ declare const router: {
|
|
|
9701
9712
|
blockId: string;
|
|
9702
9713
|
summary: string;
|
|
9703
9714
|
title: string;
|
|
9715
|
+
artifactHashes: Record<string, string>;
|
|
9704
9716
|
} & {
|
|
9705
9717
|
references: ResolvedReferences;
|
|
9706
9718
|
})[];
|
|
9707
9719
|
files: FileView[];
|
|
9708
9720
|
} | null, {
|
|
9709
9721
|
block: Omit<{
|
|
9722
|
+
type: string;
|
|
9710
9723
|
draftId: string | null;
|
|
9711
9724
|
id: string;
|
|
9712
9725
|
deleted: boolean;
|
|
@@ -9714,7 +9727,6 @@ declare const router: {
|
|
|
9714
9727
|
locale: string;
|
|
9715
9728
|
pageId: string | null;
|
|
9716
9729
|
layoutId: string | null;
|
|
9717
|
-
type: string;
|
|
9718
9730
|
content: unknown;
|
|
9719
9731
|
createdAt: number;
|
|
9720
9732
|
updatedAt: number;
|
|
@@ -9732,6 +9744,7 @@ declare const router: {
|
|
|
9732
9744
|
} & {
|
|
9733
9745
|
summary: string;
|
|
9734
9746
|
title: string;
|
|
9747
|
+
artifactHashes: Record<string, string>;
|
|
9735
9748
|
} & {
|
|
9736
9749
|
references: ResolvedReferences;
|
|
9737
9750
|
};
|
|
@@ -9762,6 +9775,7 @@ declare const router: {
|
|
|
9762
9775
|
blockId: string;
|
|
9763
9776
|
summary: string;
|
|
9764
9777
|
title: string;
|
|
9778
|
+
artifactHashes: Record<string, string>;
|
|
9765
9779
|
} & {
|
|
9766
9780
|
references: ResolvedReferences;
|
|
9767
9781
|
})[];
|
|
@@ -9866,6 +9880,7 @@ declare const router: {
|
|
|
9866
9880
|
position: import("zod").ZodString;
|
|
9867
9881
|
}, import("zod/v4/core").$strip>>>;
|
|
9868
9882
|
}, import("zod/v4/core").$strip>, import("@orpc/server").Schema<Omit<{
|
|
9883
|
+
type: string;
|
|
9869
9884
|
draftId: string | null;
|
|
9870
9885
|
id: string;
|
|
9871
9886
|
deleted: boolean;
|
|
@@ -9873,7 +9888,6 @@ declare const router: {
|
|
|
9873
9888
|
locale: string;
|
|
9874
9889
|
pageId: string | null;
|
|
9875
9890
|
layoutId: string | null;
|
|
9876
|
-
type: string;
|
|
9877
9891
|
content: unknown;
|
|
9878
9892
|
createdAt: number;
|
|
9879
9893
|
updatedAt: number;
|
|
@@ -9891,9 +9905,11 @@ declare const router: {
|
|
|
9891
9905
|
} & {
|
|
9892
9906
|
summary: string;
|
|
9893
9907
|
title: string;
|
|
9908
|
+
artifactHashes: Record<string, string>;
|
|
9894
9909
|
} & {
|
|
9895
9910
|
warnings?: string[];
|
|
9896
9911
|
}, Omit<{
|
|
9912
|
+
type: string;
|
|
9897
9913
|
draftId: string | null;
|
|
9898
9914
|
id: string;
|
|
9899
9915
|
deleted: boolean;
|
|
@@ -9901,7 +9917,6 @@ declare const router: {
|
|
|
9901
9917
|
locale: string;
|
|
9902
9918
|
pageId: string | null;
|
|
9903
9919
|
layoutId: string | null;
|
|
9904
|
-
type: string;
|
|
9905
9920
|
content: unknown;
|
|
9906
9921
|
createdAt: number;
|
|
9907
9922
|
updatedAt: number;
|
|
@@ -9919,6 +9934,7 @@ declare const router: {
|
|
|
9919
9934
|
} & {
|
|
9920
9935
|
summary: string;
|
|
9921
9936
|
title: string;
|
|
9937
|
+
artifactHashes: Record<string, string>;
|
|
9922
9938
|
} & {
|
|
9923
9939
|
warnings?: string[];
|
|
9924
9940
|
}>, Record<never, never>, Record<never, never>>;
|
|
@@ -10508,6 +10524,7 @@ declare const router: {
|
|
|
10508
10524
|
afterBlockIds: string[];
|
|
10509
10525
|
};
|
|
10510
10526
|
blocks: (Omit<{
|
|
10527
|
+
type: string;
|
|
10511
10528
|
draftId: string | null;
|
|
10512
10529
|
id: string;
|
|
10513
10530
|
deleted: boolean;
|
|
@@ -10515,7 +10532,6 @@ declare const router: {
|
|
|
10515
10532
|
locale: string;
|
|
10516
10533
|
pageId: string | null;
|
|
10517
10534
|
layoutId: string | null;
|
|
10518
|
-
type: string;
|
|
10519
10535
|
content: unknown;
|
|
10520
10536
|
createdAt: number;
|
|
10521
10537
|
updatedAt: number;
|
|
@@ -10533,6 +10549,7 @@ declare const router: {
|
|
|
10533
10549
|
} & {
|
|
10534
10550
|
summary: string;
|
|
10535
10551
|
title: string;
|
|
10552
|
+
artifactHashes: Record<string, string>;
|
|
10536
10553
|
} & {
|
|
10537
10554
|
references: ResolvedReferences;
|
|
10538
10555
|
})[];
|
|
@@ -10563,6 +10580,7 @@ declare const router: {
|
|
|
10563
10580
|
blockId: string;
|
|
10564
10581
|
summary: string;
|
|
10565
10582
|
title: string;
|
|
10583
|
+
artifactHashes: Record<string, string>;
|
|
10566
10584
|
} & {
|
|
10567
10585
|
references: ResolvedReferences;
|
|
10568
10586
|
})[];
|
|
@@ -10585,6 +10603,7 @@ declare const router: {
|
|
|
10585
10603
|
afterBlockIds: string[];
|
|
10586
10604
|
};
|
|
10587
10605
|
blocks: (Omit<{
|
|
10606
|
+
type: string;
|
|
10588
10607
|
draftId: string | null;
|
|
10589
10608
|
id: string;
|
|
10590
10609
|
deleted: boolean;
|
|
@@ -10592,7 +10611,6 @@ declare const router: {
|
|
|
10592
10611
|
locale: string;
|
|
10593
10612
|
pageId: string | null;
|
|
10594
10613
|
layoutId: string | null;
|
|
10595
|
-
type: string;
|
|
10596
10614
|
content: unknown;
|
|
10597
10615
|
createdAt: number;
|
|
10598
10616
|
updatedAt: number;
|
|
@@ -10610,6 +10628,7 @@ declare const router: {
|
|
|
10610
10628
|
} & {
|
|
10611
10629
|
summary: string;
|
|
10612
10630
|
title: string;
|
|
10631
|
+
artifactHashes: Record<string, string>;
|
|
10613
10632
|
} & {
|
|
10614
10633
|
references: ResolvedReferences;
|
|
10615
10634
|
})[];
|
|
@@ -10640,6 +10659,7 @@ declare const router: {
|
|
|
10640
10659
|
blockId: string;
|
|
10641
10660
|
summary: string;
|
|
10642
10661
|
title: string;
|
|
10662
|
+
artifactHashes: Record<string, string>;
|
|
10643
10663
|
} & {
|
|
10644
10664
|
references: ResolvedReferences;
|
|
10645
10665
|
})[];
|
|
@@ -11912,6 +11932,9 @@ declare const router: {
|
|
|
11912
11932
|
blockId: string | null;
|
|
11913
11933
|
summary: string;
|
|
11914
11934
|
title: string;
|
|
11935
|
+
artifactHashes: {
|
|
11936
|
+
[k: string]: string;
|
|
11937
|
+
};
|
|
11915
11938
|
references: ResolvedReferences;
|
|
11916
11939
|
draftId: string | null;
|
|
11917
11940
|
id: string;
|
|
@@ -11939,6 +11962,9 @@ declare const router: {
|
|
|
11939
11962
|
blockId: string | null;
|
|
11940
11963
|
summary: string;
|
|
11941
11964
|
title: string;
|
|
11965
|
+
artifactHashes: {
|
|
11966
|
+
[k: string]: string;
|
|
11967
|
+
};
|
|
11942
11968
|
references: ResolvedReferences;
|
|
11943
11969
|
draftId: string | null;
|
|
11944
11970
|
id: string;
|
package/package.json
CHANGED
package/src/artifact.ts
CHANGED
|
@@ -36,3 +36,15 @@ export function artifactSourceTitle(source: string): string | undefined {
|
|
|
36
36
|
export function artifactTitle(source: string): string {
|
|
37
37
|
return artifactSourceTitle(source) ?? UNTITLED_ARTIFACT;
|
|
38
38
|
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The hash an artifact source is stored and served under: the SHA-256 of its UTF-8 bytes, in
|
|
42
|
+
* URL-safe base64 without padding. Shared by the API, which stores sources under it, and the SDK,
|
|
43
|
+
* which names the URLs public pages load artifacts from.
|
|
44
|
+
*/
|
|
45
|
+
export async function artifactSourceHash(source: string): Promise<string> {
|
|
46
|
+
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(source));
|
|
47
|
+
let binary = "";
|
|
48
|
+
for (const byte of new Uint8Array(digest)) binary += String.fromCharCode(byte);
|
|
49
|
+
return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
|
|
50
|
+
}
|