@gnufoo/canaad 0.4.2 → 0.4.3

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.
Files changed (2) hide show
  1. package/meta.js +8 -2
  2. package/package.json +1 -2
package/meta.js CHANGED
@@ -1,5 +1,11 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ // AAD spec: tenant field capped at 256 UTF-8 bytes.
4
+ const TENANT_MAX_BYTES = 256;
5
+ // AAD spec: resource field capped at 1024 UTF-8 bytes.
6
+ const RESOURCE_MAX_BYTES = 1024;
7
+ const encoder = new TextEncoder();
8
+
3
9
  const extensionSchema = z.object({
4
10
  key: z.string().regex(/^x_[a-z]+_[a-z_]+$/),
5
11
  value: z.union([z.string(), z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER)]),
@@ -22,8 +28,8 @@ export const inputSchema = z.discriminatedUnion('action', [
22
28
  }),
23
29
  z.object({
24
30
  action: z.literal('build'),
25
- tenant: z.string().min(1).refine(s => new TextEncoder().encode(s).length <= 256, 'tenant exceeds 256 bytes'),
26
- resource: z.string().min(1).refine(s => new TextEncoder().encode(s).length <= 1024, 'resource exceeds 1024 bytes'),
31
+ tenant: z.string().min(1).refine(s => encoder.encode(s).length <= TENANT_MAX_BYTES, `tenant exceeds ${TENANT_MAX_BYTES} bytes`),
32
+ resource: z.string().min(1).refine(s => encoder.encode(s).length <= RESOURCE_MAX_BYTES, `resource exceeds ${RESOURCE_MAX_BYTES} bytes`),
27
33
  purpose: z.string().min(1),
28
34
  timestamp: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional(),
29
35
  extensions: z.array(extensionSchema).optional(),
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@gnufoo/canaad",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "type": "module",
5
- "main": "canaad_wasm.js",
6
5
  "types": "canaad_wasm.d.ts",
7
6
  "exports": {
8
7
  ".": {