@arrirpc/codegen-utils 0.60.1 → 0.60.2

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/codegen-utils",
3
- "version": "0.60.1",
3
+ "version": "0.60.2",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "joshmossas",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "scule": "^1.3.0",
26
- "jtd-utils": "0.60.1",
27
- "@arrirpc/schema": "0.60.1"
28
- }
26
+ "jtd-utils": "0.60.2"
27
+ },
28
+ "devDependencies": {}
29
29
  }
@@ -1,241 +0,0 @@
1
- 'use strict';
2
-
3
- const schema = require('@arrirpc/schema');
4
-
5
- const TestUserSettingsSchema = schema.a.object("UserSettings", {
6
- notificationsEnabled: schema.a.boolean(),
7
- preferredTheme: schema.a.stringEnum(["dark-mode", "light-mode", "system"], {
8
- isDeprecated: true
9
- })
10
- });
11
- const TestUserPhotoSchema = schema.a.object(
12
- {
13
- url: schema.a.string(),
14
- width: schema.a.number(),
15
- height: schema.a.number(),
16
- bytes: schema.a.int64(),
17
- nanoseconds: schema.a.uint64({
18
- description: "When the photo was last updated in nanoseconds"
19
- })
20
- },
21
- { id: "UserPhoto", description: "A profile picture" }
22
- );
23
- const TestUserNotificationSchema = schema.a.discriminator(
24
- "UserNotification",
25
- "notificationType",
26
- {
27
- POST_LIKE: schema.a.object({
28
- postId: schema.a.string(),
29
- userId: schema.a.string()
30
- }),
31
- POST_COMMENT: schema.a.object({
32
- postId: schema.a.string(),
33
- userId: schema.a.string(),
34
- commentText: schema.a.string()
35
- })
36
- }
37
- );
38
- const TestUserSchema = schema.a.object("User", {
39
- id: schema.a.string(),
40
- role: schema.a.stringEnum(["standard", "admin"]),
41
- photo: schema.a.nullable(TestUserPhotoSchema),
42
- createdAt: schema.a.timestamp(),
43
- numFollowers: schema.a.int32(),
44
- settings: TestUserSettingsSchema,
45
- lastNotification: schema.a.nullable(TestUserNotificationSchema),
46
- recentNotifications: schema.a.array(TestUserNotificationSchema),
47
- bookmarks: schema.a.record(schema.a.object({ postId: schema.a.string(), userId: schema.a.string() })),
48
- bio: schema.a.optional(schema.a.string()),
49
- metadata: schema.a.record(schema.a.any()),
50
- randomList: schema.a.array(schema.a.any()),
51
- binaryTree: schema.a.recursive(
52
- (self) => schema.a.object({
53
- left: schema.a.nullable(self),
54
- right: schema.a.nullable(self)
55
- }),
56
- { id: "BinaryTree" }
57
- )
58
- });
59
- const TestUserParams = schema.a.object("UserParams", {
60
- userId: schema.a.string()
61
- });
62
- const TestUpdateUserParams = schema.a.pick(
63
- TestUserSchema,
64
- ["id", "bio", "photo"],
65
- {
66
- id: "UpdateUserParams"
67
- }
68
- );
69
- const TestAppDefinition = {
70
- schemaVersion: "0.0.7",
71
- info: {
72
- title: "Test App Client",
73
- description: "This is a example app definition",
74
- version: "11"
75
- },
76
- procedures: {
77
- getStatus: {
78
- transport: "http",
79
- path: "/status",
80
- method: "get",
81
- params: void 0,
82
- response: "GetStatusResponse"
83
- },
84
- "users.getUser": {
85
- transport: "http",
86
- path: "/users/get-user",
87
- method: "get",
88
- params: "UserParams",
89
- response: "User",
90
- description: "Get a user by id"
91
- },
92
- "users.updateUser": {
93
- transport: "http",
94
- path: "/users/update-user",
95
- method: "post",
96
- params: "UpdateUserParams",
97
- response: "User",
98
- description: "Update a user"
99
- },
100
- "users.watchUser": {
101
- transport: "http",
102
- path: "/users/watch-user",
103
- method: "get",
104
- params: "UserParams",
105
- response: "User",
106
- isEventStream: true,
107
- description: "Watch a user"
108
- },
109
- "users.createConnection": {
110
- transport: "ws",
111
- path: "/users/create-connection",
112
- params: "UserParams",
113
- response: "User"
114
- },
115
- "users.settings.getUserSettings": {
116
- transport: "http",
117
- path: "/users/settings/get-user-settings",
118
- method: "get",
119
- params: void 0,
120
- response: void 0,
121
- isDeprecated: true
122
- }
123
- },
124
- definitions: {
125
- GetStatusResponse: schema.a.object({
126
- message: schema.a.string()
127
- }),
128
- User: TestUserSchema,
129
- UserParams: TestUserParams,
130
- UpdateUserParams: TestUpdateUserParams
131
- }
132
- };
133
- const ExampleEnum = schema.a.enumerator(["FOO", "BAR", "BAZ"], { id: "ExampleEnum" });
134
- const ExampleObject = schema.a.object(
135
- {
136
- id: schema.a.string(),
137
- content: schema.a.string()
138
- },
139
- {
140
- id: "ExampleObject"
141
- }
142
- );
143
- const ExamplePayload = schema.a.object(
144
- {
145
- string: schema.a.string(),
146
- boolean: schema.a.boolean(),
147
- timestamp: schema.a.timestamp(),
148
- float32: schema.a.float32(),
149
- float64: schema.a.float64(),
150
- int8: schema.a.int8(),
151
- uint8: schema.a.uint8(),
152
- int16: schema.a.int16(),
153
- uint16: schema.a.uint16(),
154
- int32: schema.a.int32(),
155
- uint32: schema.a.uint32(),
156
- int64: schema.a.int64(),
157
- uint64: schema.a.uint64(),
158
- enum: ExampleEnum,
159
- object: ExampleObject,
160
- array: schema.a.array(schema.a.boolean()),
161
- record: schema.a.record(schema.a.boolean()),
162
- any: schema.a.any()
163
- },
164
- {
165
- id: "ExamplePayload"
166
- }
167
- );
168
- const ExamplePayloadNullable = schema.a.object(
169
- {
170
- string: schema.a.nullable(schema.a.string()),
171
- boolean: schema.a.nullable(schema.a.boolean()),
172
- timestamp: schema.a.nullable(schema.a.timestamp()),
173
- float32: schema.a.nullable(schema.a.float32()),
174
- float64: schema.a.nullable(schema.a.float64()),
175
- int8: schema.a.nullable(schema.a.int8()),
176
- uint8: schema.a.nullable(schema.a.uint8()),
177
- int16: schema.a.nullable(schema.a.int16()),
178
- uint16: schema.a.nullable(schema.a.uint16()),
179
- int32: schema.a.nullable(schema.a.int32()),
180
- uint32: schema.a.nullable(schema.a.uint32()),
181
- int64: schema.a.nullable(schema.a.int64()),
182
- uint64: schema.a.nullable(schema.a.uint64()),
183
- enum: schema.a.nullable(ExampleEnum),
184
- object: ExampleObject,
185
- array: schema.a.nullable(schema.a.array(schema.a.boolean())),
186
- record: schema.a.nullable(schema.a.record(schema.a.boolean())),
187
- any: schema.a.nullable(schema.a.any())
188
- },
189
- {
190
- id: "ExamplePayloadNullable"
191
- }
192
- );
193
- const ExampleDiscriminator = schema.a.discriminator(
194
- "typeName",
195
- {
196
- A: schema.a.object({
197
- id: schema.a.string()
198
- }),
199
- B: schema.a.object({
200
- id: schema.a.string(),
201
- name: schema.a.string()
202
- }),
203
- C: schema.a.object({
204
- id: schema.a.string(),
205
- name: schema.a.string(),
206
- date: schema.a.timestamp()
207
- })
208
- },
209
- {
210
- id: "ExampleDiscriminator"
211
- }
212
- );
213
- const ExampleRecursive = schema.a.recursive(
214
- (self) => schema.a.object({
215
- left: schema.a.nullable(self),
216
- right: schema.a.nullable(self)
217
- }),
218
- { id: "ExampleRecursive" }
219
- );
220
- const ReferenceAppDefinition = {
221
- schemaVersion: "0.0.7",
222
- procedures: {},
223
- definitions: {
224
- ExamplePayload,
225
- ExamplePayloadNullable,
226
- ExampleDiscriminator,
227
- BinaryTree: ExampleRecursive
228
- }
229
- };
230
-
231
- exports.ExampleDiscriminator = ExampleDiscriminator;
232
- exports.ExamplePayloadNullable = ExamplePayloadNullable;
233
- exports.ExampleRecursive = ExampleRecursive;
234
- exports.ReferenceAppDefinition = ReferenceAppDefinition;
235
- exports.TestAppDefinition = TestAppDefinition;
236
- exports.TestUpdateUserParams = TestUpdateUserParams;
237
- exports.TestUserNotificationSchema = TestUserNotificationSchema;
238
- exports.TestUserParams = TestUserParams;
239
- exports.TestUserPhotoSchema = TestUserPhotoSchema;
240
- exports.TestUserSchema = TestUserSchema;
241
- exports.TestUserSettingsSchema = TestUserSettingsSchema;
@@ -1,168 +0,0 @@
1
- import * as _arrirpc_schema from '@arrirpc/schema';
2
- import { AppDefinition } from './index.cjs';
3
- import 'jtd-utils';
4
- import 'scule';
5
-
6
- declare const TestUserSettingsSchema: _arrirpc_schema.AObjectSchema<{
7
- notificationsEnabled: boolean;
8
- preferredTheme: "dark-mode" | "light-mode" | "system";
9
- }, false>;
10
- declare const TestUserPhotoSchema: _arrirpc_schema.AObjectSchema<{
11
- url: string;
12
- width: number;
13
- height: number;
14
- bytes: bigint;
15
- nanoseconds: bigint;
16
- }, false>;
17
- declare const TestUserNotificationSchema: _arrirpc_schema.ADiscriminatorSchema<{
18
- postId: string;
19
- userId: string;
20
- notificationType: "POST_LIKE";
21
- } | {
22
- postId: string;
23
- userId: string;
24
- commentText: string;
25
- notificationType: "POST_COMMENT";
26
- }>;
27
- interface BinaryTree {
28
- left: BinaryTree | null;
29
- right: BinaryTree | null;
30
- }
31
- declare const TestUserSchema: _arrirpc_schema.AObjectSchema<{
32
- id: string;
33
- role: "standard" | "admin";
34
- photo: {
35
- url: string;
36
- width: number;
37
- height: number;
38
- bytes: bigint;
39
- nanoseconds: bigint;
40
- } | null;
41
- createdAt: Date;
42
- numFollowers: number;
43
- settings: {
44
- notificationsEnabled: boolean;
45
- preferredTheme: "dark-mode" | "light-mode" | "system";
46
- };
47
- lastNotification: {
48
- postId: string;
49
- userId: string;
50
- notificationType: "POST_LIKE";
51
- } | {
52
- postId: string;
53
- userId: string;
54
- commentText: string;
55
- notificationType: "POST_COMMENT";
56
- } | null;
57
- recentNotifications: ({
58
- postId: string;
59
- userId: string;
60
- notificationType: "POST_LIKE";
61
- } | {
62
- postId: string;
63
- userId: string;
64
- commentText: string;
65
- notificationType: "POST_COMMENT";
66
- })[];
67
- bookmarks: Record<string, {
68
- postId: string;
69
- userId: string;
70
- }>;
71
- bio: string | undefined;
72
- metadata: Record<string, any>;
73
- randomList: any[];
74
- binaryTree: BinaryTree;
75
- }, false>;
76
- declare const TestUserParams: _arrirpc_schema.AObjectSchema<{
77
- userId: string;
78
- }, false>;
79
- declare const TestUpdateUserParams: _arrirpc_schema.AObjectSchema<Pick<{
80
- id: string;
81
- role: "standard" | "admin";
82
- photo: {
83
- url: string;
84
- width: number;
85
- height: number;
86
- bytes: bigint;
87
- nanoseconds: bigint;
88
- } | null;
89
- createdAt: Date;
90
- numFollowers: number;
91
- settings: {
92
- notificationsEnabled: boolean;
93
- preferredTheme: "dark-mode" | "light-mode" | "system";
94
- };
95
- lastNotification: {
96
- postId: string;
97
- userId: string;
98
- notificationType: "POST_LIKE";
99
- } | {
100
- postId: string;
101
- userId: string;
102
- commentText: string;
103
- notificationType: "POST_COMMENT";
104
- } | null;
105
- recentNotifications: ({
106
- postId: string;
107
- userId: string;
108
- notificationType: "POST_LIKE";
109
- } | {
110
- postId: string;
111
- userId: string;
112
- commentText: string;
113
- notificationType: "POST_COMMENT";
114
- })[];
115
- bookmarks: Record<string, {
116
- postId: string;
117
- userId: string;
118
- }>;
119
- bio: string | undefined;
120
- metadata: Record<string, any>;
121
- randomList: any[];
122
- binaryTree: BinaryTree;
123
- }, "id" | "photo" | "bio">, false>;
124
- declare const TestAppDefinition: AppDefinition;
125
- declare const ExamplePayloadNullable: _arrirpc_schema.AObjectSchema<{
126
- string: string | null;
127
- boolean: boolean | null;
128
- timestamp: Date | null;
129
- float32: number | null;
130
- float64: number | null;
131
- int8: number | null;
132
- uint8: number | null;
133
- int16: number | null;
134
- uint16: number | null;
135
- int32: number | null;
136
- uint32: number | null;
137
- int64: bigint | null;
138
- uint64: bigint | null;
139
- enum: "FOO" | "BAR" | "BAZ" | null;
140
- object: {
141
- id: string;
142
- content: string;
143
- };
144
- array: boolean[] | null;
145
- record: Record<string, boolean> | null;
146
- any: any;
147
- }, false>;
148
- declare const ExampleDiscriminator: _arrirpc_schema.ADiscriminatorSchema<{
149
- id: string;
150
- typeName: "A";
151
- } | {
152
- id: string;
153
- name: string;
154
- typeName: "B";
155
- } | {
156
- id: string;
157
- name: string;
158
- date: Date;
159
- typeName: "C";
160
- }>;
161
- interface ExampleRecursive {
162
- left: ExampleRecursive | null;
163
- right: ExampleRecursive | null;
164
- }
165
- declare const ExampleRecursive: _arrirpc_schema.AObjectSchema<ExampleRecursive, false> | _arrirpc_schema.ADiscriminatorSchema<ExampleRecursive>;
166
- declare const ReferenceAppDefinition: AppDefinition;
167
-
168
- export { ExampleDiscriminator, ExamplePayloadNullable, ExampleRecursive, ReferenceAppDefinition, TestAppDefinition, TestUpdateUserParams, TestUserNotificationSchema, TestUserParams, TestUserPhotoSchema, TestUserSchema, TestUserSettingsSchema };
@@ -1,168 +0,0 @@
1
- import * as _arrirpc_schema from '@arrirpc/schema';
2
- import { AppDefinition } from './index.mjs';
3
- import 'jtd-utils';
4
- import 'scule';
5
-
6
- declare const TestUserSettingsSchema: _arrirpc_schema.AObjectSchema<{
7
- notificationsEnabled: boolean;
8
- preferredTheme: "dark-mode" | "light-mode" | "system";
9
- }, false>;
10
- declare const TestUserPhotoSchema: _arrirpc_schema.AObjectSchema<{
11
- url: string;
12
- width: number;
13
- height: number;
14
- bytes: bigint;
15
- nanoseconds: bigint;
16
- }, false>;
17
- declare const TestUserNotificationSchema: _arrirpc_schema.ADiscriminatorSchema<{
18
- postId: string;
19
- userId: string;
20
- notificationType: "POST_LIKE";
21
- } | {
22
- postId: string;
23
- userId: string;
24
- commentText: string;
25
- notificationType: "POST_COMMENT";
26
- }>;
27
- interface BinaryTree {
28
- left: BinaryTree | null;
29
- right: BinaryTree | null;
30
- }
31
- declare const TestUserSchema: _arrirpc_schema.AObjectSchema<{
32
- id: string;
33
- role: "standard" | "admin";
34
- photo: {
35
- url: string;
36
- width: number;
37
- height: number;
38
- bytes: bigint;
39
- nanoseconds: bigint;
40
- } | null;
41
- createdAt: Date;
42
- numFollowers: number;
43
- settings: {
44
- notificationsEnabled: boolean;
45
- preferredTheme: "dark-mode" | "light-mode" | "system";
46
- };
47
- lastNotification: {
48
- postId: string;
49
- userId: string;
50
- notificationType: "POST_LIKE";
51
- } | {
52
- postId: string;
53
- userId: string;
54
- commentText: string;
55
- notificationType: "POST_COMMENT";
56
- } | null;
57
- recentNotifications: ({
58
- postId: string;
59
- userId: string;
60
- notificationType: "POST_LIKE";
61
- } | {
62
- postId: string;
63
- userId: string;
64
- commentText: string;
65
- notificationType: "POST_COMMENT";
66
- })[];
67
- bookmarks: Record<string, {
68
- postId: string;
69
- userId: string;
70
- }>;
71
- bio: string | undefined;
72
- metadata: Record<string, any>;
73
- randomList: any[];
74
- binaryTree: BinaryTree;
75
- }, false>;
76
- declare const TestUserParams: _arrirpc_schema.AObjectSchema<{
77
- userId: string;
78
- }, false>;
79
- declare const TestUpdateUserParams: _arrirpc_schema.AObjectSchema<Pick<{
80
- id: string;
81
- role: "standard" | "admin";
82
- photo: {
83
- url: string;
84
- width: number;
85
- height: number;
86
- bytes: bigint;
87
- nanoseconds: bigint;
88
- } | null;
89
- createdAt: Date;
90
- numFollowers: number;
91
- settings: {
92
- notificationsEnabled: boolean;
93
- preferredTheme: "dark-mode" | "light-mode" | "system";
94
- };
95
- lastNotification: {
96
- postId: string;
97
- userId: string;
98
- notificationType: "POST_LIKE";
99
- } | {
100
- postId: string;
101
- userId: string;
102
- commentText: string;
103
- notificationType: "POST_COMMENT";
104
- } | null;
105
- recentNotifications: ({
106
- postId: string;
107
- userId: string;
108
- notificationType: "POST_LIKE";
109
- } | {
110
- postId: string;
111
- userId: string;
112
- commentText: string;
113
- notificationType: "POST_COMMENT";
114
- })[];
115
- bookmarks: Record<string, {
116
- postId: string;
117
- userId: string;
118
- }>;
119
- bio: string | undefined;
120
- metadata: Record<string, any>;
121
- randomList: any[];
122
- binaryTree: BinaryTree;
123
- }, "id" | "photo" | "bio">, false>;
124
- declare const TestAppDefinition: AppDefinition;
125
- declare const ExamplePayloadNullable: _arrirpc_schema.AObjectSchema<{
126
- string: string | null;
127
- boolean: boolean | null;
128
- timestamp: Date | null;
129
- float32: number | null;
130
- float64: number | null;
131
- int8: number | null;
132
- uint8: number | null;
133
- int16: number | null;
134
- uint16: number | null;
135
- int32: number | null;
136
- uint32: number | null;
137
- int64: bigint | null;
138
- uint64: bigint | null;
139
- enum: "FOO" | "BAR" | "BAZ" | null;
140
- object: {
141
- id: string;
142
- content: string;
143
- };
144
- array: boolean[] | null;
145
- record: Record<string, boolean> | null;
146
- any: any;
147
- }, false>;
148
- declare const ExampleDiscriminator: _arrirpc_schema.ADiscriminatorSchema<{
149
- id: string;
150
- typeName: "A";
151
- } | {
152
- id: string;
153
- name: string;
154
- typeName: "B";
155
- } | {
156
- id: string;
157
- name: string;
158
- date: Date;
159
- typeName: "C";
160
- }>;
161
- interface ExampleRecursive {
162
- left: ExampleRecursive | null;
163
- right: ExampleRecursive | null;
164
- }
165
- declare const ExampleRecursive: _arrirpc_schema.AObjectSchema<ExampleRecursive, false> | _arrirpc_schema.ADiscriminatorSchema<ExampleRecursive>;
166
- declare const ReferenceAppDefinition: AppDefinition;
167
-
168
- export { ExampleDiscriminator, ExamplePayloadNullable, ExampleRecursive, ReferenceAppDefinition, TestAppDefinition, TestUpdateUserParams, TestUserNotificationSchema, TestUserParams, TestUserPhotoSchema, TestUserSchema, TestUserSettingsSchema };
@@ -1,168 +0,0 @@
1
- import * as _arrirpc_schema from '@arrirpc/schema';
2
- import { AppDefinition } from './index.js';
3
- import 'jtd-utils';
4
- import 'scule';
5
-
6
- declare const TestUserSettingsSchema: _arrirpc_schema.AObjectSchema<{
7
- notificationsEnabled: boolean;
8
- preferredTheme: "dark-mode" | "light-mode" | "system";
9
- }, false>;
10
- declare const TestUserPhotoSchema: _arrirpc_schema.AObjectSchema<{
11
- url: string;
12
- width: number;
13
- height: number;
14
- bytes: bigint;
15
- nanoseconds: bigint;
16
- }, false>;
17
- declare const TestUserNotificationSchema: _arrirpc_schema.ADiscriminatorSchema<{
18
- postId: string;
19
- userId: string;
20
- notificationType: "POST_LIKE";
21
- } | {
22
- postId: string;
23
- userId: string;
24
- commentText: string;
25
- notificationType: "POST_COMMENT";
26
- }>;
27
- interface BinaryTree {
28
- left: BinaryTree | null;
29
- right: BinaryTree | null;
30
- }
31
- declare const TestUserSchema: _arrirpc_schema.AObjectSchema<{
32
- id: string;
33
- role: "standard" | "admin";
34
- photo: {
35
- url: string;
36
- width: number;
37
- height: number;
38
- bytes: bigint;
39
- nanoseconds: bigint;
40
- } | null;
41
- createdAt: Date;
42
- numFollowers: number;
43
- settings: {
44
- notificationsEnabled: boolean;
45
- preferredTheme: "dark-mode" | "light-mode" | "system";
46
- };
47
- lastNotification: {
48
- postId: string;
49
- userId: string;
50
- notificationType: "POST_LIKE";
51
- } | {
52
- postId: string;
53
- userId: string;
54
- commentText: string;
55
- notificationType: "POST_COMMENT";
56
- } | null;
57
- recentNotifications: ({
58
- postId: string;
59
- userId: string;
60
- notificationType: "POST_LIKE";
61
- } | {
62
- postId: string;
63
- userId: string;
64
- commentText: string;
65
- notificationType: "POST_COMMENT";
66
- })[];
67
- bookmarks: Record<string, {
68
- postId: string;
69
- userId: string;
70
- }>;
71
- bio: string | undefined;
72
- metadata: Record<string, any>;
73
- randomList: any[];
74
- binaryTree: BinaryTree;
75
- }, false>;
76
- declare const TestUserParams: _arrirpc_schema.AObjectSchema<{
77
- userId: string;
78
- }, false>;
79
- declare const TestUpdateUserParams: _arrirpc_schema.AObjectSchema<Pick<{
80
- id: string;
81
- role: "standard" | "admin";
82
- photo: {
83
- url: string;
84
- width: number;
85
- height: number;
86
- bytes: bigint;
87
- nanoseconds: bigint;
88
- } | null;
89
- createdAt: Date;
90
- numFollowers: number;
91
- settings: {
92
- notificationsEnabled: boolean;
93
- preferredTheme: "dark-mode" | "light-mode" | "system";
94
- };
95
- lastNotification: {
96
- postId: string;
97
- userId: string;
98
- notificationType: "POST_LIKE";
99
- } | {
100
- postId: string;
101
- userId: string;
102
- commentText: string;
103
- notificationType: "POST_COMMENT";
104
- } | null;
105
- recentNotifications: ({
106
- postId: string;
107
- userId: string;
108
- notificationType: "POST_LIKE";
109
- } | {
110
- postId: string;
111
- userId: string;
112
- commentText: string;
113
- notificationType: "POST_COMMENT";
114
- })[];
115
- bookmarks: Record<string, {
116
- postId: string;
117
- userId: string;
118
- }>;
119
- bio: string | undefined;
120
- metadata: Record<string, any>;
121
- randomList: any[];
122
- binaryTree: BinaryTree;
123
- }, "id" | "photo" | "bio">, false>;
124
- declare const TestAppDefinition: AppDefinition;
125
- declare const ExamplePayloadNullable: _arrirpc_schema.AObjectSchema<{
126
- string: string | null;
127
- boolean: boolean | null;
128
- timestamp: Date | null;
129
- float32: number | null;
130
- float64: number | null;
131
- int8: number | null;
132
- uint8: number | null;
133
- int16: number | null;
134
- uint16: number | null;
135
- int32: number | null;
136
- uint32: number | null;
137
- int64: bigint | null;
138
- uint64: bigint | null;
139
- enum: "FOO" | "BAR" | "BAZ" | null;
140
- object: {
141
- id: string;
142
- content: string;
143
- };
144
- array: boolean[] | null;
145
- record: Record<string, boolean> | null;
146
- any: any;
147
- }, false>;
148
- declare const ExampleDiscriminator: _arrirpc_schema.ADiscriminatorSchema<{
149
- id: string;
150
- typeName: "A";
151
- } | {
152
- id: string;
153
- name: string;
154
- typeName: "B";
155
- } | {
156
- id: string;
157
- name: string;
158
- date: Date;
159
- typeName: "C";
160
- }>;
161
- interface ExampleRecursive {
162
- left: ExampleRecursive | null;
163
- right: ExampleRecursive | null;
164
- }
165
- declare const ExampleRecursive: _arrirpc_schema.AObjectSchema<ExampleRecursive, false> | _arrirpc_schema.ADiscriminatorSchema<ExampleRecursive>;
166
- declare const ReferenceAppDefinition: AppDefinition;
167
-
168
- export { ExampleDiscriminator, ExamplePayloadNullable, ExampleRecursive, ReferenceAppDefinition, TestAppDefinition, TestUpdateUserParams, TestUserNotificationSchema, TestUserParams, TestUserPhotoSchema, TestUserSchema, TestUserSettingsSchema };
@@ -1,229 +0,0 @@
1
- import { a } from '@arrirpc/schema';
2
-
3
- const TestUserSettingsSchema = a.object("UserSettings", {
4
- notificationsEnabled: a.boolean(),
5
- preferredTheme: a.stringEnum(["dark-mode", "light-mode", "system"], {
6
- isDeprecated: true
7
- })
8
- });
9
- const TestUserPhotoSchema = a.object(
10
- {
11
- url: a.string(),
12
- width: a.number(),
13
- height: a.number(),
14
- bytes: a.int64(),
15
- nanoseconds: a.uint64({
16
- description: "When the photo was last updated in nanoseconds"
17
- })
18
- },
19
- { id: "UserPhoto", description: "A profile picture" }
20
- );
21
- const TestUserNotificationSchema = a.discriminator(
22
- "UserNotification",
23
- "notificationType",
24
- {
25
- POST_LIKE: a.object({
26
- postId: a.string(),
27
- userId: a.string()
28
- }),
29
- POST_COMMENT: a.object({
30
- postId: a.string(),
31
- userId: a.string(),
32
- commentText: a.string()
33
- })
34
- }
35
- );
36
- const TestUserSchema = a.object("User", {
37
- id: a.string(),
38
- role: a.stringEnum(["standard", "admin"]),
39
- photo: a.nullable(TestUserPhotoSchema),
40
- createdAt: a.timestamp(),
41
- numFollowers: a.int32(),
42
- settings: TestUserSettingsSchema,
43
- lastNotification: a.nullable(TestUserNotificationSchema),
44
- recentNotifications: a.array(TestUserNotificationSchema),
45
- bookmarks: a.record(a.object({ postId: a.string(), userId: a.string() })),
46
- bio: a.optional(a.string()),
47
- metadata: a.record(a.any()),
48
- randomList: a.array(a.any()),
49
- binaryTree: a.recursive(
50
- (self) => a.object({
51
- left: a.nullable(self),
52
- right: a.nullable(self)
53
- }),
54
- { id: "BinaryTree" }
55
- )
56
- });
57
- const TestUserParams = a.object("UserParams", {
58
- userId: a.string()
59
- });
60
- const TestUpdateUserParams = a.pick(
61
- TestUserSchema,
62
- ["id", "bio", "photo"],
63
- {
64
- id: "UpdateUserParams"
65
- }
66
- );
67
- const TestAppDefinition = {
68
- schemaVersion: "0.0.7",
69
- info: {
70
- title: "Test App Client",
71
- description: "This is a example app definition",
72
- version: "11"
73
- },
74
- procedures: {
75
- getStatus: {
76
- transport: "http",
77
- path: "/status",
78
- method: "get",
79
- params: void 0,
80
- response: "GetStatusResponse"
81
- },
82
- "users.getUser": {
83
- transport: "http",
84
- path: "/users/get-user",
85
- method: "get",
86
- params: "UserParams",
87
- response: "User",
88
- description: "Get a user by id"
89
- },
90
- "users.updateUser": {
91
- transport: "http",
92
- path: "/users/update-user",
93
- method: "post",
94
- params: "UpdateUserParams",
95
- response: "User",
96
- description: "Update a user"
97
- },
98
- "users.watchUser": {
99
- transport: "http",
100
- path: "/users/watch-user",
101
- method: "get",
102
- params: "UserParams",
103
- response: "User",
104
- isEventStream: true,
105
- description: "Watch a user"
106
- },
107
- "users.createConnection": {
108
- transport: "ws",
109
- path: "/users/create-connection",
110
- params: "UserParams",
111
- response: "User"
112
- },
113
- "users.settings.getUserSettings": {
114
- transport: "http",
115
- path: "/users/settings/get-user-settings",
116
- method: "get",
117
- params: void 0,
118
- response: void 0,
119
- isDeprecated: true
120
- }
121
- },
122
- definitions: {
123
- GetStatusResponse: a.object({
124
- message: a.string()
125
- }),
126
- User: TestUserSchema,
127
- UserParams: TestUserParams,
128
- UpdateUserParams: TestUpdateUserParams
129
- }
130
- };
131
- const ExampleEnum = a.enumerator(["FOO", "BAR", "BAZ"], { id: "ExampleEnum" });
132
- const ExampleObject = a.object(
133
- {
134
- id: a.string(),
135
- content: a.string()
136
- },
137
- {
138
- id: "ExampleObject"
139
- }
140
- );
141
- const ExamplePayload = a.object(
142
- {
143
- string: a.string(),
144
- boolean: a.boolean(),
145
- timestamp: a.timestamp(),
146
- float32: a.float32(),
147
- float64: a.float64(),
148
- int8: a.int8(),
149
- uint8: a.uint8(),
150
- int16: a.int16(),
151
- uint16: a.uint16(),
152
- int32: a.int32(),
153
- uint32: a.uint32(),
154
- int64: a.int64(),
155
- uint64: a.uint64(),
156
- enum: ExampleEnum,
157
- object: ExampleObject,
158
- array: a.array(a.boolean()),
159
- record: a.record(a.boolean()),
160
- any: a.any()
161
- },
162
- {
163
- id: "ExamplePayload"
164
- }
165
- );
166
- const ExamplePayloadNullable = a.object(
167
- {
168
- string: a.nullable(a.string()),
169
- boolean: a.nullable(a.boolean()),
170
- timestamp: a.nullable(a.timestamp()),
171
- float32: a.nullable(a.float32()),
172
- float64: a.nullable(a.float64()),
173
- int8: a.nullable(a.int8()),
174
- uint8: a.nullable(a.uint8()),
175
- int16: a.nullable(a.int16()),
176
- uint16: a.nullable(a.uint16()),
177
- int32: a.nullable(a.int32()),
178
- uint32: a.nullable(a.uint32()),
179
- int64: a.nullable(a.int64()),
180
- uint64: a.nullable(a.uint64()),
181
- enum: a.nullable(ExampleEnum),
182
- object: ExampleObject,
183
- array: a.nullable(a.array(a.boolean())),
184
- record: a.nullable(a.record(a.boolean())),
185
- any: a.nullable(a.any())
186
- },
187
- {
188
- id: "ExamplePayloadNullable"
189
- }
190
- );
191
- const ExampleDiscriminator = a.discriminator(
192
- "typeName",
193
- {
194
- A: a.object({
195
- id: a.string()
196
- }),
197
- B: a.object({
198
- id: a.string(),
199
- name: a.string()
200
- }),
201
- C: a.object({
202
- id: a.string(),
203
- name: a.string(),
204
- date: a.timestamp()
205
- })
206
- },
207
- {
208
- id: "ExampleDiscriminator"
209
- }
210
- );
211
- const ExampleRecursive = a.recursive(
212
- (self) => a.object({
213
- left: a.nullable(self),
214
- right: a.nullable(self)
215
- }),
216
- { id: "ExampleRecursive" }
217
- );
218
- const ReferenceAppDefinition = {
219
- schemaVersion: "0.0.7",
220
- procedures: {},
221
- definitions: {
222
- ExamplePayload,
223
- ExamplePayloadNullable,
224
- ExampleDiscriminator,
225
- BinaryTree: ExampleRecursive
226
- }
227
- };
228
-
229
- export { ExampleDiscriminator, ExamplePayloadNullable, ExampleRecursive, ReferenceAppDefinition, TestAppDefinition, TestUpdateUserParams, TestUserNotificationSchema, TestUserParams, TestUserPhotoSchema, TestUserSchema, TestUserSettingsSchema };