@sudobility/tapayoka_types 0.0.2
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/dist/index.cjs +37 -0
- package/dist/index.d.ts +300 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/package.json +63 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @sudobility/tapayoka_types
|
|
4
|
+
* TypeScript types for Tapayoka - QR-to-device cashless payment system
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.BLE_DEVICE_NAME_PREFIX = exports.BLE_CHAR_RESPONSE_UUID = exports.BLE_CHAR_COMMAND_UUID = exports.BLE_CHAR_DEVICE_INFO_UUID = exports.BLE_SERVICE_UUID = void 0;
|
|
8
|
+
exports.successResponse = successResponse;
|
|
9
|
+
exports.errorResponse = errorResponse;
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// BLE Service UUIDs
|
|
12
|
+
// =============================================================================
|
|
13
|
+
exports.BLE_SERVICE_UUID = '000088F4-0000-1000-8000-00805f9b34fb';
|
|
14
|
+
exports.BLE_CHAR_DEVICE_INFO_UUID = '00000E32-0000-1000-8000-00805f9b34fb';
|
|
15
|
+
exports.BLE_CHAR_COMMAND_UUID = '00000E33-0000-1000-8000-00805f9b34fb';
|
|
16
|
+
exports.BLE_CHAR_RESPONSE_UUID = '00000E34-0000-1000-8000-00805f9b34fb';
|
|
17
|
+
exports.BLE_DEVICE_NAME_PREFIX = 'tapayoka-';
|
|
18
|
+
// =============================================================================
|
|
19
|
+
// Response Helper Functions
|
|
20
|
+
// =============================================================================
|
|
21
|
+
/** Create a success response */
|
|
22
|
+
function successResponse(data) {
|
|
23
|
+
return {
|
|
24
|
+
success: true,
|
|
25
|
+
data,
|
|
26
|
+
timestamp: new Date().toISOString(),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Create an error response */
|
|
30
|
+
function errorResponse(error) {
|
|
31
|
+
return {
|
|
32
|
+
success: false,
|
|
33
|
+
error,
|
|
34
|
+
timestamp: new Date().toISOString(),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sudobility/tapayoka_types
|
|
3
|
+
* TypeScript types for Tapayoka - QR-to-device cashless payment system
|
|
4
|
+
*/
|
|
5
|
+
export type { ApiResponse, BaseResponse, NetworkClient, Optional, PaginatedResponse, PaginationInfo, PaginationOptions, } from '@sudobility/types';
|
|
6
|
+
import type { Optional, BaseResponse } from '@sudobility/types';
|
|
7
|
+
export type ServiceType = 'TRIGGER' | 'FIXED' | 'VARIABLE';
|
|
8
|
+
export type OrderStatus = 'CREATED' | 'PAID' | 'AUTHORIZED' | 'RUNNING' | 'DONE' | 'FAILED';
|
|
9
|
+
export type DeviceStatus = 'ACTIVE' | 'OFFLINE' | 'MAINTENANCE' | 'DEACTIVATED';
|
|
10
|
+
export type UserRole = 'vendor' | 'buyer';
|
|
11
|
+
export type LogDirection = 'PI_TO_SRV' | 'SRV_TO_PI';
|
|
12
|
+
export interface User {
|
|
13
|
+
id: string;
|
|
14
|
+
firebaseUid: string;
|
|
15
|
+
email: string | null;
|
|
16
|
+
displayName: string | null;
|
|
17
|
+
role: UserRole;
|
|
18
|
+
createdAt: Date | null;
|
|
19
|
+
updatedAt: Date | null;
|
|
20
|
+
}
|
|
21
|
+
export interface Device {
|
|
22
|
+
walletAddress: string;
|
|
23
|
+
entityId: string;
|
|
24
|
+
label: string;
|
|
25
|
+
model: string | null;
|
|
26
|
+
location: string | null;
|
|
27
|
+
gpioConfig: GpioConfig | null;
|
|
28
|
+
status: DeviceStatus;
|
|
29
|
+
serverWalletAddress: string | null;
|
|
30
|
+
createdAt: Date | null;
|
|
31
|
+
updatedAt: Date | null;
|
|
32
|
+
}
|
|
33
|
+
export interface GpioConfig {
|
|
34
|
+
pin: number;
|
|
35
|
+
activeLow?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface Service {
|
|
38
|
+
id: string;
|
|
39
|
+
entityId: string;
|
|
40
|
+
name: string;
|
|
41
|
+
description: string | null;
|
|
42
|
+
type: ServiceType;
|
|
43
|
+
priceCents: number;
|
|
44
|
+
fixedMinutes: number | null;
|
|
45
|
+
minutesPer25c: number | null;
|
|
46
|
+
active: boolean;
|
|
47
|
+
createdAt: Date | null;
|
|
48
|
+
updatedAt: Date | null;
|
|
49
|
+
}
|
|
50
|
+
export interface DeviceService {
|
|
51
|
+
deviceWalletAddress: string;
|
|
52
|
+
serviceId: string;
|
|
53
|
+
}
|
|
54
|
+
export interface Order {
|
|
55
|
+
id: string;
|
|
56
|
+
deviceWalletAddress: string;
|
|
57
|
+
serviceId: string;
|
|
58
|
+
buyerUid: string | null;
|
|
59
|
+
amountCents: number;
|
|
60
|
+
authorizedSeconds: number;
|
|
61
|
+
status: OrderStatus;
|
|
62
|
+
stripePaymentIntentId: string | null;
|
|
63
|
+
createdAt: Date | null;
|
|
64
|
+
updatedAt: Date | null;
|
|
65
|
+
}
|
|
66
|
+
export interface Authorization {
|
|
67
|
+
id: string;
|
|
68
|
+
orderId: string;
|
|
69
|
+
payloadJson: string;
|
|
70
|
+
serverSignature: string;
|
|
71
|
+
expiresAt: Date;
|
|
72
|
+
createdAt: Date | null;
|
|
73
|
+
}
|
|
74
|
+
export interface DeviceLog {
|
|
75
|
+
id: string;
|
|
76
|
+
deviceWalletAddress: string;
|
|
77
|
+
direction: LogDirection;
|
|
78
|
+
ok: boolean;
|
|
79
|
+
details: string | null;
|
|
80
|
+
createdAt: Date | null;
|
|
81
|
+
}
|
|
82
|
+
export interface AdminLog {
|
|
83
|
+
id: string;
|
|
84
|
+
userId: string;
|
|
85
|
+
action: string;
|
|
86
|
+
entityType: string | null;
|
|
87
|
+
entityId: string | null;
|
|
88
|
+
details: string | null;
|
|
89
|
+
createdAt: Date | null;
|
|
90
|
+
}
|
|
91
|
+
/** Buyer sends device signature to server for verification */
|
|
92
|
+
export interface DeviceVerifyRequest {
|
|
93
|
+
deviceWalletAddress: string;
|
|
94
|
+
signedPayload: string;
|
|
95
|
+
signature: string;
|
|
96
|
+
}
|
|
97
|
+
/** Create a new order */
|
|
98
|
+
export interface CreateOrderRequest {
|
|
99
|
+
deviceWalletAddress: string;
|
|
100
|
+
serviceId: string;
|
|
101
|
+
amountCents: number;
|
|
102
|
+
}
|
|
103
|
+
/** Process payment for an order */
|
|
104
|
+
export interface ProcessPaymentRequest {
|
|
105
|
+
orderId: string;
|
|
106
|
+
paymentMethodId: string;
|
|
107
|
+
}
|
|
108
|
+
/** Request authorization after payment */
|
|
109
|
+
export interface CreateAuthorizationRequest {
|
|
110
|
+
orderId: string;
|
|
111
|
+
}
|
|
112
|
+
/** Report telemetry event from device */
|
|
113
|
+
export interface TelemetryEventRequest {
|
|
114
|
+
deviceWalletAddress: string;
|
|
115
|
+
direction: LogDirection;
|
|
116
|
+
ok: boolean;
|
|
117
|
+
details?: string;
|
|
118
|
+
}
|
|
119
|
+
/** Register a new device */
|
|
120
|
+
export interface DeviceCreateRequest {
|
|
121
|
+
walletAddress: string;
|
|
122
|
+
label: string;
|
|
123
|
+
model: Optional<string>;
|
|
124
|
+
location: Optional<string>;
|
|
125
|
+
gpioConfig: Optional<GpioConfig>;
|
|
126
|
+
}
|
|
127
|
+
/** Update an existing device */
|
|
128
|
+
export interface DeviceUpdateRequest {
|
|
129
|
+
label: Optional<string>;
|
|
130
|
+
model: Optional<string>;
|
|
131
|
+
location: Optional<string>;
|
|
132
|
+
gpioConfig: Optional<GpioConfig>;
|
|
133
|
+
status: Optional<DeviceStatus>;
|
|
134
|
+
}
|
|
135
|
+
/** Create a new service/product */
|
|
136
|
+
export interface ServiceCreateRequest {
|
|
137
|
+
name: string;
|
|
138
|
+
description: Optional<string>;
|
|
139
|
+
type: ServiceType;
|
|
140
|
+
priceCents: number;
|
|
141
|
+
fixedMinutes: Optional<number>;
|
|
142
|
+
minutesPer25c: Optional<number>;
|
|
143
|
+
}
|
|
144
|
+
/** Update an existing service */
|
|
145
|
+
export interface ServiceUpdateRequest {
|
|
146
|
+
name: Optional<string>;
|
|
147
|
+
description: Optional<string>;
|
|
148
|
+
type: Optional<ServiceType>;
|
|
149
|
+
priceCents: Optional<number>;
|
|
150
|
+
fixedMinutes: Optional<number>;
|
|
151
|
+
minutesPer25c: Optional<number>;
|
|
152
|
+
active: Optional<boolean>;
|
|
153
|
+
}
|
|
154
|
+
/** Assign services to a device */
|
|
155
|
+
export interface DeviceServiceAssignRequest {
|
|
156
|
+
serviceIds: string[];
|
|
157
|
+
}
|
|
158
|
+
/** Generate QR code for a device */
|
|
159
|
+
export interface QrGenerateRequest {
|
|
160
|
+
deviceWalletAddress: string;
|
|
161
|
+
format?: 'svg' | 'png';
|
|
162
|
+
size?: number;
|
|
163
|
+
}
|
|
164
|
+
/** Response after verifying device signature */
|
|
165
|
+
export interface DeviceVerifyResponse {
|
|
166
|
+
device: Device;
|
|
167
|
+
services: Service[];
|
|
168
|
+
}
|
|
169
|
+
/** Response with signed authorization */
|
|
170
|
+
export interface AuthorizationResponse {
|
|
171
|
+
authorization: Authorization;
|
|
172
|
+
payload: AuthorizationPayload;
|
|
173
|
+
serverSignature: string;
|
|
174
|
+
}
|
|
175
|
+
/** Dashboard stats overview */
|
|
176
|
+
export interface DashboardStats {
|
|
177
|
+
totalDevices: number;
|
|
178
|
+
activeDevices: number;
|
|
179
|
+
totalOrders: number;
|
|
180
|
+
activeOrders: number;
|
|
181
|
+
revenueTodayCents: number;
|
|
182
|
+
revenueThisWeekCents: number;
|
|
183
|
+
successRate: number;
|
|
184
|
+
}
|
|
185
|
+
/** Orders chart data point */
|
|
186
|
+
export interface OrdersChartData {
|
|
187
|
+
date: string;
|
|
188
|
+
count: number;
|
|
189
|
+
revenueCents: number;
|
|
190
|
+
}
|
|
191
|
+
/** Device status distribution */
|
|
192
|
+
export interface DeviceStatusData {
|
|
193
|
+
status: DeviceStatus;
|
|
194
|
+
count: number;
|
|
195
|
+
}
|
|
196
|
+
/** Device with summary info */
|
|
197
|
+
export interface DeviceSummary extends Device {
|
|
198
|
+
serviceCount: number;
|
|
199
|
+
totalOrders: number;
|
|
200
|
+
lastOrderAt: Date | null;
|
|
201
|
+
}
|
|
202
|
+
/** Order with joined details */
|
|
203
|
+
export interface OrderDetailed extends Order {
|
|
204
|
+
deviceLabel: string;
|
|
205
|
+
serviceName: string;
|
|
206
|
+
serviceType: ServiceType;
|
|
207
|
+
}
|
|
208
|
+
/** QR code generation response */
|
|
209
|
+
export interface QrCodeResponse {
|
|
210
|
+
deviceWalletAddress: string;
|
|
211
|
+
qrData: string;
|
|
212
|
+
format: 'svg' | 'png';
|
|
213
|
+
}
|
|
214
|
+
export interface OrderQueryParams {
|
|
215
|
+
status?: OrderStatus;
|
|
216
|
+
deviceWalletAddress?: string;
|
|
217
|
+
limit?: number;
|
|
218
|
+
offset?: number;
|
|
219
|
+
}
|
|
220
|
+
export interface DeviceQueryParams {
|
|
221
|
+
status?: DeviceStatus;
|
|
222
|
+
limit?: number;
|
|
223
|
+
offset?: number;
|
|
224
|
+
}
|
|
225
|
+
export interface LogQueryParams {
|
|
226
|
+
deviceWalletAddress?: string;
|
|
227
|
+
direction?: LogDirection;
|
|
228
|
+
limit?: number;
|
|
229
|
+
offset?: number;
|
|
230
|
+
}
|
|
231
|
+
/** Challenge payload device signs to prove identity */
|
|
232
|
+
export interface BleDeviceChallenge {
|
|
233
|
+
walletAddress: string;
|
|
234
|
+
timestamp: number;
|
|
235
|
+
nonce: string;
|
|
236
|
+
}
|
|
237
|
+
/** Authorization payload sent to device via BLE */
|
|
238
|
+
export interface AuthorizationPayload {
|
|
239
|
+
orderId: string;
|
|
240
|
+
serviceType: ServiceType;
|
|
241
|
+
seconds: number;
|
|
242
|
+
nonce: string;
|
|
243
|
+
exp: number;
|
|
244
|
+
}
|
|
245
|
+
/** BLE command sent from buyer app to device */
|
|
246
|
+
export interface BleCommand {
|
|
247
|
+
command: 'SETUP_SERVER' | 'AUTHORIZE' | 'ON' | 'OFF' | 'STATUS';
|
|
248
|
+
payload?: string;
|
|
249
|
+
signature?: string;
|
|
250
|
+
}
|
|
251
|
+
/** BLE response from device */
|
|
252
|
+
export interface BleDeviceResponse {
|
|
253
|
+
status: 'OK' | 'ERROR' | 'BUSY' | 'UNAUTHORIZED';
|
|
254
|
+
message?: string;
|
|
255
|
+
data?: string;
|
|
256
|
+
}
|
|
257
|
+
/** Device info read from BLE characteristic */
|
|
258
|
+
export interface BleDeviceInfo {
|
|
259
|
+
walletAddress: string;
|
|
260
|
+
firmwareVersion: string;
|
|
261
|
+
hasServerWallet: boolean;
|
|
262
|
+
}
|
|
263
|
+
export declare const BLE_SERVICE_UUID = "000088F4-0000-1000-8000-00805f9b34fb";
|
|
264
|
+
export declare const BLE_CHAR_DEVICE_INFO_UUID = "00000E32-0000-1000-8000-00805f9b34fb";
|
|
265
|
+
export declare const BLE_CHAR_COMMAND_UUID = "00000E33-0000-1000-8000-00805f9b34fb";
|
|
266
|
+
export declare const BLE_CHAR_RESPONSE_UUID = "00000E34-0000-1000-8000-00805f9b34fb";
|
|
267
|
+
export declare const BLE_DEVICE_NAME_PREFIX = "tapayoka-";
|
|
268
|
+
/** Signed message with Ethereum wallet */
|
|
269
|
+
export interface EthSignedMessage {
|
|
270
|
+
message: string;
|
|
271
|
+
signature: string;
|
|
272
|
+
address: string;
|
|
273
|
+
}
|
|
274
|
+
/** Create a success response */
|
|
275
|
+
export declare function successResponse<T>(data: T): BaseResponse<T>;
|
|
276
|
+
/** Create an error response */
|
|
277
|
+
export declare function errorResponse(error: string): BaseResponse<never>;
|
|
278
|
+
export type DeviceListResponse = BaseResponse<Device[]>;
|
|
279
|
+
export type DeviceSummaryListResponse = BaseResponse<DeviceSummary[]>;
|
|
280
|
+
export type DeviceResponse = BaseResponse<Device>;
|
|
281
|
+
export type DeviceVerifyApiResponse = BaseResponse<DeviceVerifyResponse>;
|
|
282
|
+
export type ServiceListResponse = BaseResponse<Service[]>;
|
|
283
|
+
export type ServiceResponse = BaseResponse<Service>;
|
|
284
|
+
export type OrderListResponse = BaseResponse<Order[]>;
|
|
285
|
+
export type OrderDetailedListResponse = BaseResponse<OrderDetailed[]>;
|
|
286
|
+
export type OrderResponse = BaseResponse<Order>;
|
|
287
|
+
export type AuthorizationApiResponse = BaseResponse<AuthorizationResponse>;
|
|
288
|
+
export type DashboardStatsResponse = BaseResponse<DashboardStats>;
|
|
289
|
+
export type OrdersChartResponse = BaseResponse<OrdersChartData[]>;
|
|
290
|
+
export type DeviceStatusResponse = BaseResponse<DeviceStatusData[]>;
|
|
291
|
+
export type QrCodeApiResponse = BaseResponse<QrCodeResponse>;
|
|
292
|
+
export type DeviceLogListResponse = BaseResponse<DeviceLog[]>;
|
|
293
|
+
export type AdminLogListResponse = BaseResponse<AdminLog[]>;
|
|
294
|
+
export interface HealthCheckData {
|
|
295
|
+
name: string;
|
|
296
|
+
version: string;
|
|
297
|
+
status: string;
|
|
298
|
+
}
|
|
299
|
+
export type HealthCheckResponse = BaseResponse<HealthCheckData>;
|
|
300
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,WAAW,EACX,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,cAAc,EACd,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMhE,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;AAE3D,MAAM,MAAM,WAA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GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAClE,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,eAAe,EAAE,CAAC,CAAC;AAClE,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAGpE,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAG7D,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC;AAC9D,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;AAG5D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sudobility/tapayoka_types
|
|
3
|
+
* TypeScript types for Tapayoka - QR-to-device cashless payment system
|
|
4
|
+
*/
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// BLE Service UUIDs
|
|
7
|
+
// =============================================================================
|
|
8
|
+
export const BLE_SERVICE_UUID = '000088F4-0000-1000-8000-00805f9b34fb';
|
|
9
|
+
export const BLE_CHAR_DEVICE_INFO_UUID = '00000E32-0000-1000-8000-00805f9b34fb';
|
|
10
|
+
export const BLE_CHAR_COMMAND_UUID = '00000E33-0000-1000-8000-00805f9b34fb';
|
|
11
|
+
export const BLE_CHAR_RESPONSE_UUID = '00000E34-0000-1000-8000-00805f9b34fb';
|
|
12
|
+
export const BLE_DEVICE_NAME_PREFIX = 'tapayoka-';
|
|
13
|
+
// =============================================================================
|
|
14
|
+
// Response Helper Functions
|
|
15
|
+
// =============================================================================
|
|
16
|
+
/** Create a success response */
|
|
17
|
+
export function successResponse(data) {
|
|
18
|
+
return {
|
|
19
|
+
success: true,
|
|
20
|
+
data,
|
|
21
|
+
timestamp: new Date().toISOString(),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Create an error response */
|
|
25
|
+
export function errorResponse(error) {
|
|
26
|
+
return {
|
|
27
|
+
success: false,
|
|
28
|
+
error,
|
|
29
|
+
timestamp: new Date().toISOString(),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8VH,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF,MAAM,CAAC,MAAM,gBAAgB,GAAG,sCAAsC,CAAC;AACvE,MAAM,CAAC,MAAM,yBAAyB,GAAG,sCAAsC,CAAC;AAChF,MAAM,CAAC,MAAM,qBAAqB,GAAG,sCAAsC,CAAC;AAC5E,MAAM,CAAC,MAAM,sBAAsB,GAAG,sCAAsC,CAAC;AAC7E,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAC;AAalD,gFAAgF;AAChF,4BAA4B;AAC5B,gFAAgF;AAEhF,gCAAgC;AAChC,MAAM,UAAU,eAAe,CAAI,IAAO;IACxC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,IAAI;QACJ,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;AACJ,CAAC;AAED,+BAA+B;AAC/B,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO;QACL,OAAO,EAAE,KAAK;QACd,KAAK;QACL,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sudobility/tapayoka_types",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "TypeScript types for Tapayoka - QR-to-device cashless payment system",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.cjs",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "bun run build:esm && bun run build:cjs",
|
|
17
|
+
"build:esm": "bunx tsc -p tsconfig.esm.json",
|
|
18
|
+
"build:cjs": "bunx tsc -p tsconfig.cjs.json && bun run build:cjs-rename && rm -rf dist-cjs",
|
|
19
|
+
"build:cjs-rename": "find dist-cjs -name '*.js' -exec sh -c 'cp \"$1\" \"dist/$(basename \"${1%.js}.cjs\")\"' _ {} \\;",
|
|
20
|
+
"clean": "rm -rf dist",
|
|
21
|
+
"dev": "bunx tsc --watch",
|
|
22
|
+
"typecheck": "bunx tsc --noEmit",
|
|
23
|
+
"lint": "bunx eslint src/",
|
|
24
|
+
"lint:fix": "bunx eslint src/ --fix",
|
|
25
|
+
"format": "bunx prettier --write \"src/**/*.ts\"",
|
|
26
|
+
"format:check": "bunx prettier --check \"src/**/*.ts\"",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"verify": "bun run typecheck && bun run lint && bun run build",
|
|
30
|
+
"prepublishOnly": "bun run clean && bun run verify"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist/**/*"
|
|
34
|
+
],
|
|
35
|
+
"keywords": [
|
|
36
|
+
"typescript",
|
|
37
|
+
"types",
|
|
38
|
+
"tapayoka",
|
|
39
|
+
"cashless",
|
|
40
|
+
"payment",
|
|
41
|
+
"ble",
|
|
42
|
+
"iot"
|
|
43
|
+
],
|
|
44
|
+
"author": "Sudobility",
|
|
45
|
+
"license": "BUSL-1.1",
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@sudobility/types": "^1.9.54"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@eslint/js": "^9.39.2",
|
|
51
|
+
"@sudobility/types": "^1.9.54",
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^8.50.0",
|
|
53
|
+
"@typescript-eslint/parser": "^8.50.0",
|
|
54
|
+
"eslint": "^9.39.2",
|
|
55
|
+
"globals": "^16.5.0",
|
|
56
|
+
"prettier": "^3.7.4",
|
|
57
|
+
"typescript": "^5.9.3",
|
|
58
|
+
"vitest": "^4.0.16"
|
|
59
|
+
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
}
|
|
63
|
+
}
|