@buildplease/webkit 1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BuildPlease
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.
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));require("reflect-metadata");let c=require("@buildplease/core"),l=require("axios");l=s(l,1);let u=require("inversify");function d(){return[]}const f={name:`buildplease`,displayName:`BuildPlease`,scope:`@buildplease`};`${f.name}`;const p={DI:{}},m=c.CoreL10nResource;var h=class extends Error{statusCode;code;details;constructor(e){super(e.message),this.name=`HttpError`,this.statusCode=e.statusCode,this.code=e.code,this.details=e.details}},g=class e{order=-10;hash(){return Symbol.for(`${f.scope}.webkit.networking.interceptor.cookie`)}equals(t){return t instanceof e}intercept(e){return{...e,withCredentials:!0}}};function _(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function v(e,t){return function(n,r){t(n,r,e)}}function y(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}const b=`Unknown Error`;let x=class{endpoint;interceptors=new S;constructor(e){this.endpoint=e,this.use(new g)}use(...e){return this.interceptors.add(...e),this}removeInterceptor(e){return this.interceptors.remove(e),this}clearInterceptors(){return this.interceptors.clear(),this}async execute(e,t){try{let n=await this.convertOrThrow(()=>this.endpoint.convertInput(e)),r={...t};for(let e of this.interceptors.list())r=e.intercept(r);let i=await this.endpoint.makeRequest(n,r);return await this.convertOrThrow(()=>this.endpoint.convertOutput(i))}catch(e){throw this.parseError(e)}}parseError(e){if(e instanceof h||e instanceof c.TimeoutError||e instanceof c.NetworkError||e instanceof c.CanceledError||e instanceof c.ConversionError||e instanceof c.UnknownError)return e;if(l.default.isCancel?.(e)||l.default.isAxiosError(e)&&(e.code===`ERR_CANCELED`||e.message===`canceled`))return new c.CanceledError({cause:e});if(l.default.isAxiosError(e)&&e.code===`ECONNABORTED`)return new c.TimeoutError({cause:e});if(l.default.isAxiosError(e)&&!e.response)return new c.NetworkError({message:e.message,cause:e});if(l.default.isAxiosError(e)&&e.response){let{status:t,data:n}=e.response,r=n;typeof r==`string`&&(r=(0,c.ignoreError)(()=>JSON.parse(r)).orDefault(r));let i=this.isStringArrayRecord(r.details)?r.details:void 0;return new h(this.buildHttpErrorOptions(t,r,i))}let t=e instanceof Error?e.message:b;return new c.UnknownError({message:t,cause:e})}async convertOrThrow(e){try{return await e()}catch(e){throw new c.ConversionError({cause:e})}}isStringArrayRecord(e){return!(0,c.isDefinedAndNotNull)(e)||!(0,c.isPlainObject)(e)?!1:Object.values(e).every(e=>Array.isArray(e)&&e.every(e=>typeof e==`string`))}buildHttpErrorOptions(e,t,n){return{statusCode:e,code:(0,c.isNonEmptyString)(t?.code)?t.code:`UNKNOWN_ERROR`,message:(0,c.isNonEmptyString)(t?.message)?t.message:b,details:n}}};x=y([(0,u.injectable)(),v(0,(0,u.unmanaged)()),_(`design:paramtypes`,[Object])],x);var S=class{map=new Map;add(...e){for(let t of e){let e=t.hash(),n=this.map.get(e);n&&n.equals(t)||this.map.set(e,t)}return this}remove(e){return this.map.delete(e.hash()),this}clear(){return this.map.clear(),this}list(){return[...this.map.values()].sort((e,t)=>e.order-t.order)}};function C(){let e=(0,c.coreAssembly)(),t=d();return[...e,...t]}Object.defineProperty(exports,"BaseRemoteResource",{enumerable:!0,get:function(){return x}}),exports.CookieInterceptor=g,exports.HttpError=h,exports.InterceptorSet=S,exports.WebKitL10nResource=m,exports.WebKitSymbols=p,exports.webkitAssembly=C,Object.keys(c).forEach(function(e){e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return c[e]}})});
@@ -0,0 +1,423 @@
1
+ import "reflect-metadata";
2
+ import { Assembly, AsyncOperation, Equatable, Hashable, Identity } from "@buildplease/core";
3
+ import { AxiosRequestConfig } from "axios";
4
+ export * from "@buildplease/core";
5
+ //#region src/di/symbols.d.ts
6
+ declare const WebKitSymbols: {
7
+ DI: {};
8
+ };
9
+ //#endregion
10
+ //#region src/l10n/resources.d.ts
11
+ declare const WebKitL10nResource: import("@buildplease/core").L10nResource<{
12
+ readonly en: {
13
+ readonly core: {
14
+ common: {
15
+ actions: {
16
+ save: string;
17
+ cancel: string;
18
+ delete: string;
19
+ confirm: string;
20
+ close: string;
21
+ back: string;
22
+ next: string;
23
+ };
24
+ date_time: {
25
+ relative: {
26
+ today: string;
27
+ tomorrow: string;
28
+ yesterday: string;
29
+ };
30
+ interval: {
31
+ second: {
32
+ one: string;
33
+ few: string;
34
+ many: string;
35
+ other: string;
36
+ };
37
+ minute: {
38
+ one: string;
39
+ few: string;
40
+ many: string;
41
+ other: string;
42
+ };
43
+ hour: {
44
+ one: string;
45
+ few: string;
46
+ many: string;
47
+ other: string;
48
+ };
49
+ day: {
50
+ one: string;
51
+ few: string;
52
+ many: string;
53
+ other: string;
54
+ };
55
+ week: {
56
+ one: string;
57
+ few: string;
58
+ many: string;
59
+ other: string;
60
+ };
61
+ month: {
62
+ one: string;
63
+ few: string;
64
+ many: string;
65
+ other: string;
66
+ };
67
+ year: {
68
+ one: string;
69
+ few: string;
70
+ many: string;
71
+ other: string;
72
+ };
73
+ };
74
+ weekday: {
75
+ monday: string;
76
+ tuesday: string;
77
+ wednesday: string;
78
+ thursday: string;
79
+ friday: string;
80
+ saturday: string;
81
+ sunday: string;
82
+ };
83
+ month: {
84
+ january: string;
85
+ february: string;
86
+ march: string;
87
+ april: string;
88
+ may: string;
89
+ june: string;
90
+ july: string;
91
+ august: string;
92
+ september: string;
93
+ october: string;
94
+ november: string;
95
+ december: string;
96
+ };
97
+ };
98
+ validation: {
99
+ opening_hours: {
100
+ time_required: string;
101
+ time_range_incomplete: string;
102
+ };
103
+ };
104
+ };
105
+ };
106
+ };
107
+ readonly sk: {
108
+ readonly core: {
109
+ common: {
110
+ actions: {
111
+ save: string;
112
+ cancel: string;
113
+ delete: string;
114
+ confirm: string;
115
+ close: string;
116
+ back: string;
117
+ next: string;
118
+ };
119
+ date_time: {
120
+ relative: {
121
+ today: string;
122
+ tomorrow: string;
123
+ yesterday: string;
124
+ };
125
+ interval: {
126
+ second: {
127
+ one: string;
128
+ few: string;
129
+ many: string;
130
+ other: string;
131
+ };
132
+ minute: {
133
+ one: string;
134
+ few: string;
135
+ many: string;
136
+ other: string;
137
+ };
138
+ hour: {
139
+ one: string;
140
+ few: string;
141
+ many: string;
142
+ other: string;
143
+ };
144
+ day: {
145
+ one: string;
146
+ few: string;
147
+ many: string;
148
+ other: string;
149
+ };
150
+ week: {
151
+ one: string;
152
+ few: string;
153
+ many: string;
154
+ other: string;
155
+ };
156
+ month: {
157
+ one: string;
158
+ few: string;
159
+ many: string;
160
+ other: string;
161
+ };
162
+ year: {
163
+ one: string;
164
+ few: string;
165
+ many: string;
166
+ other: string;
167
+ };
168
+ };
169
+ weekday: {
170
+ monday: string;
171
+ tuesday: string;
172
+ wednesday: string;
173
+ thursday: string;
174
+ friday: string;
175
+ saturday: string;
176
+ sunday: string;
177
+ };
178
+ month: {
179
+ january: string;
180
+ february: string;
181
+ march: string;
182
+ april: string;
183
+ may: string;
184
+ june: string;
185
+ july: string;
186
+ august: string;
187
+ september: string;
188
+ october: string;
189
+ november: string;
190
+ december: string;
191
+ };
192
+ };
193
+ validation: {
194
+ opening_hours: {
195
+ time_required: string;
196
+ time_range_incomplete: string;
197
+ };
198
+ };
199
+ };
200
+ };
201
+ };
202
+ readonly cs: {
203
+ readonly core: {
204
+ common: {
205
+ actions: {
206
+ save: string;
207
+ cancel: string;
208
+ delete: string;
209
+ confirm: string;
210
+ close: string;
211
+ back: string;
212
+ next: string;
213
+ };
214
+ date_time: {
215
+ relative: {
216
+ today: string;
217
+ tomorrow: string;
218
+ yesterday: string;
219
+ };
220
+ interval: {
221
+ second: {
222
+ one: string;
223
+ few: string;
224
+ many: string;
225
+ other: string;
226
+ };
227
+ minute: {
228
+ one: string;
229
+ few: string;
230
+ many: string;
231
+ other: string;
232
+ };
233
+ hour: {
234
+ one: string;
235
+ few: string;
236
+ many: string;
237
+ other: string;
238
+ };
239
+ day: {
240
+ one: string;
241
+ few: string;
242
+ many: string;
243
+ other: string;
244
+ };
245
+ week: {
246
+ one: string;
247
+ few: string;
248
+ many: string;
249
+ other: string;
250
+ };
251
+ month: {
252
+ one: string;
253
+ few: string;
254
+ many: string;
255
+ other: string;
256
+ };
257
+ year: {
258
+ one: string;
259
+ few: string;
260
+ many: string;
261
+ other: string;
262
+ };
263
+ };
264
+ weekday: {
265
+ monday: string;
266
+ tuesday: string;
267
+ wednesday: string;
268
+ thursday: string;
269
+ friday: string;
270
+ saturday: string;
271
+ sunday: string;
272
+ };
273
+ month: {
274
+ january: string;
275
+ february: string;
276
+ march: string;
277
+ april: string;
278
+ may: string;
279
+ june: string;
280
+ july: string;
281
+ august: string;
282
+ september: string;
283
+ october: string;
284
+ november: string;
285
+ december: string;
286
+ };
287
+ };
288
+ validation: {
289
+ opening_hours: {
290
+ time_required: string;
291
+ time_range_incomplete: string;
292
+ };
293
+ };
294
+ };
295
+ };
296
+ };
297
+ }>;
298
+ //#endregion
299
+ //#region src/model/index.d.ts
300
+ interface TableDataModel<T> {
301
+ items: T[];
302
+ pagination: TablePaginationModel;
303
+ }
304
+ interface TablePaginationModel {
305
+ currentPage: number;
306
+ pageSize: number;
307
+ total: number;
308
+ pageSizeOptions?: number[];
309
+ }
310
+ //#endregion
311
+ //#region src/networking/http-error.d.ts
312
+ interface HttpErrorOptions {
313
+ /**
314
+ * HTTP status code for the error response.
315
+ * @example 404 // Not Found
316
+ * @example 500 // Internal Server Error
317
+ */
318
+ statusCode: number;
319
+ /**
320
+ * Machine‐readable error code for programmatic handling.
321
+ * @example "UNAUTHORIZED"
322
+ * @example "RESOURCE_NOT_FOUND"
323
+ */
324
+ code: string;
325
+ /**
326
+ * Human‐readable error description (localized or raw).
327
+ * @example "Authentication required"
328
+ * @example "User profile not found"
329
+ */
330
+ message: string;
331
+ /**
332
+ * Optional structured details for debugging.
333
+ * Each key maps to an array of error messages for that field.
334
+ *
335
+ * @example
336
+ * {
337
+ * "email": ["must be a valid email address"],
338
+ * "password": ["required", "must be at least 8 characters"]
339
+ * }
340
+ */
341
+ details?: Record<string, string[]>;
342
+ }
343
+ /**
344
+ * A specialized `Error` carrying an HTTP status code, machine‐readable code,
345
+ * human‐readable message, and optional debug details.
346
+ *
347
+ * @example
348
+ * // Basic usage
349
+ * throw new HttpError({
350
+ * statusCode: 404,
351
+ * code: "NOT_FOUND",
352
+ * message: "Resource not found"
353
+ * });
354
+ *
355
+ * @example
356
+ * // With structured debug details
357
+ * throw new HttpError({
358
+ * statusCode: 422,
359
+ * code: "VALIDATION_ERROR",
360
+ * message: "One or more fields are invalid",
361
+ * details: {
362
+ * "email": ["must be a valid email address"],
363
+ * "password": ["required", "must be at least 8 characters"]
364
+ * }
365
+ * });
366
+ */
367
+ declare class HttpError extends Error {
368
+ readonly statusCode: HttpErrorOptions['statusCode'];
369
+ readonly code: HttpErrorOptions['code'];
370
+ readonly details?: HttpErrorOptions['details'];
371
+ constructor(options: HttpErrorOptions);
372
+ }
373
+ //#endregion
374
+ //#region src/networking/cookie-interceptor.d.ts
375
+ declare class CookieInterceptor implements RemoteRequestInterceptor {
376
+ order: number;
377
+ hash(): Identity;
378
+ equals(other: unknown): boolean;
379
+ intercept(config: RemoteRequestConfig): RemoteRequestConfig;
380
+ }
381
+ //#endregion
382
+ //#region src/networking/remote-endpoint.d.ts
383
+ interface RemoteEndpoint<Input, InputDto, Output, OutputDto> {
384
+ makeRequest(input: InputDto, options?: RemoteRequestConfig): Promise<OutputDto>;
385
+ convertInput(input: Input): Promise<InputDto>;
386
+ convertOutput(response: OutputDto): Promise<Output>;
387
+ }
388
+ //#endregion
389
+ //#region src/networking/remote-resource.d.ts
390
+ declare abstract class BaseRemoteResource<Input, Output, Endpoint extends RemoteEndpoint<Input, unknown, Output, unknown>> implements AsyncOperation<Input, Output> {
391
+ protected readonly endpoint: Endpoint;
392
+ protected readonly interceptors: InterceptorSet;
393
+ constructor(endpoint: Endpoint);
394
+ protected use(...items: RemoteRequestInterceptor[]): this;
395
+ protected removeInterceptor(item: RemoteRequestInterceptor): this;
396
+ protected clearInterceptors(): this;
397
+ execute(input: Input, options?: RemoteRequestConfig): Promise<Output>;
398
+ protected parseError(error: unknown): Error;
399
+ protected convertOrThrow<T>(fn: () => Promise<T>): Promise<T>;
400
+ private isStringArrayRecord;
401
+ private buildHttpErrorOptions;
402
+ }
403
+ //#endregion
404
+ //#region src/networking/remote-request-config.d.ts
405
+ type RemoteRequestConfig = AxiosRequestConfig;
406
+ //#endregion
407
+ //#region src/networking/remote-request-interceptor.d.ts
408
+ interface RemoteRequestInterceptor extends Equatable, Hashable {
409
+ order: number;
410
+ intercept(config: RemoteRequestConfig): RemoteRequestConfig;
411
+ }
412
+ declare class InterceptorSet {
413
+ private map;
414
+ add(...items: RemoteRequestInterceptor[]): this;
415
+ remove(item: RemoteRequestInterceptor): this;
416
+ clear(): this;
417
+ list(): RemoteRequestInterceptor[];
418
+ }
419
+ //#endregion
420
+ //#region src/index.d.ts
421
+ declare function webkitAssembly(): Assembly[];
422
+ //#endregion
423
+ export { BaseRemoteResource, CookieInterceptor, HttpError, HttpErrorOptions, InterceptorSet, RemoteEndpoint, RemoteRequestConfig, RemoteRequestInterceptor, TableDataModel, TablePaginationModel, WebKitL10nResource, WebKitSymbols, webkitAssembly };
@@ -0,0 +1,423 @@
1
+ import "reflect-metadata";
2
+ import { Assembly, AsyncOperation, Equatable, Hashable, Identity } from "@buildplease/core";
3
+ import { AxiosRequestConfig } from "axios";
4
+ export * from "@buildplease/core";
5
+ //#region src/di/symbols.d.ts
6
+ declare const WebKitSymbols: {
7
+ DI: {};
8
+ };
9
+ //#endregion
10
+ //#region src/l10n/resources.d.ts
11
+ declare const WebKitL10nResource: import("@buildplease/core").L10nResource<{
12
+ readonly en: {
13
+ readonly core: {
14
+ common: {
15
+ actions: {
16
+ save: string;
17
+ cancel: string;
18
+ delete: string;
19
+ confirm: string;
20
+ close: string;
21
+ back: string;
22
+ next: string;
23
+ };
24
+ date_time: {
25
+ relative: {
26
+ today: string;
27
+ tomorrow: string;
28
+ yesterday: string;
29
+ };
30
+ interval: {
31
+ second: {
32
+ one: string;
33
+ few: string;
34
+ many: string;
35
+ other: string;
36
+ };
37
+ minute: {
38
+ one: string;
39
+ few: string;
40
+ many: string;
41
+ other: string;
42
+ };
43
+ hour: {
44
+ one: string;
45
+ few: string;
46
+ many: string;
47
+ other: string;
48
+ };
49
+ day: {
50
+ one: string;
51
+ few: string;
52
+ many: string;
53
+ other: string;
54
+ };
55
+ week: {
56
+ one: string;
57
+ few: string;
58
+ many: string;
59
+ other: string;
60
+ };
61
+ month: {
62
+ one: string;
63
+ few: string;
64
+ many: string;
65
+ other: string;
66
+ };
67
+ year: {
68
+ one: string;
69
+ few: string;
70
+ many: string;
71
+ other: string;
72
+ };
73
+ };
74
+ weekday: {
75
+ monday: string;
76
+ tuesday: string;
77
+ wednesday: string;
78
+ thursday: string;
79
+ friday: string;
80
+ saturday: string;
81
+ sunday: string;
82
+ };
83
+ month: {
84
+ january: string;
85
+ february: string;
86
+ march: string;
87
+ april: string;
88
+ may: string;
89
+ june: string;
90
+ july: string;
91
+ august: string;
92
+ september: string;
93
+ october: string;
94
+ november: string;
95
+ december: string;
96
+ };
97
+ };
98
+ validation: {
99
+ opening_hours: {
100
+ time_required: string;
101
+ time_range_incomplete: string;
102
+ };
103
+ };
104
+ };
105
+ };
106
+ };
107
+ readonly sk: {
108
+ readonly core: {
109
+ common: {
110
+ actions: {
111
+ save: string;
112
+ cancel: string;
113
+ delete: string;
114
+ confirm: string;
115
+ close: string;
116
+ back: string;
117
+ next: string;
118
+ };
119
+ date_time: {
120
+ relative: {
121
+ today: string;
122
+ tomorrow: string;
123
+ yesterday: string;
124
+ };
125
+ interval: {
126
+ second: {
127
+ one: string;
128
+ few: string;
129
+ many: string;
130
+ other: string;
131
+ };
132
+ minute: {
133
+ one: string;
134
+ few: string;
135
+ many: string;
136
+ other: string;
137
+ };
138
+ hour: {
139
+ one: string;
140
+ few: string;
141
+ many: string;
142
+ other: string;
143
+ };
144
+ day: {
145
+ one: string;
146
+ few: string;
147
+ many: string;
148
+ other: string;
149
+ };
150
+ week: {
151
+ one: string;
152
+ few: string;
153
+ many: string;
154
+ other: string;
155
+ };
156
+ month: {
157
+ one: string;
158
+ few: string;
159
+ many: string;
160
+ other: string;
161
+ };
162
+ year: {
163
+ one: string;
164
+ few: string;
165
+ many: string;
166
+ other: string;
167
+ };
168
+ };
169
+ weekday: {
170
+ monday: string;
171
+ tuesday: string;
172
+ wednesday: string;
173
+ thursday: string;
174
+ friday: string;
175
+ saturday: string;
176
+ sunday: string;
177
+ };
178
+ month: {
179
+ january: string;
180
+ february: string;
181
+ march: string;
182
+ april: string;
183
+ may: string;
184
+ june: string;
185
+ july: string;
186
+ august: string;
187
+ september: string;
188
+ october: string;
189
+ november: string;
190
+ december: string;
191
+ };
192
+ };
193
+ validation: {
194
+ opening_hours: {
195
+ time_required: string;
196
+ time_range_incomplete: string;
197
+ };
198
+ };
199
+ };
200
+ };
201
+ };
202
+ readonly cs: {
203
+ readonly core: {
204
+ common: {
205
+ actions: {
206
+ save: string;
207
+ cancel: string;
208
+ delete: string;
209
+ confirm: string;
210
+ close: string;
211
+ back: string;
212
+ next: string;
213
+ };
214
+ date_time: {
215
+ relative: {
216
+ today: string;
217
+ tomorrow: string;
218
+ yesterday: string;
219
+ };
220
+ interval: {
221
+ second: {
222
+ one: string;
223
+ few: string;
224
+ many: string;
225
+ other: string;
226
+ };
227
+ minute: {
228
+ one: string;
229
+ few: string;
230
+ many: string;
231
+ other: string;
232
+ };
233
+ hour: {
234
+ one: string;
235
+ few: string;
236
+ many: string;
237
+ other: string;
238
+ };
239
+ day: {
240
+ one: string;
241
+ few: string;
242
+ many: string;
243
+ other: string;
244
+ };
245
+ week: {
246
+ one: string;
247
+ few: string;
248
+ many: string;
249
+ other: string;
250
+ };
251
+ month: {
252
+ one: string;
253
+ few: string;
254
+ many: string;
255
+ other: string;
256
+ };
257
+ year: {
258
+ one: string;
259
+ few: string;
260
+ many: string;
261
+ other: string;
262
+ };
263
+ };
264
+ weekday: {
265
+ monday: string;
266
+ tuesday: string;
267
+ wednesday: string;
268
+ thursday: string;
269
+ friday: string;
270
+ saturday: string;
271
+ sunday: string;
272
+ };
273
+ month: {
274
+ january: string;
275
+ february: string;
276
+ march: string;
277
+ april: string;
278
+ may: string;
279
+ june: string;
280
+ july: string;
281
+ august: string;
282
+ september: string;
283
+ october: string;
284
+ november: string;
285
+ december: string;
286
+ };
287
+ };
288
+ validation: {
289
+ opening_hours: {
290
+ time_required: string;
291
+ time_range_incomplete: string;
292
+ };
293
+ };
294
+ };
295
+ };
296
+ };
297
+ }>;
298
+ //#endregion
299
+ //#region src/model/index.d.ts
300
+ interface TableDataModel<T> {
301
+ items: T[];
302
+ pagination: TablePaginationModel;
303
+ }
304
+ interface TablePaginationModel {
305
+ currentPage: number;
306
+ pageSize: number;
307
+ total: number;
308
+ pageSizeOptions?: number[];
309
+ }
310
+ //#endregion
311
+ //#region src/networking/http-error.d.ts
312
+ interface HttpErrorOptions {
313
+ /**
314
+ * HTTP status code for the error response.
315
+ * @example 404 // Not Found
316
+ * @example 500 // Internal Server Error
317
+ */
318
+ statusCode: number;
319
+ /**
320
+ * Machine‐readable error code for programmatic handling.
321
+ * @example "UNAUTHORIZED"
322
+ * @example "RESOURCE_NOT_FOUND"
323
+ */
324
+ code: string;
325
+ /**
326
+ * Human‐readable error description (localized or raw).
327
+ * @example "Authentication required"
328
+ * @example "User profile not found"
329
+ */
330
+ message: string;
331
+ /**
332
+ * Optional structured details for debugging.
333
+ * Each key maps to an array of error messages for that field.
334
+ *
335
+ * @example
336
+ * {
337
+ * "email": ["must be a valid email address"],
338
+ * "password": ["required", "must be at least 8 characters"]
339
+ * }
340
+ */
341
+ details?: Record<string, string[]>;
342
+ }
343
+ /**
344
+ * A specialized `Error` carrying an HTTP status code, machine‐readable code,
345
+ * human‐readable message, and optional debug details.
346
+ *
347
+ * @example
348
+ * // Basic usage
349
+ * throw new HttpError({
350
+ * statusCode: 404,
351
+ * code: "NOT_FOUND",
352
+ * message: "Resource not found"
353
+ * });
354
+ *
355
+ * @example
356
+ * // With structured debug details
357
+ * throw new HttpError({
358
+ * statusCode: 422,
359
+ * code: "VALIDATION_ERROR",
360
+ * message: "One or more fields are invalid",
361
+ * details: {
362
+ * "email": ["must be a valid email address"],
363
+ * "password": ["required", "must be at least 8 characters"]
364
+ * }
365
+ * });
366
+ */
367
+ declare class HttpError extends Error {
368
+ readonly statusCode: HttpErrorOptions['statusCode'];
369
+ readonly code: HttpErrorOptions['code'];
370
+ readonly details?: HttpErrorOptions['details'];
371
+ constructor(options: HttpErrorOptions);
372
+ }
373
+ //#endregion
374
+ //#region src/networking/cookie-interceptor.d.ts
375
+ declare class CookieInterceptor implements RemoteRequestInterceptor {
376
+ order: number;
377
+ hash(): Identity;
378
+ equals(other: unknown): boolean;
379
+ intercept(config: RemoteRequestConfig): RemoteRequestConfig;
380
+ }
381
+ //#endregion
382
+ //#region src/networking/remote-endpoint.d.ts
383
+ interface RemoteEndpoint<Input, InputDto, Output, OutputDto> {
384
+ makeRequest(input: InputDto, options?: RemoteRequestConfig): Promise<OutputDto>;
385
+ convertInput(input: Input): Promise<InputDto>;
386
+ convertOutput(response: OutputDto): Promise<Output>;
387
+ }
388
+ //#endregion
389
+ //#region src/networking/remote-resource.d.ts
390
+ declare abstract class BaseRemoteResource<Input, Output, Endpoint extends RemoteEndpoint<Input, unknown, Output, unknown>> implements AsyncOperation<Input, Output> {
391
+ protected readonly endpoint: Endpoint;
392
+ protected readonly interceptors: InterceptorSet;
393
+ constructor(endpoint: Endpoint);
394
+ protected use(...items: RemoteRequestInterceptor[]): this;
395
+ protected removeInterceptor(item: RemoteRequestInterceptor): this;
396
+ protected clearInterceptors(): this;
397
+ execute(input: Input, options?: RemoteRequestConfig): Promise<Output>;
398
+ protected parseError(error: unknown): Error;
399
+ protected convertOrThrow<T>(fn: () => Promise<T>): Promise<T>;
400
+ private isStringArrayRecord;
401
+ private buildHttpErrorOptions;
402
+ }
403
+ //#endregion
404
+ //#region src/networking/remote-request-config.d.ts
405
+ type RemoteRequestConfig = AxiosRequestConfig;
406
+ //#endregion
407
+ //#region src/networking/remote-request-interceptor.d.ts
408
+ interface RemoteRequestInterceptor extends Equatable, Hashable {
409
+ order: number;
410
+ intercept(config: RemoteRequestConfig): RemoteRequestConfig;
411
+ }
412
+ declare class InterceptorSet {
413
+ private map;
414
+ add(...items: RemoteRequestInterceptor[]): this;
415
+ remove(item: RemoteRequestInterceptor): this;
416
+ clear(): this;
417
+ list(): RemoteRequestInterceptor[];
418
+ }
419
+ //#endregion
420
+ //#region src/index.d.ts
421
+ declare function webkitAssembly(): Assembly[];
422
+ //#endregion
423
+ export { BaseRemoteResource, CookieInterceptor, HttpError, HttpErrorOptions, InterceptorSet, RemoteEndpoint, RemoteRequestConfig, RemoteRequestInterceptor, TableDataModel, TablePaginationModel, WebKitL10nResource, WebKitSymbols, webkitAssembly };
@@ -0,0 +1 @@
1
+ import"reflect-metadata";import{CanceledError as e,ConversionError as t,CoreL10nResource as n,NetworkError as r,TimeoutError as i,UnknownError as a,coreAssembly as o,ignoreError as s,isDefinedAndNotNull as c,isNonEmptyString as l,isPlainObject as u}from"@buildplease/core";import d from"axios";import{injectable as f,unmanaged as p}from"inversify";export*from"@buildplease/core";function m(){return[]}const h={name:`buildplease`,displayName:`BuildPlease`,scope:`@buildplease`};`${h.name}`;const g={DI:{}},_=n;var v=class extends Error{statusCode;code;details;constructor(e){super(e.message),this.name=`HttpError`,this.statusCode=e.statusCode,this.code=e.code,this.details=e.details}},y=class e{order=-10;hash(){return Symbol.for(`${h.scope}.webkit.networking.interceptor.cookie`)}equals(t){return t instanceof e}intercept(e){return{...e,withCredentials:!0}}};function b(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function x(e,t){return function(n,r){t(n,r,e)}}function S(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}const C=`Unknown Error`;let w=class{endpoint;interceptors=new T;constructor(e){this.endpoint=e,this.use(new y)}use(...e){return this.interceptors.add(...e),this}removeInterceptor(e){return this.interceptors.remove(e),this}clearInterceptors(){return this.interceptors.clear(),this}async execute(e,t){try{let n=await this.convertOrThrow(()=>this.endpoint.convertInput(e)),r={...t};for(let e of this.interceptors.list())r=e.intercept(r);let i=await this.endpoint.makeRequest(n,r);return await this.convertOrThrow(()=>this.endpoint.convertOutput(i))}catch(e){throw this.parseError(e)}}parseError(n){if(n instanceof v||n instanceof i||n instanceof r||n instanceof e||n instanceof t||n instanceof a)return n;if(d.isCancel?.(n)||d.isAxiosError(n)&&(n.code===`ERR_CANCELED`||n.message===`canceled`))return new e({cause:n});if(d.isAxiosError(n)&&n.code===`ECONNABORTED`)return new i({cause:n});if(d.isAxiosError(n)&&!n.response)return new r({message:n.message,cause:n});if(d.isAxiosError(n)&&n.response){let{status:e,data:t}=n.response,r=t;typeof r==`string`&&(r=s(()=>JSON.parse(r)).orDefault(r));let i=this.isStringArrayRecord(r.details)?r.details:void 0;return new v(this.buildHttpErrorOptions(e,r,i))}let o=n instanceof Error?n.message:C;return new a({message:o,cause:n})}async convertOrThrow(e){try{return await e()}catch(e){throw new t({cause:e})}}isStringArrayRecord(e){return!c(e)||!u(e)?!1:Object.values(e).every(e=>Array.isArray(e)&&e.every(e=>typeof e==`string`))}buildHttpErrorOptions(e,t,n){return{statusCode:e,code:l(t?.code)?t.code:`UNKNOWN_ERROR`,message:l(t?.message)?t.message:C,details:n}}};w=S([f(),x(0,p()),b(`design:paramtypes`,[Object])],w);var T=class{map=new Map;add(...e){for(let t of e){let e=t.hash(),n=this.map.get(e);n&&n.equals(t)||this.map.set(e,t)}return this}remove(e){return this.map.delete(e.hash()),this}clear(){return this.map.clear(),this}list(){return[...this.map.values()].sort((e,t)=>e.order-t.order)}};function E(){let e=o(),t=m();return[...e,...t]}export{w as BaseRemoteResource,y as CookieInterceptor,v as HttpError,T as InterceptorSet,_ as WebKitL10nResource,g as WebKitSymbols,E as webkitAssembly};
@@ -0,0 +1 @@
1
+ var e=require("@buildplease/core/node");Object.keys(e).forEach(function(t){t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
@@ -0,0 +1 @@
1
+ export * from "@buildplease/core/node";
@@ -0,0 +1 @@
1
+ export * from "@buildplease/core/node";
@@ -0,0 +1 @@
1
+ export*from"@buildplease/core/node";export{};
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@buildplease/webkit",
3
+ "version": "1.0.0",
4
+ "keywords": [],
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/BuildPlease/buildplease.git",
8
+ "directory": "packages/webkit"
9
+ },
10
+ "license": "MIT",
11
+ "author": "Simon Rastislav Kovačič",
12
+ "type": "module",
13
+ "exports": {
14
+ ".": {
15
+ "import": {
16
+ "types": "./dist/src/index.d.ts",
17
+ "default": "./dist/src/index.js"
18
+ },
19
+ "require": {
20
+ "types": "./dist/src/index.d.cts",
21
+ "default": "./dist/src/index.cjs"
22
+ }
23
+ },
24
+ "./node": {
25
+ "import": {
26
+ "types": "./dist/src-node/index.d.mts",
27
+ "default": "./dist/src-node/index.mjs"
28
+ },
29
+ "require": {
30
+ "types": "./dist/src-node/index.d.cts",
31
+ "default": "./dist/src-node/index.cjs"
32
+ }
33
+ }
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "resources"
38
+ ],
39
+ "dependencies": {
40
+ "axios": "1.19.0",
41
+ "@buildplease/core": "1.0.0"
42
+ },
43
+ "devDependencies": {
44
+ "@buildplease/identity": "1.0.0"
45
+ },
46
+ "peerDependencies": {
47
+ "inversify": "8.2.3",
48
+ "reflect-metadata": "0.2.2",
49
+ "zod": "4.4.3"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public",
53
+ "registry": "https://registry.npmjs.org/"
54
+ },
55
+ "scripts": {
56
+ "build": "tsdown --config-loader unrun",
57
+ "test": "vitest run",
58
+ "typecheck": "tsc -p tsconfig.json --noEmit"
59
+ }
60
+ }
@@ -0,0 +1 @@
1
+ export const Resources = {} as const;