@metal-stack/api 0.4.3 → 0.5.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.
Files changed (151) hide show
  1. package/{js/Makefile → Makefile} +5 -2
  2. package/bun.lock +74 -0
  3. package/client-test.d.ts +1 -0
  4. package/client-test.js +45 -0
  5. package/client-test.ts +49 -0
  6. package/client.d.ts +97 -0
  7. package/client.js +347 -0
  8. package/client.ts +662 -0
  9. package/{js/metalstack → metalstack}/admin/v2/audit_pb.d.ts +5 -5
  10. package/{js/metalstack → metalstack}/admin/v2/audit_pb.ts +5 -5
  11. package/{js/metalstack → metalstack}/admin/v2/component_pb.d.ts +6 -6
  12. package/{js/metalstack → metalstack}/admin/v2/component_pb.ts +6 -6
  13. package/{js/metalstack → metalstack}/admin/v2/filesystem_pb.d.ts +28 -28
  14. package/{js/metalstack → metalstack}/admin/v2/filesystem_pb.ts +28 -28
  15. package/{js/metalstack → metalstack}/admin/v2/image_pb.d.ts +22 -16
  16. package/{js/metalstack → metalstack}/admin/v2/image_pb.js +1 -1
  17. package/{js/metalstack → metalstack}/admin/v2/image_pb.ts +24 -17
  18. package/{js/metalstack → metalstack}/admin/v2/ip_pb.d.ts +2 -2
  19. package/{js/metalstack → metalstack}/admin/v2/ip_pb.ts +2 -2
  20. package/{js/metalstack → metalstack}/admin/v2/machine_pb.d.ts +47 -55
  21. package/{js/metalstack → metalstack}/admin/v2/machine_pb.js +1 -1
  22. package/{js/metalstack → metalstack}/admin/v2/machine_pb.ts +48 -55
  23. package/{js/metalstack → metalstack}/admin/v2/network_pb.d.ts +36 -36
  24. package/{js/metalstack → metalstack}/admin/v2/network_pb.ts +36 -36
  25. package/{js/metalstack → metalstack}/admin/v2/partition_pb.d.ts +26 -26
  26. package/{js/metalstack → metalstack}/admin/v2/partition_pb.ts +26 -26
  27. package/{js/metalstack → metalstack}/admin/v2/project_pb.d.ts +2 -2
  28. package/{js/metalstack → metalstack}/admin/v2/project_pb.ts +2 -2
  29. package/{js/metalstack → metalstack}/admin/v2/size_imageconstraint_pb.d.ts +18 -18
  30. package/{js/metalstack → metalstack}/admin/v2/size_imageconstraint_pb.ts +18 -18
  31. package/{js/metalstack → metalstack}/admin/v2/size_pb.d.ts +11 -11
  32. package/{js/metalstack → metalstack}/admin/v2/size_pb.ts +11 -11
  33. package/{js/metalstack → metalstack}/admin/v2/size_reservation_pb.d.ts +14 -14
  34. package/{js/metalstack → metalstack}/admin/v2/size_reservation_pb.ts +14 -14
  35. package/{js/metalstack → metalstack}/admin/v2/switch_pb.d.ts +29 -29
  36. package/{js/metalstack → metalstack}/admin/v2/switch_pb.ts +29 -29
  37. package/{js/metalstack → metalstack}/admin/v2/task_pb.d.ts +47 -47
  38. package/{js/metalstack → metalstack}/admin/v2/task_pb.js +8 -8
  39. package/{js/metalstack → metalstack}/admin/v2/task_pb.ts +47 -47
  40. package/{js/metalstack → metalstack}/admin/v2/tenant_pb.d.ts +22 -22
  41. package/{js/metalstack → metalstack}/admin/v2/tenant_pb.ts +22 -22
  42. package/{js/metalstack → metalstack}/admin/v2/token_pb.d.ts +8 -8
  43. package/{js/metalstack → metalstack}/admin/v2/token_pb.ts +8 -8
  44. package/{js/metalstack → metalstack}/admin/v2/vpn_pb.d.ts +13 -13
  45. package/{js/metalstack → metalstack}/admin/v2/vpn_pb.ts +13 -13
  46. package/{js/metalstack → metalstack}/api/v2/audit_pb.d.ts +37 -37
  47. package/{js/metalstack → metalstack}/api/v2/audit_pb.js +3 -3
  48. package/{js/metalstack → metalstack}/api/v2/audit_pb.ts +37 -37
  49. package/{js/metalstack → metalstack}/api/v2/common_pb.d.ts +68 -68
  50. package/{js/metalstack → metalstack}/api/v2/common_pb.js +47 -47
  51. package/{js/metalstack → metalstack}/api/v2/common_pb.ts +68 -68
  52. package/{js/metalstack → metalstack}/api/v2/component_pb.d.ts +17 -17
  53. package/{js/metalstack → metalstack}/api/v2/component_pb.js +8 -8
  54. package/{js/metalstack → metalstack}/api/v2/component_pb.ts +17 -17
  55. package/{js/metalstack → metalstack}/api/v2/filesystem_pb.d.ts +82 -82
  56. package/{js/metalstack → metalstack}/api/v2/filesystem_pb.js +23 -23
  57. package/{js/metalstack → metalstack}/api/v2/filesystem_pb.ts +82 -82
  58. package/{js/metalstack → metalstack}/api/v2/health_pb.d.ts +21 -21
  59. package/{js/metalstack → metalstack}/api/v2/health_pb.js +13 -13
  60. package/{js/metalstack → metalstack}/api/v2/health_pb.ts +21 -21
  61. package/{js/metalstack → metalstack}/api/v2/image_pb.d.ts +45 -45
  62. package/{js/metalstack → metalstack}/api/v2/image_pb.js +9 -9
  63. package/{js/metalstack → metalstack}/api/v2/image_pb.ts +45 -45
  64. package/{js/metalstack → metalstack}/api/v2/ip_pb.d.ts +67 -67
  65. package/{js/metalstack → metalstack}/api/v2/ip_pb.js +8 -8
  66. package/{js/metalstack → metalstack}/api/v2/ip_pb.ts +67 -67
  67. package/{js/metalstack → metalstack}/api/v2/machine_pb.d.ts +422 -374
  68. package/{js/metalstack → metalstack}/api/v2/machine_pb.js +94 -89
  69. package/{js/metalstack → metalstack}/api/v2/machine_pb.ts +453 -396
  70. package/{js/metalstack → metalstack}/api/v2/method_pb.d.ts +7 -7
  71. package/{js/metalstack → metalstack}/api/v2/method_pb.ts +7 -7
  72. package/{js/metalstack → metalstack}/api/v2/network_pb.d.ts +98 -98
  73. package/{js/metalstack → metalstack}/api/v2/network_pb.js +16 -16
  74. package/{js/metalstack → metalstack}/api/v2/network_pb.ts +98 -98
  75. package/{js/metalstack → metalstack}/api/v2/partition_pb.d.ts +28 -28
  76. package/{js/metalstack → metalstack}/api/v2/partition_pb.ts +28 -28
  77. package/{js/metalstack → metalstack}/api/v2/predefined_rules_pb.d.ts +30 -24
  78. package/{js/metalstack → metalstack}/api/v2/predefined_rules_pb.js +40 -34
  79. package/{js/metalstack → metalstack}/api/v2/predefined_rules_pb.ts +42 -34
  80. package/{js/metalstack → metalstack}/api/v2/project_pb.d.ts +114 -114
  81. package/{js/metalstack → metalstack}/api/v2/project_pb.ts +114 -114
  82. package/{js/metalstack → metalstack}/api/v2/size_imageconstraint_pb.d.ts +21 -22
  83. package/{js/metalstack → metalstack}/api/v2/size_imageconstraint_pb.ts +21 -22
  84. package/{js/metalstack → metalstack}/api/v2/size_pb.d.ts +29 -29
  85. package/{js/metalstack → metalstack}/api/v2/size_pb.js +6 -6
  86. package/{js/metalstack → metalstack}/api/v2/size_pb.ts +29 -29
  87. package/{js/metalstack → metalstack}/api/v2/size_reservation_pb.d.ts +27 -27
  88. package/{js/metalstack → metalstack}/api/v2/size_reservation_pb.ts +27 -27
  89. package/{js/metalstack → metalstack}/api/v2/switch_pb.d.ts +8 -8
  90. package/{js/metalstack → metalstack}/api/v2/switch_pb.js +1 -1
  91. package/{js/metalstack → metalstack}/api/v2/switch_pb.ts +9 -9
  92. package/{js/metalstack → metalstack}/api/v2/tenant_pb.d.ts +114 -116
  93. package/{js/metalstack → metalstack}/api/v2/tenant_pb.ts +114 -116
  94. package/{js/metalstack → metalstack}/api/v2/token_pb.d.ts +103 -103
  95. package/{js/metalstack → metalstack}/api/v2/token_pb.js +3 -3
  96. package/{js/metalstack → metalstack}/api/v2/token_pb.ts +103 -103
  97. package/{js/metalstack → metalstack}/api/v2/user_pb.d.ts +8 -8
  98. package/{js/metalstack → metalstack}/api/v2/user_pb.ts +8 -8
  99. package/{js/metalstack → metalstack}/api/v2/version_pb.d.ts +5 -5
  100. package/{js/metalstack → metalstack}/api/v2/version_pb.ts +5 -5
  101. package/{js/metalstack → metalstack}/api/v2/vpn_pb.d.ts +6 -6
  102. package/{js/metalstack → metalstack}/api/v2/vpn_pb.ts +6 -6
  103. package/{js/metalstack → metalstack}/infra/v2/bmc_pb.d.ts +15 -17
  104. package/{js/metalstack → metalstack}/infra/v2/bmc_pb.js +1 -1
  105. package/{js/metalstack → metalstack}/infra/v2/bmc_pb.ts +16 -16
  106. package/{js/metalstack → metalstack}/infra/v2/boot_pb.d.ts +36 -36
  107. package/{js/metalstack → metalstack}/infra/v2/boot_pb.ts +36 -36
  108. package/{js/metalstack → metalstack}/infra/v2/component_pb.d.ts +5 -5
  109. package/{js/metalstack → metalstack}/infra/v2/component_pb.ts +5 -5
  110. package/{js/metalstack → metalstack}/infra/v2/event_pb.d.ts +3 -3
  111. package/{js/metalstack → metalstack}/infra/v2/event_pb.ts +3 -3
  112. package/{js/metalstack → metalstack}/infra/v2/switch_pb.d.ts +12 -12
  113. package/{js/metalstack → metalstack}/infra/v2/switch_pb.ts +12 -12
  114. package/package.json +4 -3
  115. package/test-interceptor.d.ts +9 -0
  116. package/test-interceptor.js +33 -0
  117. package/test-interceptor.ts +49 -0
  118. package/tsconfig.json +14 -0
  119. package/LICENSE +0 -21
  120. package/README.md +0 -117
  121. package/js/tsconfig.json +0 -70
  122. /package/{js/buf → buf}/validate/validate_pb.d.ts +0 -0
  123. /package/{js/buf → buf}/validate/validate_pb.js +0 -0
  124. /package/{js/buf → buf}/validate/validate_pb.ts +0 -0
  125. /package/{js/metalstack → metalstack}/admin/v2/audit_pb.js +0 -0
  126. /package/{js/metalstack → metalstack}/admin/v2/component_pb.js +0 -0
  127. /package/{js/metalstack → metalstack}/admin/v2/filesystem_pb.js +0 -0
  128. /package/{js/metalstack → metalstack}/admin/v2/ip_pb.js +0 -0
  129. /package/{js/metalstack → metalstack}/admin/v2/network_pb.js +0 -0
  130. /package/{js/metalstack → metalstack}/admin/v2/partition_pb.js +0 -0
  131. /package/{js/metalstack → metalstack}/admin/v2/project_pb.js +0 -0
  132. /package/{js/metalstack → metalstack}/admin/v2/size_imageconstraint_pb.js +0 -0
  133. /package/{js/metalstack → metalstack}/admin/v2/size_pb.js +0 -0
  134. /package/{js/metalstack → metalstack}/admin/v2/size_reservation_pb.js +0 -0
  135. /package/{js/metalstack → metalstack}/admin/v2/switch_pb.js +0 -0
  136. /package/{js/metalstack → metalstack}/admin/v2/tenant_pb.js +0 -0
  137. /package/{js/metalstack → metalstack}/admin/v2/token_pb.js +0 -0
  138. /package/{js/metalstack → metalstack}/admin/v2/vpn_pb.js +0 -0
  139. /package/{js/metalstack → metalstack}/api/v2/method_pb.js +0 -0
  140. /package/{js/metalstack → metalstack}/api/v2/partition_pb.js +0 -0
  141. /package/{js/metalstack → metalstack}/api/v2/project_pb.js +0 -0
  142. /package/{js/metalstack → metalstack}/api/v2/size_imageconstraint_pb.js +0 -0
  143. /package/{js/metalstack → metalstack}/api/v2/size_reservation_pb.js +0 -0
  144. /package/{js/metalstack → metalstack}/api/v2/tenant_pb.js +0 -0
  145. /package/{js/metalstack → metalstack}/api/v2/user_pb.js +0 -0
  146. /package/{js/metalstack → metalstack}/api/v2/version_pb.js +0 -0
  147. /package/{js/metalstack → metalstack}/api/v2/vpn_pb.js +0 -0
  148. /package/{js/metalstack → metalstack}/infra/v2/boot_pb.js +0 -0
  149. /package/{js/metalstack → metalstack}/infra/v2/component_pb.js +0 -0
  150. /package/{js/metalstack → metalstack}/infra/v2/event_pb.js +0 -0
  151. /package/{js/metalstack → metalstack}/infra/v2/switch_pb.js +0 -0
@@ -22,7 +22,7 @@ export const file_metalstack_infra_v2_event: GenFile = /*@__PURE__*/
22
22
  */
23
23
  export type EventServiceSendRequest = Message<"metalstack.infra.v2.EventServiceSendRequest"> & {
24
24
  /**
25
- * Events grouped by machine IDs
25
+ * Events grouped by machine IDs.
26
26
  *
27
27
  * @generated from field: map<string, metalstack.api.v2.MachineProvisioningEvent> events = 1;
28
28
  */
@@ -43,14 +43,14 @@ export const EventServiceSendRequestSchema: GenMessage<EventServiceSendRequest>
43
43
  */
44
44
  export type EventServiceSendResponse = Message<"metalstack.infra.v2.EventServiceSendResponse"> & {
45
45
  /**
46
- * Events counts the number of events successfully stored in the database
46
+ * Events counts the number of events successfully stored in the database.
47
47
  *
48
48
  * @generated from field: uint64 events = 1;
49
49
  */
50
50
  events: bigint;
51
51
 
52
52
  /**
53
- * Failed contains IDs of all machines whose events could not be stored in the database
53
+ * Failed contains IDs of all machines whose events could not be stored in the database.
54
54
  *
55
55
  * @generated from field: repeated string failed = 2;
56
56
  */
@@ -13,7 +13,7 @@ export declare const file_metalstack_infra_v2_switch: GenFile;
13
13
  */
14
14
  export type SwitchServiceGetRequest = Message<"metalstack.infra.v2.SwitchServiceGetRequest"> & {
15
15
  /**
16
- * Id of the switch
16
+ * Id of the switch.
17
17
  *
18
18
  * @generated from field: string id = 1;
19
19
  */
@@ -31,7 +31,7 @@ export declare const SwitchServiceGetRequestSchema: GenMessage<SwitchServiceGetR
31
31
  */
32
32
  export type SwitchServiceGetResponse = Message<"metalstack.infra.v2.SwitchServiceGetResponse"> & {
33
33
  /**
34
- * Switch contains the requested switch
34
+ * Switch contains the requested switch.
35
35
  *
36
36
  * @generated from field: metalstack.api.v2.Switch switch = 1;
37
37
  */
@@ -49,7 +49,7 @@ export declare const SwitchServiceGetResponseSchema: GenMessage<SwitchServiceGet
49
49
  */
50
50
  export type SwitchServiceRegisterRequest = Message<"metalstack.infra.v2.SwitchServiceRegisterRequest"> & {
51
51
  /**
52
- * Switch to register
52
+ * Switch to register.
53
53
  *
54
54
  * @generated from field: metalstack.api.v2.Switch switch = 1;
55
55
  */
@@ -67,7 +67,7 @@ export declare const SwitchServiceRegisterRequestSchema: GenMessage<SwitchServic
67
67
  */
68
68
  export type SwitchServiceRegisterResponse = Message<"metalstack.infra.v2.SwitchServiceRegisterResponse"> & {
69
69
  /**
70
- * Switch contains the registered switch
70
+ * Switch contains the registered switch.
71
71
  *
72
72
  * @generated from field: metalstack.api.v2.Switch switch = 1;
73
73
  */
@@ -85,25 +85,25 @@ export declare const SwitchServiceRegisterResponseSchema: GenMessage<SwitchServi
85
85
  */
86
86
  export type SwitchServiceHeartbeatRequest = Message<"metalstack.infra.v2.SwitchServiceHeartbeatRequest"> & {
87
87
  /**
88
- * Id of the switch
88
+ * Id of the switch.
89
89
  *
90
90
  * @generated from field: string id = 1;
91
91
  */
92
92
  id: string;
93
93
  /**
94
- * Duration of the sync
94
+ * Duration of the sync.
95
95
  *
96
96
  * @generated from field: google.protobuf.Duration duration = 2;
97
97
  */
98
98
  duration?: Duration | undefined;
99
99
  /**
100
- * Error if any occurred during the sync
100
+ * Error if any occurred during the sync.
101
101
  *
102
102
  * @generated from field: optional string error = 3;
103
103
  */
104
104
  error?: string | undefined;
105
105
  /**
106
- * PortStates maps port identifiers to the respective port's operational state
106
+ * PortStates maps port identifiers to the respective port's operational state.
107
107
  *
108
108
  * @generated from field: map<string, metalstack.api.v2.SwitchPortStatus> port_states = 4;
109
109
  */
@@ -111,7 +111,7 @@ export type SwitchServiceHeartbeatRequest = Message<"metalstack.infra.v2.SwitchS
111
111
  [key: string]: SwitchPortStatus;
112
112
  };
113
113
  /**
114
- * BgpPortStates maps port identifiers to the respective port's BGP state
114
+ * BgpPortStates maps port identifiers to the respective port's BGP state.
115
115
  *
116
116
  * @generated from field: map<string, metalstack.api.v2.SwitchBGPPortState> bgp_port_states = 5;
117
117
  */
@@ -131,19 +131,19 @@ export declare const SwitchServiceHeartbeatRequestSchema: GenMessage<SwitchServi
131
131
  */
132
132
  export type SwitchServiceHeartbeatResponse = Message<"metalstack.infra.v2.SwitchServiceHeartbeatResponse"> & {
133
133
  /**
134
- * Id of the switch
134
+ * Id of the switch.
135
135
  *
136
136
  * @generated from field: string id = 1;
137
137
  */
138
138
  id: string;
139
139
  /**
140
- * LastSync holds information about the last sync
140
+ * LastSync holds information about the last sync.
141
141
  *
142
142
  * @generated from field: metalstack.api.v2.SwitchSync last_sync = 2;
143
143
  */
144
144
  lastSync?: SwitchSync | undefined;
145
145
  /**
146
- * LastSyncError holds information about the last erroneous sync
146
+ * LastSyncError holds information about the last erroneous sync.
147
147
  *
148
148
  * @generated from field: metalstack.api.v2.SwitchSync last_sync_error = 3;
149
149
  */
@@ -26,7 +26,7 @@ export const file_metalstack_infra_v2_switch: GenFile = /*@__PURE__*/
26
26
  */
27
27
  export type SwitchServiceGetRequest = Message<"metalstack.infra.v2.SwitchServiceGetRequest"> & {
28
28
  /**
29
- * Id of the switch
29
+ * Id of the switch.
30
30
  *
31
31
  * @generated from field: string id = 1;
32
32
  */
@@ -47,7 +47,7 @@ export const SwitchServiceGetRequestSchema: GenMessage<SwitchServiceGetRequest>
47
47
  */
48
48
  export type SwitchServiceGetResponse = Message<"metalstack.infra.v2.SwitchServiceGetResponse"> & {
49
49
  /**
50
- * Switch contains the requested switch
50
+ * Switch contains the requested switch.
51
51
  *
52
52
  * @generated from field: metalstack.api.v2.Switch switch = 1;
53
53
  */
@@ -68,7 +68,7 @@ export const SwitchServiceGetResponseSchema: GenMessage<SwitchServiceGetResponse
68
68
  */
69
69
  export type SwitchServiceRegisterRequest = Message<"metalstack.infra.v2.SwitchServiceRegisterRequest"> & {
70
70
  /**
71
- * Switch to register
71
+ * Switch to register.
72
72
  *
73
73
  * @generated from field: metalstack.api.v2.Switch switch = 1;
74
74
  */
@@ -89,7 +89,7 @@ export const SwitchServiceRegisterRequestSchema: GenMessage<SwitchServiceRegiste
89
89
  */
90
90
  export type SwitchServiceRegisterResponse = Message<"metalstack.infra.v2.SwitchServiceRegisterResponse"> & {
91
91
  /**
92
- * Switch contains the registered switch
92
+ * Switch contains the registered switch.
93
93
  *
94
94
  * @generated from field: metalstack.api.v2.Switch switch = 1;
95
95
  */
@@ -110,35 +110,35 @@ export const SwitchServiceRegisterResponseSchema: GenMessage<SwitchServiceRegist
110
110
  */
111
111
  export type SwitchServiceHeartbeatRequest = Message<"metalstack.infra.v2.SwitchServiceHeartbeatRequest"> & {
112
112
  /**
113
- * Id of the switch
113
+ * Id of the switch.
114
114
  *
115
115
  * @generated from field: string id = 1;
116
116
  */
117
117
  id: string;
118
118
 
119
119
  /**
120
- * Duration of the sync
120
+ * Duration of the sync.
121
121
  *
122
122
  * @generated from field: google.protobuf.Duration duration = 2;
123
123
  */
124
124
  duration?: Duration | undefined;
125
125
 
126
126
  /**
127
- * Error if any occurred during the sync
127
+ * Error if any occurred during the sync.
128
128
  *
129
129
  * @generated from field: optional string error = 3;
130
130
  */
131
131
  error?: string | undefined;
132
132
 
133
133
  /**
134
- * PortStates maps port identifiers to the respective port's operational state
134
+ * PortStates maps port identifiers to the respective port's operational state.
135
135
  *
136
136
  * @generated from field: map<string, metalstack.api.v2.SwitchPortStatus> port_states = 4;
137
137
  */
138
138
  portStates: { [key: string]: SwitchPortStatus };
139
139
 
140
140
  /**
141
- * BgpPortStates maps port identifiers to the respective port's BGP state
141
+ * BgpPortStates maps port identifiers to the respective port's BGP state.
142
142
  *
143
143
  * @generated from field: map<string, metalstack.api.v2.SwitchBGPPortState> bgp_port_states = 5;
144
144
  */
@@ -159,21 +159,21 @@ export const SwitchServiceHeartbeatRequestSchema: GenMessage<SwitchServiceHeartb
159
159
  */
160
160
  export type SwitchServiceHeartbeatResponse = Message<"metalstack.infra.v2.SwitchServiceHeartbeatResponse"> & {
161
161
  /**
162
- * Id of the switch
162
+ * Id of the switch.
163
163
  *
164
164
  * @generated from field: string id = 1;
165
165
  */
166
166
  id: string;
167
167
 
168
168
  /**
169
- * LastSync holds information about the last sync
169
+ * LastSync holds information about the last sync.
170
170
  *
171
171
  * @generated from field: metalstack.api.v2.SwitchSync last_sync = 2;
172
172
  */
173
173
  lastSync?: SwitchSync | undefined;
174
174
 
175
175
  /**
176
- * LastSyncError holds information about the last erroneous sync
176
+ * LastSyncError holds information about the last erroneous sync.
177
177
  *
178
178
  * @generated from field: metalstack.api.v2.SwitchSync last_sync_error = 3;
179
179
  */
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "metal-stack api typescript client",
4
4
  "repository": "https://github.com/metal-stack/api.git",
5
5
  "scripts": {
6
- "build": "tsc --project js/tsconfig.json",
6
+ "build": "tsc --project tsconfig.json",
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "author": "metal-stack.io",
@@ -14,10 +14,11 @@
14
14
  "@connectrpc/connect-web": "^2.1.2"
15
15
  },
16
16
  "devDependencies": {
17
+ "@types/bun": "^1.3.14",
17
18
  "typescript": "^7.0.2"
18
19
  },
19
20
  "files": [
20
- "js/*"
21
+ "./*"
21
22
  ],
22
- "version": "0.4.3"
23
+ "version": "0.5.1"
23
24
  }
@@ -0,0 +1,9 @@
1
+ import type { Interceptor, UnaryResponse } from "@connectrpc/connect";
2
+ import type { DescMessage, MessageShape } from "@bufbuild/protobuf";
3
+ export type ClientCall<Req extends DescMessage = DescMessage, Res extends DescMessage = DescMessage> = {
4
+ wantRequest: MessageShape<Req>;
5
+ wantRequestSchema: Req;
6
+ wantResponse?: () => UnaryResponse<Req, Res>;
7
+ wantError?: Error;
8
+ };
9
+ export declare function newTestInterceptor(calls: ClientCall[]): Interceptor;
@@ -0,0 +1,33 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { equals } from "@bufbuild/protobuf";
11
+ export function newTestInterceptor(calls) {
12
+ let count = 0;
13
+ return (next) => (req) => __awaiter(this, void 0, void 0, function* () {
14
+ var _a, _b;
15
+ var _c;
16
+ const reqAny = req;
17
+ const expected = calls[count];
18
+ if (!expected) {
19
+ throw new Error(`received an unexpected client call of type ${(_c = (_b = (_a = reqAny.method) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.typeName) !== null && _c !== void 0 ? _c : "unknown"}`);
20
+ }
21
+ count++;
22
+ if (!equals(expected.wantRequestSchema, reqAny.message, expected.wantRequest)) {
23
+ throw new Error(`request mismatch for call #${count - 1}: got ${JSON.stringify(reqAny.message)}`);
24
+ }
25
+ if (expected.wantError) {
26
+ throw expected.wantError;
27
+ }
28
+ if (expected.wantResponse) {
29
+ return expected.wantResponse();
30
+ }
31
+ throw new Error(`no wantResponse or wantError configured for call #${count - 1}`);
32
+ });
33
+ }
@@ -0,0 +1,49 @@
1
+ import type { Interceptor, UnaryRequest, UnaryResponse } from "@connectrpc/connect";
2
+ import { equals } from "@bufbuild/protobuf";
3
+ import type { DescMessage, MessageShape } from "@bufbuild/protobuf";
4
+
5
+ export type ClientCall<Req extends DescMessage = DescMessage, Res extends DescMessage = DescMessage> = {
6
+ wantRequest: MessageShape<Req>;
7
+ wantRequestSchema: Req;
8
+ wantResponse?: () => UnaryResponse<Req, Res>;
9
+ wantError?: Error;
10
+ };
11
+
12
+ export function newTestInterceptor(calls: ClientCall[]): Interceptor {
13
+ let count = 0;
14
+
15
+ return (next) => async (req) => {
16
+ const reqAny = req as UnaryRequest;
17
+
18
+ const expected = calls[count];
19
+ if (!expected) {
20
+ throw new Error(
21
+ `received an unexpected client call of type ${reqAny.method?.input?.typeName ?? "unknown"}`,
22
+ );
23
+ }
24
+
25
+ count++;
26
+
27
+ if (
28
+ !equals(
29
+ expected.wantRequestSchema,
30
+ reqAny.message,
31
+ expected.wantRequest as MessageShape<typeof expected.wantRequestSchema>,
32
+ )
33
+ ) {
34
+ throw new Error(
35
+ `request mismatch for call #${count - 1}: got ${JSON.stringify(reqAny.message)}`,
36
+ );
37
+ }
38
+
39
+ if (expected.wantError) {
40
+ throw expected.wantError;
41
+ }
42
+
43
+ if (expected.wantResponse) {
44
+ return expected.wantResponse();
45
+ }
46
+
47
+ throw new Error(`no wantResponse or wantError configured for call #${count - 1}`);
48
+ };
49
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es6",
4
+ "module": "esnext",
5
+ "declaration": true,
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "types": [
11
+ "bun"
12
+ ]
13
+ }
14
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 The metal-stack Authors.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/README.md DELETED
@@ -1,117 +0,0 @@
1
- # metal-stack.io api
2
-
3
- [![Release](https://github.com/metal-stack/api/actions/workflows/main.yml/badge.svg)](https://github.com/metal-stack/api/actions/workflows/main.yml) [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/metal-stack/api) ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/metal-stack/api) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/metal-stack/api) [![Go Report Card](https://goreportcard.com/badge/github.com/metal-stack/api)](https://goreportcard.com/report/github.com/metal-stack/api)
4
-
5
- > [!IMPORTANT]
6
- > Clients from the metal-stack infrastructure have not fully migrated to the new API yet and might still communicate with the old [metal-api](https://github.com/metal-stack/metal-api). It could be that the information you look for is not contained in this repo.
7
-
8
- This is the V2 API of [metal-stack.io](https://metal-stack.io) to implement [MEP-4](https://metal-stack.io/docs/MEP-4-multi-tenancy-for-the-metal-api).
9
-
10
- ## Usage examples
11
-
12
- Can be found in the [examples](examples/) folder.
13
-
14
- ## Conventions
15
-
16
- Method options provide an intuitve and declarative way of providing annotations to service methods.
17
- These are used for scoping api-methods, which are getting utilized for authentication, authorization and auditing (mainly in interceptors).
18
-
19
- ### Motivational Example
20
-
21
- ```proto
22
- service IPService {
23
- // Get an ip
24
- rpc Get(IPServiceGetRequest) returns (IPServiceGetResponse) {
25
- option (project_roles) = PROJECT_ROLE_OWNER;
26
- option (project_roles) = PROJECT_ROLE_EDITOR;
27
- option (project_roles) = PROJECT_ROLE_VIEWER;
28
- option (auditing) = AUDITING_EXCLUDED;
29
- }
30
- // Create an ip
31
- rpc Create(IPServiceCreateRequest) returns (IPServiceCreateResponse) {
32
- option (project_roles) = PROJECT_ROLE_OWNER;
33
- option (project_roles) = PROJECT_ROLE_EDITOR;
34
- }
35
- }
36
-
37
- // IPServiceCreateRequest is the request payload for a ip create request
38
- message IPServiceCreateRequest {
39
- // Network from which the IP should be created
40
- string network = 1 [(buf.validate.field).string = {
41
- min_len: 2
42
- max_len: 128
43
- }];
44
- // Project of the ip
45
- string project = 2 [(buf.validate.field).string.uuid = true];
46
- // Name of the ip
47
- optional string name = 3 [(buf.validate.field).string.(metalstack.api.v2.is_name) = true];
48
- // Description of the ip
49
- optional string description = 4 [(buf.validate.field).string.(metalstack.api.v2.is_description) = true];
50
- // IP if given try to create this ip if still available
51
- optional string ip = 5 [(buf.validate.field).string.ip = true];
52
- // Machine for which this ip should get created
53
- optional string machine = 6 [(buf.validate.field).string.uuid = true];
54
- // Labels to put onto the ip
55
- optional Labels labels = 7;
56
- // Type of the IP, ether ephemeral (default), or static
57
- optional IPType type = 8 [(buf.validate.field).enum.defined_only = true];
58
- // Addressfamily of the IP to create, defaults to ipv4
59
- optional IPAddressFamily address_family = 9 [(buf.validate.field).enum.defined_only = true];
60
- }
61
- ```
62
-
63
- In this example we can see the motivation behind the method options.
64
-
65
- 1. Get: can be issued by project owner, editor, viewer and is excluded from auditing
66
- 2. Allocate: can be used by project owner, editor
67
- 3. Both methods are project-scoped, since they are annotated by a project role -> Request object needs to have the **project** field in order to specify the target project of the service method
68
-
69
- Further explanations are explained in the following.
70
-
71
- ### Auth
72
-
73
- These options specify the RBAC of the api-endpoint.
74
-
75
- | Option | Description | Values | Explanation |
76
- | -------------- | -------------------------------------------- | ----------- | ------------------------------------------------------ |
77
- | TENANT_ROLE\_ | Specifies the required tenant role | UNSPECIFIED | |
78
- | | | OWNER | tenant owner |
79
- | | | EDITOR | tenant editor |
80
- | | | VIEWER | tenant viewer |
81
- | | | GUEST | tenant guest |
82
- | PROJECT_ROLE\_ | Specifies the required project role | UNSPECIFIED | |
83
- | | | OWNER | project owner |
84
- | | | EDITOR | project editor |
85
- | | | VIEWER | project viewer |
86
- | ADMIN_ROLE\_ | Specifies the required admin role | UNSPECIFIED | |
87
- | | | EDITOR | admin editor |
88
- | | | VIEWER | admin viewer |
89
- | MACHINE_ROLE\_ | Specifies the required machine role | UNSPECIFIED | |
90
- | | | EDITOR | machine editor |
91
- | | | VIEWER | machine viewer |
92
- | INFRA_ROLE\_ | Specifies the required infra role | UNSPECIFIED | |
93
- | | | EDITOR | infra editor |
94
- | | | VIEWER | infra viewer |
95
- | VISIBILITY\_ | Specifies the visibility of the api-endpoint | UNSPECIFIED | |
96
- | | | PUBLIC | api-method is visible to public, a token is not needed |
97
- | | | SELF | api-method is scoped to owner resources |
98
-
99
- > [!IMPORTANT]
100
- >
101
- > Every operation needs to specify exactly one of the presented options. The option defines the request scope, which is later used for implementing request authorization in the server.
102
-
103
- > [!CAUTION]
104
- >
105
- > If we use a Tenant or Project role, the request will be respectively scoped as Tenant or Project request.
106
- > Tenant-Requests must have the field **login**, which is the tenant id and specifies the tenant on which the service-method is scoped.
107
- > Project-Requests must have the field **project**, which is the project id and specifies the project on which the service-method is scoped.
108
-
109
- ### Auditing
110
-
111
- For traceability we require to store audit-logs.
112
-
113
- | Option | Description | Values | Explanation |
114
- | ---------- | ---------------------------------------- | ----------- | ------------------------ |
115
- | AUDITING\_ | Specifies if the api-endpoint is audited | UNSPECIFIED | DEFAULT: included |
116
- | | | INCLUDED | operation is audited |
117
- | | | EXCLUDED | operation is not audited |
package/js/tsconfig.json DELETED
@@ -1,70 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
-
5
- /* Basic Options */
6
- // "incremental": true, /* Enable incremental compilation */
7
- "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8
- "module": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9
- // "lib": [], /* Specify library files to be included in the compilation. */
10
- // "allowJs": true, /* Allow javascript files to be compiled. */
11
- // "checkJs": true, /* Report errors in .js files. */
12
- // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
13
- "declaration": true, /* Generates corresponding '.d.ts' file. */
14
- // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15
- // "sourceMap": true, /* Generates corresponding '.map' file. */
16
- // "outFile": "./", /* Concatenate and emit output to single file. */
17
- // "outDir": "./", /* Redirect output structure to the directory. */
18
- // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
19
- // "composite": true, /* Enable project compilation */
20
- // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
21
- // "removeComments": true, /* Do not emit comments to output. */
22
- // "noEmit": true, /* Do not emit outputs. */
23
- // "importHelpers": true, /* Import emit helpers from 'tslib'. */
24
- // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
25
- // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
26
-
27
- /* Strict Type-Checking Options */
28
- "strict": true, /* Enable all strict type-checking options. */
29
- // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
30
- // "strictNullChecks": true, /* Enable strict null checks. */
31
- // "strictFunctionTypes": true, /* Enable strict checking of function types. */
32
- // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
33
- // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
34
- // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
35
- // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
36
-
37
- /* Additional Checks */
38
- // "noUnusedLocals": true, /* Report errors on unused locals. */
39
- // "noUnusedParameters": true, /* Report errors on unused parameters. */
40
- // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
41
- // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
42
- // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
43
-
44
- /* Module Resolution Options */
45
- // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
46
- // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
47
- // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
48
- // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
49
- // "typeRoots": [], /* List of folders to include type definitions from. */
50
- // "types": [], /* Type declaration files to be included in compilation. */
51
- // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
52
- "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
53
- // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
54
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
55
-
56
- /* Source Map Options */
57
- // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
58
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
59
- // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
60
- // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
61
-
62
- /* Experimental Options */
63
- // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
64
- // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
65
-
66
- /* Advanced Options */
67
- "skipLibCheck": true, /* Skip type checking of declaration files. */
68
- "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
69
- }
70
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes