@labelbox/rl-sdk 0.0.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.
Files changed (64) hide show
  1. package/README.md +90 -0
  2. package/dist/client-options.d.ts +39 -0
  3. package/dist/client-options.js +29 -0
  4. package/dist/generated/client/client.gen.d.ts +2 -0
  5. package/dist/generated/client/client.gen.js +216 -0
  6. package/dist/generated/client/index.d.ts +8 -0
  7. package/dist/generated/client/index.js +6 -0
  8. package/dist/generated/client/types.gen.d.ts +120 -0
  9. package/dist/generated/client/types.gen.js +2 -0
  10. package/dist/generated/client/utils.gen.d.ts +37 -0
  11. package/dist/generated/client/utils.gen.js +228 -0
  12. package/dist/generated/client.gen.d.ts +12 -0
  13. package/dist/generated/client.gen.js +3 -0
  14. package/dist/generated/core/auth.gen.d.ts +18 -0
  15. package/dist/generated/core/auth.gen.js +14 -0
  16. package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
  17. package/dist/generated/core/bodySerializer.gen.js +57 -0
  18. package/dist/generated/core/params.gen.d.ts +43 -0
  19. package/dist/generated/core/params.gen.js +100 -0
  20. package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
  21. package/dist/generated/core/pathSerializer.gen.js +106 -0
  22. package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
  23. package/dist/generated/core/queryKeySerializer.gen.js +92 -0
  24. package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
  25. package/dist/generated/core/serverSentEvents.gen.js +132 -0
  26. package/dist/generated/core/types.gen.d.ts +78 -0
  27. package/dist/generated/core/types.gen.js +2 -0
  28. package/dist/generated/core/utils.gen.d.ts +19 -0
  29. package/dist/generated/core/utils.gen.js +87 -0
  30. package/dist/generated/index.d.ts +2 -0
  31. package/dist/generated/index.js +2 -0
  32. package/dist/generated/sdk.gen.d.ts +3054 -0
  33. package/dist/generated/sdk.gen.js +5962 -0
  34. package/dist/generated/types.gen.d.ts +39711 -0
  35. package/dist/generated/types.gen.js +2 -0
  36. package/dist/index.d.ts +21 -0
  37. package/dist/index.js +39 -0
  38. package/dist/nesting.d.ts +18 -0
  39. package/dist/nesting.js +75 -0
  40. package/dist/reference/concepts-reference.generated.d.ts +9 -0
  41. package/dist/reference/concepts-reference.generated.js +356 -0
  42. package/dist/reference/concepts-schema.d.ts +16 -0
  43. package/dist/reference/concepts-schema.js +39 -0
  44. package/dist/reference/concepts.d.ts +15 -0
  45. package/dist/reference/concepts.js +354 -0
  46. package/dist/reference/domains.d.ts +65 -0
  47. package/dist/reference/domains.js +32 -0
  48. package/dist/reference/recipes-reference.generated.d.ts +11 -0
  49. package/dist/reference/recipes-reference.generated.js +11415 -0
  50. package/dist/reference/recipes-schema.d.ts +676 -0
  51. package/dist/reference/recipes-schema.js +406 -0
  52. package/dist/reference/resources-reference.generated.d.ts +11 -0
  53. package/dist/reference/resources-reference.generated.js +7174 -0
  54. package/dist/reference/resources-schema.d.ts +78 -0
  55. package/dist/reference/resources-schema.js +71 -0
  56. package/dist/reference/schema.d.ts +153 -0
  57. package/dist/reference/schema.js +151 -0
  58. package/dist/reference/sdk-reference.generated.d.ts +10 -0
  59. package/dist/reference/sdk-reference.generated.js +65703 -0
  60. package/dist/reference/tutorials.d.ts +76 -0
  61. package/dist/reference/tutorials.js +65 -0
  62. package/dist/session-events.d.ts +92 -0
  63. package/dist/session-events.js +213 -0
  64. package/package.json +126 -0
@@ -0,0 +1,78 @@
1
+ import { z } from 'zod';
2
+ export declare const ResourceFieldSchema: z.ZodObject<{
3
+ type: z.ZodString;
4
+ description: z.ZodOptional<z.ZodString>;
5
+ enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
6
+ itemEnum: z.ZodOptional<z.ZodArray<z.ZodString>>;
7
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
8
+ format: z.ZodOptional<z.ZodString>;
9
+ example: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
10
+ nullable: z.ZodOptional<z.ZodBoolean>;
11
+ minimum: z.ZodOptional<z.ZodNumber>;
12
+ maximum: z.ZodOptional<z.ZodNumber>;
13
+ exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
14
+ exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
15
+ minLength: z.ZodOptional<z.ZodNumber>;
16
+ maxLength: z.ZodOptional<z.ZodNumber>;
17
+ minItems: z.ZodOptional<z.ZodNumber>;
18
+ maxItems: z.ZodOptional<z.ZodNumber>;
19
+ pattern: z.ZodOptional<z.ZodString>;
20
+ fields: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<import("./schema.js").ShapeNode, unknown, z.core.$ZodTypeInternals<import("./schema.js").ShapeNode, unknown>>>>>;
21
+ items: z.ZodOptional<z.ZodLazy<z.ZodType<import("./schema.js").ShapeNode, unknown, z.core.$ZodTypeInternals<import("./schema.js").ShapeNode, unknown>>>>;
22
+ variants: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<import("./schema.js").ShapeNode, unknown, z.core.$ZodTypeInternals<import("./schema.js").ShapeNode, unknown>>>>>;
23
+ name: z.ZodString;
24
+ required: z.ZodBoolean;
25
+ }, z.core.$strict>;
26
+ export type ResourceField = z.infer<typeof ResourceFieldSchema>;
27
+ export type JsonValue = string | number | boolean | null | JsonValue[] | {
28
+ [key: string]: JsonValue;
29
+ };
30
+ export declare const JsonValueSchema: z.ZodType<JsonValue>;
31
+ export declare const ResourceRelationshipSchema: z.ZodObject<{
32
+ field: z.ZodString;
33
+ targetResource: z.ZodString;
34
+ }, z.core.$strict>;
35
+ export type ResourceRelationship = z.infer<typeof ResourceRelationshipSchema>;
36
+ export declare const ResourceReferenceEntrySchema: z.ZodObject<{
37
+ id: z.ZodString;
38
+ title: z.ZodString;
39
+ parent: z.ZodOptional<z.ZodString>;
40
+ order: z.ZodNumber;
41
+ domain: z.ZodOptional<z.ZodString>;
42
+ summary: z.ZodOptional<z.ZodString>;
43
+ description: z.ZodOptional<z.ZodString>;
44
+ object: z.ZodOptional<z.ZodObject<{
45
+ name: z.ZodString;
46
+ fields: z.ZodArray<z.ZodObject<{
47
+ type: z.ZodString;
48
+ description: z.ZodOptional<z.ZodString>;
49
+ enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
50
+ itemEnum: z.ZodOptional<z.ZodArray<z.ZodString>>;
51
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
52
+ format: z.ZodOptional<z.ZodString>;
53
+ example: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
54
+ nullable: z.ZodOptional<z.ZodBoolean>;
55
+ minimum: z.ZodOptional<z.ZodNumber>;
56
+ maximum: z.ZodOptional<z.ZodNumber>;
57
+ exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
58
+ exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
59
+ minLength: z.ZodOptional<z.ZodNumber>;
60
+ maxLength: z.ZodOptional<z.ZodNumber>;
61
+ minItems: z.ZodOptional<z.ZodNumber>;
62
+ maxItems: z.ZodOptional<z.ZodNumber>;
63
+ pattern: z.ZodOptional<z.ZodString>;
64
+ fields: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<import("./schema.js").ShapeNode, unknown, z.core.$ZodTypeInternals<import("./schema.js").ShapeNode, unknown>>>>>;
65
+ items: z.ZodOptional<z.ZodLazy<z.ZodType<import("./schema.js").ShapeNode, unknown, z.core.$ZodTypeInternals<import("./schema.js").ShapeNode, unknown>>>>;
66
+ variants: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<import("./schema.js").ShapeNode, unknown, z.core.$ZodTypeInternals<import("./schema.js").ShapeNode, unknown>>>>>;
67
+ name: z.ZodString;
68
+ required: z.ZodBoolean;
69
+ }, z.core.$strict>>;
70
+ sample: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
71
+ }, z.core.$strict>>;
72
+ operationIds: z.ZodArray<z.ZodString>;
73
+ relationships: z.ZodArray<z.ZodObject<{
74
+ field: z.ZodString;
75
+ targetResource: z.ZodString;
76
+ }, z.core.$strict>>;
77
+ }, z.core.$strict>;
78
+ export type ResourceReferenceEntry = z.infer<typeof ResourceReferenceEntrySchema>;
@@ -0,0 +1,71 @@
1
+ import { z } from 'zod';
2
+ import { NamedShapeNodeSchema } from './schema.js';
3
+ // One Explanation-layer "resource hub", keyed by resource id, produced from the
4
+ // backend OpenAPI spec by `yarn dx resources:generate` and rendered on the in-app
5
+ // Resources docs pages. A tag becomes a live resource by carrying `x-docs-resource`
6
+ // metadata (see `apps/recursion/api/src/openapi-config.ts`). Guardrail: every field here is
7
+ // either a checked reference into the spec or bounded editorial prose — never
8
+ // free-floating text — so the freshness check can prove it matches the spec.
9
+ // A field of a resource's detail-DTO object shape. A named shape node (no `in`
10
+ // location — object fields have no path/query/body site), so it carries the same
11
+ // recursive shape + constraint metadata as an SDK param or response field.
12
+ export const ResourceFieldSchema = NamedShapeNodeSchema;
13
+ export const JsonValueSchema = z.lazy(() => z.union([
14
+ z.string(),
15
+ z.number(),
16
+ z.boolean(),
17
+ z.null(),
18
+ z.array(JsonValueSchema),
19
+ z.record(z.string(), JsonValueSchema),
20
+ ]));
21
+ // A foreign-key edge from this resource's object to another live resource, derived
22
+ // from a `<base>Id` field whose `<base>` resolves to a resource's object DTO.
23
+ export const ResourceRelationshipSchema = z
24
+ .object({
25
+ // The `<base>Id` field on this resource's object that points to the target.
26
+ field: z.string(),
27
+ // The resource id (tag name) the edge points to.
28
+ targetResource: z.string(),
29
+ })
30
+ .strict();
31
+ export const ResourceReferenceEntrySchema = z
32
+ .object({
33
+ // Resource id — the OpenAPI tag name that carries `x-docs-resource`.
34
+ id: z.string(),
35
+ // Display title — the `title` override, else a title-cased id.
36
+ title: z.string(),
37
+ // Parent resource id for nav nesting (e.g. `problems` → `environments`).
38
+ parent: z.string().optional(),
39
+ // Sort order within the resource's nav level (ascending).
40
+ order: z.number(),
41
+ // Canonical product domain (a `DomainId` — see `./domains.ts`) this resource
42
+ // anchors. Optional: only curated resources carry one. Kept a plain string
43
+ // here; membership in `DOMAINS` is enforced fail-fast by `resources:generate`.
44
+ // Powers P2's cross-type domain hubs.
45
+ domain: z.string().optional(),
46
+ // One-line terse summary (tag `x-docs-resource.summary`) — nav label / CLI group help.
47
+ summary: z.string().optional(),
48
+ // The rich markdown intro — the tag `description`, promoted from the authored
49
+ // `apps/recursion/api/src/resource-intros/<id>.md` at spec-build time. Rendered as the hub intro.
50
+ description: z.string().optional(),
51
+ // The detail DTO (the `GET /:id` response) and its field shape. Absent for
52
+ // resources with no addressable detail DTO (sub-resources reached only via a
53
+ // collection or singleton endpoint) — their hub renders object-less.
54
+ object: z
55
+ .object({
56
+ // The DTO component name, e.g. `EnvironmentDto`.
57
+ name: z.string(),
58
+ fields: z.array(ResourceFieldSchema),
59
+ // The DTO's authored example — the whole-object `example` on its Zod schema
60
+ // (`.meta({ example })`), read straight off the spec at codegen time and
61
+ // rendered above Fields as a real, coherent copy-paste starting point.
62
+ sample: JsonValueSchema.optional(),
63
+ })
64
+ .strict()
65
+ .optional(),
66
+ // operationIds of the @SdkRoute operations tagged with this resource.
67
+ operationIds: z.array(z.string()),
68
+ // Foreign-key edges to other live resources.
69
+ relationships: z.array(ResourceRelationshipSchema),
70
+ })
71
+ .strict();
@@ -0,0 +1,153 @@
1
+ import { z } from 'zod';
2
+ export interface ShapeNode {
3
+ name?: string | undefined;
4
+ type: string;
5
+ required?: boolean | undefined;
6
+ description?: string | undefined;
7
+ enum?: string[] | undefined;
8
+ itemEnum?: string[] | undefined;
9
+ default?: string | number | boolean | undefined;
10
+ format?: string | undefined;
11
+ example?: string | number | boolean | undefined;
12
+ nullable?: boolean | undefined;
13
+ minimum?: number | undefined;
14
+ maximum?: number | undefined;
15
+ exclusiveMinimum?: number | undefined;
16
+ exclusiveMaximum?: number | undefined;
17
+ minLength?: number | undefined;
18
+ maxLength?: number | undefined;
19
+ minItems?: number | undefined;
20
+ maxItems?: number | undefined;
21
+ pattern?: string | undefined;
22
+ fields?: ShapeNode[] | undefined;
23
+ items?: ShapeNode | undefined;
24
+ variants?: ShapeNode[] | undefined;
25
+ }
26
+ export declare const ShapeNodeSchema: z.ZodType<ShapeNode>;
27
+ /**
28
+ * The metadata / constraint keys a `ShapeNode` carries beyond its structural
29
+ * identity (`name`/`type`/`required`), its `description`, and its sub-shape
30
+ * (`fields`/`items`/`variants`). Derived from `ShapeNode`, so adding a constraint
31
+ * field to the interface automatically widens this union. The in-app docs
32
+ * renderer uses the union to require a label for every metadata key.
33
+ */
34
+ export type ShapeMetaKey = Exclude<keyof ShapeNode, 'name' | 'type' | 'required' | 'description' | 'fields' | 'items' | 'variants'>;
35
+ /**
36
+ * A node's present metadata as ordered `[key, value]` pairs for the in-app docs
37
+ * renderer. Value normalization lives here: `enum`/`itemEnum` stay arrays for the
38
+ * consumer to join, the exclusive bounds carry their `>`/`<` prefix, `nullable`
39
+ * is the bare flag, and every other present key is its raw scalar. Absent keys
40
+ * (and a `false` `nullable`) are omitted.
41
+ */
42
+ export declare function shapeMetaEntries(node: ShapeNode): Array<readonly [ShapeMetaKey, string | number | boolean | readonly string[]]>;
43
+ export declare const NamedShapeNodeSchema: z.ZodObject<{
44
+ type: z.ZodString;
45
+ description: z.ZodOptional<z.ZodString>;
46
+ enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
47
+ itemEnum: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
49
+ format: z.ZodOptional<z.ZodString>;
50
+ example: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
51
+ nullable: z.ZodOptional<z.ZodBoolean>;
52
+ minimum: z.ZodOptional<z.ZodNumber>;
53
+ maximum: z.ZodOptional<z.ZodNumber>;
54
+ exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
55
+ exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
56
+ minLength: z.ZodOptional<z.ZodNumber>;
57
+ maxLength: z.ZodOptional<z.ZodNumber>;
58
+ minItems: z.ZodOptional<z.ZodNumber>;
59
+ maxItems: z.ZodOptional<z.ZodNumber>;
60
+ pattern: z.ZodOptional<z.ZodString>;
61
+ fields: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<ShapeNode, unknown, z.core.$ZodTypeInternals<ShapeNode, unknown>>>>>;
62
+ items: z.ZodOptional<z.ZodLazy<z.ZodType<ShapeNode, unknown, z.core.$ZodTypeInternals<ShapeNode, unknown>>>>;
63
+ variants: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<ShapeNode, unknown, z.core.$ZodTypeInternals<ShapeNode, unknown>>>>>;
64
+ name: z.ZodString;
65
+ required: z.ZodBoolean;
66
+ }, z.core.$strict>;
67
+ export type NamedShapeNode = z.infer<typeof NamedShapeNodeSchema>;
68
+ export declare const SdkParamSchema: z.ZodObject<{
69
+ type: z.ZodString;
70
+ description: z.ZodOptional<z.ZodString>;
71
+ enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
+ itemEnum: z.ZodOptional<z.ZodArray<z.ZodString>>;
73
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
74
+ format: z.ZodOptional<z.ZodString>;
75
+ example: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
76
+ nullable: z.ZodOptional<z.ZodBoolean>;
77
+ minimum: z.ZodOptional<z.ZodNumber>;
78
+ maximum: z.ZodOptional<z.ZodNumber>;
79
+ exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
80
+ exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
81
+ minLength: z.ZodOptional<z.ZodNumber>;
82
+ maxLength: z.ZodOptional<z.ZodNumber>;
83
+ minItems: z.ZodOptional<z.ZodNumber>;
84
+ maxItems: z.ZodOptional<z.ZodNumber>;
85
+ pattern: z.ZodOptional<z.ZodString>;
86
+ fields: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<ShapeNode, unknown, z.core.$ZodTypeInternals<ShapeNode, unknown>>>>>;
87
+ items: z.ZodOptional<z.ZodLazy<z.ZodType<ShapeNode, unknown, z.core.$ZodTypeInternals<ShapeNode, unknown>>>>;
88
+ variants: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<ShapeNode, unknown, z.core.$ZodTypeInternals<ShapeNode, unknown>>>>>;
89
+ name: z.ZodString;
90
+ required: z.ZodBoolean;
91
+ in: z.ZodEnum<{
92
+ query: "query";
93
+ body: "body";
94
+ path: "path";
95
+ }>;
96
+ }, z.core.$strict>;
97
+ export type SdkParam = z.infer<typeof SdkParamSchema>;
98
+ export declare const SdkReferenceEntrySchema: z.ZodObject<{
99
+ operationId: z.ZodString;
100
+ tag: z.ZodString;
101
+ callPath: z.ZodArray<z.ZodString>;
102
+ namespace: z.ZodString;
103
+ method: z.ZodString;
104
+ bodyKey: z.ZodOptional<z.ZodString>;
105
+ signature: z.ZodString;
106
+ example: z.ZodString;
107
+ cliInvocation: z.ZodString;
108
+ cliExample: z.ZodString;
109
+ curlExample: z.ZodString;
110
+ summary: z.ZodString;
111
+ description: z.ZodOptional<z.ZodString>;
112
+ httpMethod: z.ZodEnum<{
113
+ delete: "delete";
114
+ get: "get";
115
+ patch: "patch";
116
+ post: "post";
117
+ put: "put";
118
+ }>;
119
+ path: z.ZodString;
120
+ requiredPermissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
121
+ params: z.ZodArray<z.ZodObject<{
122
+ type: z.ZodString;
123
+ description: z.ZodOptional<z.ZodString>;
124
+ enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
125
+ itemEnum: z.ZodOptional<z.ZodArray<z.ZodString>>;
126
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
127
+ format: z.ZodOptional<z.ZodString>;
128
+ example: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
129
+ nullable: z.ZodOptional<z.ZodBoolean>;
130
+ minimum: z.ZodOptional<z.ZodNumber>;
131
+ maximum: z.ZodOptional<z.ZodNumber>;
132
+ exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
133
+ exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
134
+ minLength: z.ZodOptional<z.ZodNumber>;
135
+ maxLength: z.ZodOptional<z.ZodNumber>;
136
+ minItems: z.ZodOptional<z.ZodNumber>;
137
+ maxItems: z.ZodOptional<z.ZodNumber>;
138
+ pattern: z.ZodOptional<z.ZodString>;
139
+ fields: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<ShapeNode, unknown, z.core.$ZodTypeInternals<ShapeNode, unknown>>>>>;
140
+ items: z.ZodOptional<z.ZodLazy<z.ZodType<ShapeNode, unknown, z.core.$ZodTypeInternals<ShapeNode, unknown>>>>;
141
+ variants: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<ShapeNode, unknown, z.core.$ZodTypeInternals<ShapeNode, unknown>>>>>;
142
+ name: z.ZodString;
143
+ required: z.ZodBoolean;
144
+ in: z.ZodEnum<{
145
+ query: "query";
146
+ body: "body";
147
+ path: "path";
148
+ }>;
149
+ }, z.core.$strict>>;
150
+ response: z.ZodOptional<z.ZodType<ShapeNode, unknown, z.core.$ZodTypeInternals<ShapeNode, unknown>>>;
151
+ responseMediaType: z.ZodOptional<z.ZodString>;
152
+ }, z.core.$strict>;
153
+ export type SdkReferenceEntry = z.infer<typeof SdkReferenceEntrySchema>;
@@ -0,0 +1,151 @@
1
+ import { z } from 'zod';
2
+ // A scalar leaf value — the type of an authored `default` / `example`.
3
+ const ScalarValueSchema = z.union([z.string(), z.number(), z.boolean()]);
4
+ // The recursive object schema. Recursive fields use `z.lazy` to defer to the
5
+ // exported alias below; `.strict()` rejects unknown keys at every level.
6
+ const ShapeNodeObjectSchema = z
7
+ .object({
8
+ name: z.string().optional(),
9
+ type: z.string(),
10
+ required: z.boolean().optional(),
11
+ description: z.string().optional(),
12
+ enum: z.array(z.string()).optional(),
13
+ itemEnum: z.array(z.string()).optional(),
14
+ default: ScalarValueSchema.optional(),
15
+ format: z.string().optional(),
16
+ example: ScalarValueSchema.optional(),
17
+ nullable: z.boolean().optional(),
18
+ minimum: z.number().optional(),
19
+ maximum: z.number().optional(),
20
+ exclusiveMinimum: z.number().optional(),
21
+ exclusiveMaximum: z.number().optional(),
22
+ minLength: z.number().optional(),
23
+ maxLength: z.number().optional(),
24
+ minItems: z.number().optional(),
25
+ maxItems: z.number().optional(),
26
+ pattern: z.string().optional(),
27
+ fields: z.array(z.lazy(() => ShapeNodeSchema)).optional(),
28
+ items: z.lazy(() => ShapeNodeSchema).optional(),
29
+ variants: z.array(z.lazy(() => ShapeNodeSchema)).optional(),
30
+ })
31
+ .strict();
32
+ export const ShapeNodeSchema = ShapeNodeObjectSchema;
33
+ function shapeMetaKeys(values) {
34
+ return values;
35
+ }
36
+ // Canonical render order for SDK reference metadata consumed by the in-app docs.
37
+ // The helper requires every ShapeMetaKey exactly once and rejects extra keys, so
38
+ // adding metadata fails here until it is deliberately placed in the order.
39
+ const SHAPE_META_KEYS = shapeMetaKeys([
40
+ 'enum',
41
+ 'itemEnum',
42
+ 'default',
43
+ 'format',
44
+ 'example',
45
+ 'minimum',
46
+ 'exclusiveMinimum',
47
+ 'maximum',
48
+ 'exclusiveMaximum',
49
+ 'minLength',
50
+ 'maxLength',
51
+ 'minItems',
52
+ 'maxItems',
53
+ 'pattern',
54
+ 'nullable',
55
+ ]);
56
+ /**
57
+ * A node's present metadata as ordered `[key, value]` pairs for the in-app docs
58
+ * renderer. Value normalization lives here: `enum`/`itemEnum` stay arrays for the
59
+ * consumer to join, the exclusive bounds carry their `>`/`<` prefix, `nullable`
60
+ * is the bare flag, and every other present key is its raw scalar. Absent keys
61
+ * (and a `false` `nullable`) are omitted.
62
+ */
63
+ export function shapeMetaEntries(node) {
64
+ const entries = [];
65
+ for (const key of SHAPE_META_KEYS) {
66
+ const value = node[key];
67
+ if (value === undefined)
68
+ continue;
69
+ if (key === 'enum' || key === 'itemEnum') {
70
+ if (Array.isArray(value) && value.length > 0)
71
+ entries.push([key, value]);
72
+ }
73
+ else if (key === 'nullable') {
74
+ if (value === true)
75
+ entries.push([key, true]);
76
+ }
77
+ else if (key === 'exclusiveMinimum') {
78
+ entries.push([key, `>${value}`]);
79
+ }
80
+ else if (key === 'exclusiveMaximum') {
81
+ entries.push([key, `<${value}`]);
82
+ }
83
+ else {
84
+ entries.push([key, value]);
85
+ }
86
+ }
87
+ return entries;
88
+ }
89
+ // A named shape node: a field/param guaranteed to carry a `name` + `required`
90
+ // flag. The top-level params, response fields, and resource object fields are
91
+ // all named; only nested array items / union variants are anonymous.
92
+ export const NamedShapeNodeSchema = ShapeNodeObjectSchema.extend({
93
+ name: z.string(),
94
+ required: z.boolean(),
95
+ });
96
+ // One method-parameter in the generated TypeScript SDK reference, keyed by
97
+ // operationId. Produced from the backend OpenAPI spec by `yarn dx sdk:generate`
98
+ // and rendered on the in-app API docs pages. The namespace + method match the
99
+ // real generated surface (`rl.<namespace>.<method>(...)`). A named shape node
100
+ // plus its HTTP location.
101
+ export const SdkParamSchema = NamedShapeNodeSchema.extend({
102
+ in: z.enum(['path', 'query', 'body']),
103
+ });
104
+ export const SdkReferenceEntrySchema = z
105
+ .object({
106
+ operationId: z.string(),
107
+ // OpenAPI tag — groups the operation in the API docs nav and deep-links it
108
+ // into the Swagger reference (`#/<tag>/<operationId>`).
109
+ tag: z.string(),
110
+ // Canonical call path — the segments of `rl.<…>.<leaf>(...)`. The TS SDK
111
+ // joins it with dots, the CLI with spaces. `namespace`/`method` are the
112
+ // first/last segments, kept for the docs renderer.
113
+ callPath: z.array(z.string()).min(1),
114
+ namespace: z.string(),
115
+ method: z.string(),
116
+ // The flat-call key the request body is passed under (`body`); absent for
117
+ // operations with no body.
118
+ bodyKey: z.string().optional(),
119
+ // TypeScript SDK: the call signature + a runnable example.
120
+ signature: z.string(),
121
+ example: z.string(),
122
+ // CLI: the `rl <noun> <verb>` invocation + a runnable example command.
123
+ cliInvocation: z.string(),
124
+ cliExample: z.string(),
125
+ // cURL: a runnable request against the public API.
126
+ curlExample: z.string(),
127
+ summary: z.string(),
128
+ description: z.string().optional(),
129
+ httpMethod: z.enum(['get', 'post', 'put', 'patch', 'delete']),
130
+ path: z.string(),
131
+ // The permissions the caller must hold to invoke this operation, lifted from
132
+ // the handler's `@RequirePermissions(...)` via the `x-required-permissions`
133
+ // spec extension. Absent for operations with no permission requirement (which
134
+ // are therefore never gated). The live CLI uses these to mark commands the
135
+ // caller can't run against their `/me/permissions` set.
136
+ requiredPermissions: z.array(z.string()).optional(),
137
+ params: z.array(SdkParamSchema),
138
+ // The full success (2xx) JSON response shape — an object (its `fields`), an
139
+ // array (its `items`), a scalar, or a union — carrying the same recursive
140
+ // metadata as the request params. Absent for void responses (no documented
141
+ // 2xx body). Rendered as the docs/CLI "Response" section, and the recipe
142
+ // composition validator reads `response.fields` to check a step can only
143
+ // capture a field the producing operation actually returns.
144
+ response: ShapeNodeSchema.optional(),
145
+ // The success body's media type when it is NOT application/json (e.g.
146
+ // 'text/plain' for the transcript download). Absent for JSON and void
147
+ // responses. The shell composer reads it to capture the raw body instead
148
+ // of piping non-JSON through jq.
149
+ responseMediaType: z.string().optional(),
150
+ })
151
+ .strict();
@@ -0,0 +1,10 @@
1
+ /**
2
+ * AUTO-GENERATED by 'yarn dx sdk:generate'.
3
+ * Do not edit manually — changes will be overwritten.
4
+ *
5
+ * TypeScript SDK reference, keyed by operationId. Derived from the backend
6
+ * OpenAPI spec: only operations opted in via @SdkRoute are included, each
7
+ * placed at its declared x-sdk-path so the docs match the generated client.
8
+ */
9
+ import type { SdkReferenceEntry } from './schema.js';
10
+ export declare const SDK_REFERENCE: Record<string, SdkReferenceEntry>;