@nakafa/aksara-contracts 0.51.0 → 1.0.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.
@@ -1203,12 +1203,25 @@ export declare const PublicationRequestSchema: Schema.Union<readonly [Schema.Str
1203
1203
  readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
1204
1204
  readonly payload: Schema.Struct<{
1205
1205
  readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
1206
- readonly byteLength: Schema.Finite;
1207
- readonly compiledCode: Schema.String;
1208
1206
  readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
1209
- readonly compilerVersion: Schema.Literal<"0.1.0">;
1207
+ readonly compilerVersion: Schema.Literal<"0.2.0">;
1210
1208
  readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
1211
- readonly format: Schema.Literal<"mdx-function-body">;
1209
+ readonly contentTree: Schema.Codec<{
1210
+ readonly $node: "element";
1211
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
1212
+ readonly name: import("../tree.js").ContentTreeElementName;
1213
+ readonly props: {
1214
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
1215
+ };
1216
+ }, {
1217
+ readonly $node: "element";
1218
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
1219
+ readonly name: import("../tree.js").ContentTreeElementName;
1220
+ readonly props: {
1221
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
1222
+ };
1223
+ }, never, never>;
1224
+ readonly format: Schema.Literal<"content-tree">;
1212
1225
  readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
1213
1226
  readonly plainText: Schema.String;
1214
1227
  readonly rawMdx: Schema.String;
@@ -2253,12 +2266,25 @@ export declare const PublicationRequestSchema: Schema.Union<readonly [Schema.Str
2253
2266
  readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
2254
2267
  readonly payload: Schema.Struct<{
2255
2268
  readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
2256
- readonly byteLength: Schema.Finite;
2257
- readonly compiledCode: Schema.String;
2258
2269
  readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
2259
- readonly compilerVersion: Schema.Literal<"0.1.0">;
2270
+ readonly compilerVersion: Schema.Literal<"0.2.0">;
2260
2271
  readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
2261
- readonly format: Schema.Literal<"mdx-function-body">;
2272
+ readonly contentTree: Schema.Codec<{
2273
+ readonly $node: "element";
2274
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
2275
+ readonly name: import("../tree.js").ContentTreeElementName;
2276
+ readonly props: {
2277
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
2278
+ };
2279
+ }, {
2280
+ readonly $node: "element";
2281
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
2282
+ readonly name: import("../tree.js").ContentTreeElementName;
2283
+ readonly props: {
2284
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
2285
+ };
2286
+ }, never, never>;
2287
+ readonly format: Schema.Literal<"content-tree">;
2262
2288
  readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
2263
2289
  readonly plainText: Schema.String;
2264
2290
  readonly rawMdx: Schema.String;
@@ -2990,12 +3016,18 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
2990
3016
  readonly keyId: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSigningKeyId">;
2991
3017
  readonly payload: {
2992
3018
  readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
2993
- readonly byteLength: number;
2994
- readonly compiledCode: string;
2995
3019
  readonly compilerConfigHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
2996
- readonly compilerVersion: "0.1.0";
3020
+ readonly compilerVersion: "0.2.0";
2997
3021
  readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
2998
- readonly format: "mdx-function-body";
3022
+ readonly contentTree: {
3023
+ readonly $node: "element";
3024
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
3025
+ readonly name: import("../tree.js").ContentTreeElementName;
3026
+ readonly props: {
3027
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
3028
+ };
3029
+ };
3030
+ readonly format: "content-tree";
2999
3031
  readonly mdxCompilerVersion: "3.1.1";
3000
3032
  readonly plainText: string;
3001
3033
  readonly rawMdx: string;
@@ -3009,12 +3041,18 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
3009
3041
  readonly keyId: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSigningKeyId">;
3010
3042
  readonly payload: {
3011
3043
  readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
3012
- readonly byteLength: number;
3013
- readonly compiledCode: string;
3014
3044
  readonly compilerConfigHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
3015
- readonly compilerVersion: "0.1.0";
3045
+ readonly compilerVersion: "0.2.0";
3016
3046
  readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
3017
- readonly format: "mdx-function-body";
3047
+ readonly contentTree: {
3048
+ readonly $node: "element";
3049
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
3050
+ readonly name: import("../tree.js").ContentTreeElementName;
3051
+ readonly props: {
3052
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
3053
+ };
3054
+ };
3055
+ readonly format: "content-tree";
3018
3056
  readonly mdxCompilerVersion: "3.1.1";
3019
3057
  readonly plainText: string;
3020
3058
  readonly rawMdx: string;
@@ -5006,12 +5044,18 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
5006
5044
  readonly keyId: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSigningKeyId">;
5007
5045
  readonly payload: {
5008
5046
  readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
5009
- readonly byteLength: number;
5010
- readonly compiledCode: string;
5011
5047
  readonly compilerConfigHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
5012
- readonly compilerVersion: "0.1.0";
5048
+ readonly compilerVersion: "0.2.0";
5013
5049
  readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
5014
- readonly format: "mdx-function-body";
5050
+ readonly contentTree: {
5051
+ readonly $node: "element";
5052
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
5053
+ readonly name: import("../tree.js").ContentTreeElementName;
5054
+ readonly props: {
5055
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
5056
+ };
5057
+ };
5058
+ readonly format: "content-tree";
5015
5059
  readonly mdxCompilerVersion: "3.1.1";
5016
5060
  readonly plainText: string;
5017
5061
  readonly rawMdx: string;
@@ -5025,12 +5069,18 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
5025
5069
  readonly keyId: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSigningKeyId">;
5026
5070
  readonly payload: {
5027
5071
  readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
5028
- readonly byteLength: number;
5029
- readonly compiledCode: string;
5030
5072
  readonly compilerConfigHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
5031
- readonly compilerVersion: "0.1.0";
5073
+ readonly compilerVersion: "0.2.0";
5032
5074
  readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
5033
- readonly format: "mdx-function-body";
5075
+ readonly contentTree: {
5076
+ readonly $node: "element";
5077
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
5078
+ readonly name: import("../tree.js").ContentTreeElementName;
5079
+ readonly props: {
5080
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
5081
+ };
5082
+ };
5083
+ readonly format: "content-tree";
5034
5084
  readonly mdxCompilerVersion: "3.1.1";
5035
5085
  readonly plainText: string;
5036
5086
  readonly rawMdx: string;
@@ -6776,12 +6826,18 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
6776
6826
  readonly keyId: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSigningKeyId">;
6777
6827
  readonly payload: {
6778
6828
  readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
6779
- readonly byteLength: number;
6780
- readonly compiledCode: string;
6781
6829
  readonly compilerConfigHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
6782
- readonly compilerVersion: "0.1.0";
6830
+ readonly compilerVersion: "0.2.0";
6783
6831
  readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
6784
- readonly format: "mdx-function-body";
6832
+ readonly contentTree: {
6833
+ readonly $node: "element";
6834
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
6835
+ readonly name: import("../tree.js").ContentTreeElementName;
6836
+ readonly props: {
6837
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
6838
+ };
6839
+ };
6840
+ readonly format: "content-tree";
6785
6841
  readonly mdxCompilerVersion: "3.1.1";
6786
6842
  readonly plainText: string;
6787
6843
  readonly rawMdx: string;
@@ -6795,12 +6851,18 @@ export declare const decodePublicationRequest: (input: unknown) => Effect.Effect
6795
6851
  readonly keyId: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSigningKeyId">;
6796
6852
  readonly payload: {
6797
6853
  readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
6798
- readonly byteLength: number;
6799
- readonly compiledCode: string;
6800
6854
  readonly compilerConfigHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
6801
- readonly compilerVersion: "0.1.0";
6855
+ readonly compilerVersion: "0.2.0";
6802
6856
  readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
6803
- readonly format: "mdx-function-body";
6857
+ readonly contentTree: {
6858
+ readonly $node: "element";
6859
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
6860
+ readonly name: import("../tree.js").ContentTreeElementName;
6861
+ readonly props: {
6862
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
6863
+ };
6864
+ };
6865
+ readonly format: "content-tree";
6804
6866
  readonly mdxCompilerVersion: "3.1.1";
6805
6867
  readonly plainText: string;
6806
6868
  readonly rawMdx: string;
@@ -997,12 +997,25 @@ export declare const PublicationRollbackSuccessSchema: Schema.Struct<{
997
997
  readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
998
998
  readonly payload: Schema.Struct<{
999
999
  readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
1000
- readonly byteLength: Schema.Finite;
1001
- readonly compiledCode: Schema.String;
1002
1000
  readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
1003
- readonly compilerVersion: Schema.Literal<"0.1.0">;
1001
+ readonly compilerVersion: Schema.Literal<"0.2.0">;
1004
1002
  readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
1005
- readonly format: Schema.Literal<"mdx-function-body">;
1003
+ readonly contentTree: Schema.Codec<{
1004
+ readonly $node: "element";
1005
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
1006
+ readonly name: import("../tree.js").ContentTreeElementName;
1007
+ readonly props: {
1008
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
1009
+ };
1010
+ }, {
1011
+ readonly $node: "element";
1012
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
1013
+ readonly name: import("../tree.js").ContentTreeElementName;
1014
+ readonly props: {
1015
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
1016
+ };
1017
+ }, never, never>;
1018
+ readonly format: Schema.Literal<"content-tree">;
1006
1019
  readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
1007
1020
  readonly plainText: Schema.String;
1008
1021
  readonly rawMdx: Schema.String;
@@ -1241,12 +1254,25 @@ export declare const PublicationRollbackSuccessSchema: Schema.Struct<{
1241
1254
  readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
1242
1255
  readonly payload: Schema.Struct<{
1243
1256
  readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
1244
- readonly byteLength: Schema.Finite;
1245
- readonly compiledCode: Schema.String;
1246
1257
  readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
1247
- readonly compilerVersion: Schema.Literal<"0.1.0">;
1258
+ readonly compilerVersion: Schema.Literal<"0.2.0">;
1248
1259
  readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
1249
- readonly format: Schema.Literal<"mdx-function-body">;
1260
+ readonly contentTree: Schema.Codec<{
1261
+ readonly $node: "element";
1262
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
1263
+ readonly name: import("../tree.js").ContentTreeElementName;
1264
+ readonly props: {
1265
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
1266
+ };
1267
+ }, {
1268
+ readonly $node: "element";
1269
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
1270
+ readonly name: import("../tree.js").ContentTreeElementName;
1271
+ readonly props: {
1272
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
1273
+ };
1274
+ }, never, never>;
1275
+ readonly format: Schema.Literal<"content-tree">;
1250
1276
  readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
1251
1277
  readonly plainText: Schema.String;
1252
1278
  readonly rawMdx: Schema.String;
@@ -2439,12 +2465,25 @@ export declare const PublicationSuccessSchema: Schema.Union<readonly [Schema.Str
2439
2465
  readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
2440
2466
  readonly payload: Schema.Struct<{
2441
2467
  readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
2442
- readonly byteLength: Schema.Finite;
2443
- readonly compiledCode: Schema.String;
2444
2468
  readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
2445
- readonly compilerVersion: Schema.Literal<"0.1.0">;
2469
+ readonly compilerVersion: Schema.Literal<"0.2.0">;
2446
2470
  readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
2447
- readonly format: Schema.Literal<"mdx-function-body">;
2471
+ readonly contentTree: Schema.Codec<{
2472
+ readonly $node: "element";
2473
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
2474
+ readonly name: import("../tree.js").ContentTreeElementName;
2475
+ readonly props: {
2476
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
2477
+ };
2478
+ }, {
2479
+ readonly $node: "element";
2480
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
2481
+ readonly name: import("../tree.js").ContentTreeElementName;
2482
+ readonly props: {
2483
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
2484
+ };
2485
+ }, never, never>;
2486
+ readonly format: Schema.Literal<"content-tree">;
2448
2487
  readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
2449
2488
  readonly plainText: Schema.String;
2450
2489
  readonly rawMdx: Schema.String;
@@ -2683,12 +2722,25 @@ export declare const PublicationSuccessSchema: Schema.Union<readonly [Schema.Str
2683
2722
  readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
2684
2723
  readonly payload: Schema.Struct<{
2685
2724
  readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
2686
- readonly byteLength: Schema.Finite;
2687
- readonly compiledCode: Schema.String;
2688
2725
  readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
2689
- readonly compilerVersion: Schema.Literal<"0.1.0">;
2726
+ readonly compilerVersion: Schema.Literal<"0.2.0">;
2690
2727
  readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
2691
- readonly format: Schema.Literal<"mdx-function-body">;
2728
+ readonly contentTree: Schema.Codec<{
2729
+ readonly $node: "element";
2730
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
2731
+ readonly name: import("../tree.js").ContentTreeElementName;
2732
+ readonly props: {
2733
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
2734
+ };
2735
+ }, {
2736
+ readonly $node: "element";
2737
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
2738
+ readonly name: import("../tree.js").ContentTreeElementName;
2739
+ readonly props: {
2740
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
2741
+ };
2742
+ }, never, never>;
2743
+ readonly format: Schema.Literal<"content-tree">;
2692
2744
  readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
2693
2745
  readonly plainText: Schema.String;
2694
2746
  readonly rawMdx: Schema.String;
@@ -3947,12 +3999,25 @@ export declare const PublicationResponseSchema: Schema.Union<readonly [Schema.Un
3947
3999
  readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
3948
4000
  readonly payload: Schema.Struct<{
3949
4001
  readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
3950
- readonly byteLength: Schema.Finite;
3951
- readonly compiledCode: Schema.String;
3952
4002
  readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
3953
- readonly compilerVersion: Schema.Literal<"0.1.0">;
4003
+ readonly compilerVersion: Schema.Literal<"0.2.0">;
3954
4004
  readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
3955
- readonly format: Schema.Literal<"mdx-function-body">;
4005
+ readonly contentTree: Schema.Codec<{
4006
+ readonly $node: "element";
4007
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
4008
+ readonly name: import("../tree.js").ContentTreeElementName;
4009
+ readonly props: {
4010
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
4011
+ };
4012
+ }, {
4013
+ readonly $node: "element";
4014
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
4015
+ readonly name: import("../tree.js").ContentTreeElementName;
4016
+ readonly props: {
4017
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
4018
+ };
4019
+ }, never, never>;
4020
+ readonly format: Schema.Literal<"content-tree">;
3956
4021
  readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
3957
4022
  readonly plainText: Schema.String;
3958
4023
  readonly rawMdx: Schema.String;
@@ -4191,12 +4256,25 @@ export declare const PublicationResponseSchema: Schema.Union<readonly [Schema.Un
4191
4256
  readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
4192
4257
  readonly payload: Schema.Struct<{
4193
4258
  readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
4194
- readonly byteLength: Schema.Finite;
4195
- readonly compiledCode: Schema.String;
4196
4259
  readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
4197
- readonly compilerVersion: Schema.Literal<"0.1.0">;
4260
+ readonly compilerVersion: Schema.Literal<"0.2.0">;
4198
4261
  readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
4199
- readonly format: Schema.Literal<"mdx-function-body">;
4262
+ readonly contentTree: Schema.Codec<{
4263
+ readonly $node: "element";
4264
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
4265
+ readonly name: import("../tree.js").ContentTreeElementName;
4266
+ readonly props: {
4267
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
4268
+ };
4269
+ }, {
4270
+ readonly $node: "element";
4271
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
4272
+ readonly name: import("../tree.js").ContentTreeElementName;
4273
+ readonly props: {
4274
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
4275
+ };
4276
+ }, never, never>;
4277
+ readonly format: Schema.Literal<"content-tree">;
4200
4278
  readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
4201
4279
  readonly plainText: Schema.String;
4202
4280
  readonly rawMdx: Schema.String;
@@ -5266,12 +5344,18 @@ export declare const decodePublicationResponse: (input: unknown) => Effect.Effec
5266
5344
  readonly keyId: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSigningKeyId">;
5267
5345
  readonly payload: {
5268
5346
  readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
5269
- readonly byteLength: number;
5270
- readonly compiledCode: string;
5271
5347
  readonly compilerConfigHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
5272
- readonly compilerVersion: "0.1.0";
5348
+ readonly compilerVersion: "0.2.0";
5273
5349
  readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
5274
- readonly format: "mdx-function-body";
5350
+ readonly contentTree: {
5351
+ readonly $node: "element";
5352
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
5353
+ readonly name: import("../tree.js").ContentTreeElementName;
5354
+ readonly props: {
5355
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
5356
+ };
5357
+ };
5358
+ readonly format: "content-tree";
5275
5359
  readonly mdxCompilerVersion: "3.1.1";
5276
5360
  readonly plainText: string;
5277
5361
  readonly rawMdx: string;
@@ -5518,12 +5602,18 @@ export declare const decodePublicationResponse: (input: unknown) => Effect.Effec
5518
5602
  readonly keyId: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSigningKeyId">;
5519
5603
  readonly payload: {
5520
5604
  readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
5521
- readonly byteLength: number;
5522
- readonly compiledCode: string;
5523
5605
  readonly compilerConfigHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
5524
- readonly compilerVersion: "0.1.0";
5606
+ readonly compilerVersion: "0.2.0";
5525
5607
  readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
5526
- readonly format: "mdx-function-body";
5608
+ readonly contentTree: {
5609
+ readonly $node: "element";
5610
+ readonly children: readonly import("../tree.js").ContentTreeChild[];
5611
+ readonly name: import("../tree.js").ContentTreeElementName;
5612
+ readonly props: {
5613
+ readonly [key: string]: import("../tree.js").ContentTreeValue;
5614
+ };
5615
+ };
5616
+ readonly format: "content-tree";
5527
5617
  readonly mdxCompilerVersion: "3.1.1";
5528
5618
  readonly plainText: string;
5529
5619
  readonly rawMdx: string;
package/dist/tree.d.ts ADDED
@@ -0,0 +1,52 @@
1
+ import { Schema } from "effect";
2
+ /** Intrinsic HTML tags that the Markdown and MDX pipeline may emit, in code-unit order. */
3
+ export declare const CONTENT_TREE_INTRINSIC_TAGS: readonly ["a", "blockquote", "br", "code", "del", "div", "em", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "img", "input", "li", "ol", "p", "pre", "section", "strong", "sub", "sup", "table", "tbody", "td", "th", "thead", "tr", "ul"];
4
+ /** One intrinsic HTML tag from the allowed pipeline list. */
5
+ export declare const ContentTreeIntrinsicTagSchema: Schema.Literals<readonly ["a", "blockquote", "br", "code", "del", "div", "em", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "img", "input", "li", "ol", "p", "pre", "section", "strong", "sub", "sup", "table", "tbody", "td", "th", "thead", "tr", "ul"]>;
6
+ /** The element name of one tree node: the fragment, an intrinsic tag, or a renderer component. */
7
+ export declare const ContentTreeElementNameSchema: Schema.Union<readonly [Schema.Literal<"fragment">, Schema.Literals<readonly ["a", "blockquote", "br", "code", "del", "div", "em", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "img", "input", "li", "ol", "p", "pre", "section", "strong", "sub", "sup", "table", "tbody", "td", "th", "thead", "tr", "ul"]>, Schema.String]>;
8
+ export type ContentTreeElementName = typeof ContentTreeElementNameSchema.Type;
9
+ /**
10
+ * A value a prop or a list may hold: JSON data, an element of the tree, or a
11
+ * plain JSON object whose values are tree values. The recursive shapes are
12
+ * object members of this union, which is how the repository names recursive
13
+ * Schema types, so the element and props names below are derived from it.
14
+ */
15
+ export type ContentTreeValue = null | boolean | number | string | readonly ContentTreeValue[] | {
16
+ readonly $node: "element";
17
+ readonly children: readonly ContentTreeChild[];
18
+ readonly name: ContentTreeElementName;
19
+ readonly props: {
20
+ readonly [key: string]: ContentTreeValue;
21
+ };
22
+ } | {
23
+ readonly [key: string]: ContentTreeValue;
24
+ };
25
+ /** One rendered node: its name, its props, and its ordered children. */
26
+ export type ContentTreeElement = Extract<ContentTreeValue, {
27
+ readonly $node: "element";
28
+ }>;
29
+ /** Named props of one element, each a JSON value or an element of the tree. */
30
+ export type ContentTreeProps = ContentTreeElement["props"];
31
+ /** Text, or one element in the order React would render it. */
32
+ export type ContentTreeChild = string | ContentTreeElement;
33
+ /** The signed content tree: the fragment that Nakafa renders with its component map. */
34
+ export declare const ContentTreeSchema: Schema.Codec<{
35
+ readonly $node: "element";
36
+ readonly children: readonly ContentTreeChild[];
37
+ readonly name: ContentTreeElementName;
38
+ readonly props: {
39
+ readonly [key: string]: ContentTreeValue;
40
+ };
41
+ }, {
42
+ readonly $node: "element";
43
+ readonly children: readonly ContentTreeChild[];
44
+ readonly name: ContentTreeElementName;
45
+ readonly props: {
46
+ readonly [key: string]: ContentTreeValue;
47
+ };
48
+ }, never, never>;
49
+ /** Serializes the tree as the exact JSON text that hashes and signatures cover. */
50
+ export declare function canonicalizeContentTree(tree: ContentTreeElement): string;
51
+ /** Lists the renderer components that one tree uses, once each, in first-use order. */
52
+ export declare function contentTreeComponentNames(tree: ContentTreeElement): readonly string[];
package/dist/tree.js ADDED
@@ -0,0 +1,162 @@
1
+ import { Array as Arr, Order, Predicate, Record as Rec, Schema } from "effect";
2
+ import { encodeJsonText } from "#contracts/text/json";
3
+ /** Key that only an element may carry, so a plain JSON object can never imitate one. */
4
+ const ELEMENT_KEY = "$node";
5
+ /** Name of the element that renders its children without an element of its own. */
6
+ const FRAGMENT_NAME = "fragment";
7
+ /** Renderer components are capitalized JSX names, never intrinsic tags. */
8
+ const COMPONENT_NAME_PATTERN = /^[A-Z][A-Za-z0-9]*$/;
9
+ /** Intrinsic HTML tags that the Markdown and MDX pipeline may emit, in code-unit order. */
10
+ export const CONTENT_TREE_INTRINSIC_TAGS = [
11
+ "a",
12
+ "blockquote",
13
+ "br",
14
+ "code",
15
+ "del",
16
+ "div",
17
+ "em",
18
+ "h1",
19
+ "h2",
20
+ "h3",
21
+ "h4",
22
+ "h5",
23
+ "h6",
24
+ "hr",
25
+ "img",
26
+ "input",
27
+ "li",
28
+ "ol",
29
+ "p",
30
+ "pre",
31
+ "section",
32
+ "strong",
33
+ "sub",
34
+ "sup",
35
+ "table",
36
+ "tbody",
37
+ "td",
38
+ "th",
39
+ "thead",
40
+ "tr",
41
+ "ul",
42
+ ];
43
+ /** One intrinsic HTML tag from the allowed pipeline list. */
44
+ export const ContentTreeIntrinsicTagSchema = Schema.Literals(CONTENT_TREE_INTRINSIC_TAGS);
45
+ /** The element name of one tree node: the fragment, an intrinsic tag, or a renderer component. */
46
+ export const ContentTreeElementNameSchema = Schema.Union([
47
+ Schema.Literal(FRAGMENT_NAME),
48
+ ContentTreeIntrinsicTagSchema,
49
+ Schema.String.check(Schema.isPattern(COMPONENT_NAME_PATTERN)),
50
+ ]);
51
+ /** Rejects a props object that uses the reserved element key. */
52
+ function hasNoElementKey(props) {
53
+ return !Predicate.hasProperty(props, ELEMENT_KEY);
54
+ }
55
+ /** Any prop value: JSON data or a nested element. */
56
+ const ContentTreeValueSchema = Schema.suspend(() => Schema.Union([
57
+ Schema.Null,
58
+ Schema.Boolean,
59
+ Schema.Finite,
60
+ Schema.String,
61
+ Schema.Array(ContentTreeValueSchema),
62
+ ContentTreeElementSchema,
63
+ ContentTreePropsSchema,
64
+ ]));
65
+ /** Props of one element or one plain JSON object, never carrying the element key. */
66
+ const ContentTreePropsSchema = Schema.suspend(() => Schema.Record(Schema.String, ContentTreeValueSchema).check(Schema.makeFilter(hasNoElementKey, {
67
+ message: "Expected props without the reserved element key.",
68
+ })));
69
+ /** Text or a nested element. */
70
+ const ContentTreeChildSchema = Schema.suspend(() => Schema.Union([Schema.String, ContentTreeElementSchema]));
71
+ /**
72
+ * One element of the tree, with its reserved marker and its exact fields. The
73
+ * signed bytes come from canonicalizeContentTree, never from the key order of a
74
+ * decoded object, which the repository's formatter keeps alphabetical.
75
+ */
76
+ const ContentTreeElementSchema = Schema.Struct({
77
+ $node: Schema.Literal("element"),
78
+ children: Schema.Array(ContentTreeChildSchema),
79
+ name: ContentTreeElementNameSchema,
80
+ props: ContentTreePropsSchema,
81
+ });
82
+ /** The signed content tree: the fragment that Nakafa renders with its component map. */
83
+ export const ContentTreeSchema = ContentTreeElementSchema.check(Schema.makeFilter((tree) => tree.name === FRAGMENT_NAME, {
84
+ message: "Expected the fragment as the content tree root.",
85
+ }));
86
+ /** Checks whether a tree value is an element rather than JSON data. */
87
+ function isElement(value) {
88
+ return (Predicate.isObject(value) &&
89
+ !Arr.isArray(value) &&
90
+ Predicate.hasProperty(value, ELEMENT_KEY));
91
+ }
92
+ /** Checks whether a tree value is a list of tree values. */
93
+ function isList(value) {
94
+ return Arr.isArray(value);
95
+ }
96
+ /** Checks whether a tree value is a plain props object. */
97
+ function isProps(value) {
98
+ return Predicate.isObject(value);
99
+ }
100
+ /**
101
+ * Writes one props object as JSON text with its keys in code-unit order. The
102
+ * text is assembled by hand, so no formatter or key sort can change its bytes.
103
+ */
104
+ function canonicalPropsText(props) {
105
+ const entries = Arr.sortWith(Rec.toEntries(props), ([key]) => key, Order.String);
106
+ const texts = Arr.map(entries, ([key, value]) => `${encodeJsonText(key)}:${canonicalValueText(value)}`);
107
+ return `{${Arr.join(texts, ",")}}`;
108
+ }
109
+ /** Writes one tree value as JSON text in the one canonical form. */
110
+ function canonicalValueText(value) {
111
+ if (isElement(value)) {
112
+ return canonicalElementText(value);
113
+ }
114
+ if (isList(value)) {
115
+ return `[${Arr.join(Arr.map(value, canonicalValueText), ",")}]`;
116
+ }
117
+ if (isProps(value)) {
118
+ return canonicalPropsText(value);
119
+ }
120
+ return encodeJsonText(value);
121
+ }
122
+ /** Writes one element as JSON text with its fields in the declared order. */
123
+ function canonicalElementText(element) {
124
+ const children = Arr.join(Arr.map(element.children, (child) => typeof child === "string"
125
+ ? encodeJsonText(child)
126
+ : canonicalElementText(child)), ",");
127
+ return `{"$node":"element","name":${encodeJsonText(element.name)},"props":${canonicalPropsText(element.props)},"children":[${children}]}`;
128
+ }
129
+ /** Serializes the tree as the exact JSON text that hashes and signatures cover. */
130
+ export function canonicalizeContentTree(tree) {
131
+ return canonicalElementText(tree);
132
+ }
133
+ /** Checks whether an element name is a renderer component, not the fragment or an intrinsic tag. */
134
+ function isComponentElementName(name) {
135
+ return (name !== FRAGMENT_NAME && !Schema.is(ContentTreeIntrinsicTagSchema)(name));
136
+ }
137
+ /** Collects the component names of one element and of every element nested beneath it. */
138
+ function componentNamesOfElement(element) {
139
+ const own = isComponentElementName(element.name) ? [element.name] : [];
140
+ return [
141
+ ...own,
142
+ ...Arr.flatMap(element.children, (child) => typeof child === "string" ? [] : componentNamesOfElement(child)),
143
+ ...Arr.flatMap(Rec.values(element.props), componentNamesOfValue),
144
+ ];
145
+ }
146
+ /** Collects the component names of one prop value, which may hold lists, objects, and elements. */
147
+ function componentNamesOfValue(value) {
148
+ if (isElement(value)) {
149
+ return componentNamesOfElement(value);
150
+ }
151
+ if (isList(value)) {
152
+ return Arr.flatMap(value, componentNamesOfValue);
153
+ }
154
+ if (isProps(value)) {
155
+ return Arr.flatMap(Rec.values(value), componentNamesOfValue);
156
+ }
157
+ return [];
158
+ }
159
+ /** Lists the renderer components that one tree uses, once each, in first-use order. */
160
+ export function contentTreeComponentNames(tree) {
161
+ return Arr.dedupe(componentNamesOfElement(tree));
162
+ }