@pikku/addon-meta-conversions 0.1.1 → 0.1.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/.pikku/addon/pikku-addon-types.gen.ts +105 -0
- package/.pikku/addon/pikku-package.gen.ts +11 -0
- package/.pikku/agent/pikku-agent-map.gen.d.ts +4 -0
- package/.pikku/agent/pikku-agent-types.gen.ts +82 -0
- package/.pikku/channel/pikku-channel-types.gen.ts +177 -0
- package/.pikku/console/pikku-addon-meta.gen.json +33 -0
- package/.pikku/console/pikku-node-types.gen.ts +8 -0
- package/.pikku/function/pikku-function-types.gen.ts +754 -0
- package/.pikku/function/pikku-functions-meta-verbose.gen.json +31 -0
- package/.pikku/function/pikku-functions-meta.gen.json +21 -0
- package/.pikku/function/pikku-functions-meta.gen.ts +7 -0
- package/.pikku/function/pikku-functions.gen.ts +8 -0
- package/.pikku/http/pikku-http-types.gen.ts +147 -0
- package/.pikku/mcp/pikku-mcp-types.gen.ts +183 -0
- package/.pikku/pikku-bootstrap.gen.ts +8 -0
- package/.pikku/pikku-meta-service.gen.ts +10 -0
- package/.pikku/pikku-services.gen.ts +45 -0
- package/.pikku/pikku-types.gen.ts +21 -0
- package/.pikku/queue/pikku-queue-types.gen.ts +27 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +134 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +135 -0
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +3 -0
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -0
- package/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
- package/.pikku/schemas/register.gen.ts +15 -0
- package/.pikku/schemas/schemas/EventSendInput.schema.json +1 -0
- package/.pikku/schemas/schemas/EventSendOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/SecretSchema_metaConversions.schema.json +1 -0
- package/.pikku/secrets/pikku-secret-types.gen.ts +5 -0
- package/.pikku/secrets/pikku-secrets-meta.gen.json +10 -0
- package/.pikku/secrets/pikku-secrets.gen.ts +23 -0
- package/.pikku/trigger/pikku-trigger-types.gen.ts +160 -0
- package/.pikku/variables/pikku-variable-types.gen.ts +5 -0
- package/.pikku/variables/pikku-variables-meta.gen.json +1 -0
- package/.pikku/variables/pikku-variables.gen.ts +21 -0
- package/.pikku/workflow/pikku-workflow-map.gen.d.ts +38 -0
- package/.pikku/workflow/pikku-workflow-types.gen.ts +167 -0
- package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +9 -0
- package/.pikku/workflow/pikku-workflow-wirings.gen.ts +3 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +4 -4
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts.map +1 -1
- package/dist/.pikku/addon/pikku-addon-types.gen.js +7 -3
- package/dist/.pikku/addon/pikku-addon-types.gen.js.map +1 -1
- package/dist/.pikku/addon/pikku-addon-types.gen.ts +11 -6
- package/dist/.pikku/addon/pikku-package.gen.js +2 -1
- package/dist/.pikku/addon/pikku-package.gen.js.map +1 -1
- package/dist/.pikku/addon/pikku-package.gen.ts +3 -1
- package/dist/.pikku/agent/pikku-agent-map.gen.d.ts +2 -14
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +6 -6
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts.map +1 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.js.map +1 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.ts +13 -7
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +112 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts.map +1 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.js +60 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.js.map +1 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.ts +177 -0
- package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
- package/dist/.pikku/console/pikku-node-types.gen.ts +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +71 -87
- package/dist/.pikku/function/pikku-function-types.gen.d.ts.map +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.js +80 -60
- package/dist/.pikku/function/pikku-function-types.gen.js.map +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.ts +170 -102
- package/dist/.pikku/function/pikku-functions-meta-verbose.gen.json +3 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +1 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.ts +1 -1
- package/dist/.pikku/function/pikku-functions.gen.js +2 -2
- package/dist/.pikku/function/pikku-functions.gen.js.map +1 -1
- package/dist/.pikku/function/pikku-functions.gen.ts +2 -2
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +120 -0
- package/dist/.pikku/http/pikku-http-types.gen.d.ts.map +1 -0
- package/dist/.pikku/http/pikku-http-types.gen.js +72 -0
- package/dist/.pikku/http/pikku-http-types.gen.js.map +1 -0
- package/dist/.pikku/http/pikku-http-types.gen.ts +147 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +131 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts.map +1 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +38 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js.map +1 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.ts +183 -0
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +4 -2
- package/dist/.pikku/pikku-bootstrap.gen.d.ts.map +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +2 -10
- package/dist/.pikku/pikku-bootstrap.gen.js.map +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.ts +2 -9
- package/dist/.pikku/pikku-meta-service.gen.d.ts +8 -0
- package/dist/.pikku/pikku-meta-service.gen.d.ts.map +1 -0
- package/dist/.pikku/pikku-meta-service.gen.js +10 -0
- package/dist/.pikku/pikku-meta-service.gen.js.map +1 -0
- package/dist/.pikku/pikku-meta-service.gen.ts +10 -0
- package/dist/.pikku/pikku-services.gen.d.ts +10 -2
- package/dist/.pikku/pikku-services.gen.d.ts.map +1 -1
- package/dist/.pikku/pikku-services.gen.js +9 -0
- package/dist/.pikku/pikku-services.gen.js.map +1 -1
- package/dist/.pikku/pikku-services.gen.ts +12 -2
- package/dist/.pikku/pikku-types.gen.d.ts +1 -1
- package/dist/.pikku/pikku-types.gen.js +1 -1
- package/dist/.pikku/pikku-types.gen.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +24 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts.map +1 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.js +17 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.js.map +1 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.ts +27 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +27 -8
- package/dist/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +27 -8
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts +2 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts.map +1 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +7 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js.map +1 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +3 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +22 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts.map +1 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +17 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js.map +1 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
- package/dist/.pikku/schemas/register.gen.js +1 -1
- package/dist/.pikku/schemas/register.gen.ts +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.ts +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.ts +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.ts +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.ts +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-map.gen.d.ts +9 -5
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +36 -27
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts.map +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +5 -18
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js.map +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.ts +66 -57
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.ts +1 -1
- package/dist/src/services.d.ts.map +1 -1
- package/dist/src/services.js +1 -1
- package/dist/src/services.js.map +1 -1
- package/package.json +7 -6
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.d.ts +0 -2
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.d.ts.map +0 -1
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js +0 -7
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js.map +0 -1
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.json +0 -3
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.ts +0 -7
- package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts +0 -5
- package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts.map +0 -1
- package/dist/.pikku/agent/pikku-agent-wirings.gen.js +0 -5
- package/dist/.pikku/agent/pikku-agent-wirings.gen.js.map +0 -1
- package/dist/.pikku/agent/pikku-agent-wirings.gen.ts +0 -3
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* Core function, middleware, and permission types for all wirings
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import type { CorePikkuMiddleware, CorePermissionGroup, ListInput, ListOutput, PikkuWire, PickRequired } from '@pikku/core'
|
|
9
|
+
import type { CorePikkuFunctionConfig, CorePikkuAuth, CorePikkuAuthConfig, CorePikkuPermission } from '@pikku/core/function'
|
|
10
|
+
import { pikkuAuth as pikkuAuthCore } from '@pikku/core/function'
|
|
11
|
+
import {
|
|
12
|
+
addTagMiddleware as addTagMiddlewareCore,
|
|
13
|
+
addGlobalMiddleware as addGlobalMiddlewareCore,
|
|
14
|
+
addTagPermission as addTagPermissionCore,
|
|
15
|
+
addGlobalPermission as addGlobalPermissionCore,
|
|
16
|
+
} from '@pikku/core/middleware'
|
|
9
17
|
import { pikkuState as __pikkuState, CreateWireServices } from '@pikku/core/internal'
|
|
10
|
-
import { pikkuAuth as pikkuAuthCore } from '@pikku/core'
|
|
11
|
-
import { PikkuError } from '@pikku/core/errors'
|
|
12
18
|
import type { NodeType } from '@pikku/core/node'
|
|
13
19
|
import type { StandardSchemaV1 } from '@standard-schema/spec'
|
|
14
20
|
import { CorePikkuFunction, CorePikkuFunctionSessionless } from '@pikku/core/function'
|
|
@@ -323,34 +329,36 @@ export type PikkuFunctionConfig<
|
|
|
323
329
|
* Use this when you want to define input/output schemas using Zod.
|
|
324
330
|
* Types are automatically inferred from the schemas.
|
|
325
331
|
*/
|
|
332
|
+
type SchemaInferred<S, Fallback = unknown> = S extends StandardSchemaV1
|
|
333
|
+
? InferSchemaOutput<S>
|
|
334
|
+
: Fallback
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Schema-overload variant for pikkuFunc. Derived from CorePikkuFunctionConfig
|
|
338
|
+
* so adding a field on the core type automatically propagates here.
|
|
339
|
+
*/
|
|
326
340
|
export type PikkuFunctionConfigWithSchema<
|
|
327
341
|
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
328
342
|
OutputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
329
343
|
RequiredWires extends keyof PikkuWire = never
|
|
330
|
-
> =
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
|
|
341
|
-
RequiredWires
|
|
342
|
-
> | PikkuFunctionSessionless<
|
|
343
|
-
InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown,
|
|
344
|
-
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
|
|
345
|
-
RequiredWires
|
|
346
|
-
>
|
|
347
|
-
auth?: boolean
|
|
348
|
-
permissions?: InputSchema extends StandardSchemaV1 ? CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>> : undefined
|
|
349
|
-
middleware?: PikkuMiddleware[]
|
|
344
|
+
> = Omit<
|
|
345
|
+
CorePikkuFunctionConfig<
|
|
346
|
+
| PikkuFunction<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
|
|
347
|
+
| PikkuFunctionSessionless<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
|
|
348
|
+
>,
|
|
349
|
+
'func' | 'input' | 'output' | 'permissions' | 'approvalDescription'
|
|
350
|
+
> & {
|
|
351
|
+
func:
|
|
352
|
+
| PikkuFunction<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
|
|
353
|
+
| PikkuFunctionSessionless<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
|
|
350
354
|
input?: InputSchema
|
|
351
355
|
output?: OutputSchema
|
|
352
|
-
|
|
353
|
-
|
|
356
|
+
permissions?: InputSchema extends StandardSchemaV1
|
|
357
|
+
? CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>>
|
|
358
|
+
: undefined
|
|
359
|
+
approvalDescription?: InputSchema extends StandardSchemaV1
|
|
360
|
+
? PikkuApprovalDescription<InferSchemaOutput<InputSchema>>
|
|
361
|
+
: never
|
|
354
362
|
}
|
|
355
363
|
|
|
356
364
|
/**
|
|
@@ -406,35 +414,62 @@ export function pikkuFunc(func: any) {
|
|
|
406
414
|
return typeof func === 'function' ? { func } : func
|
|
407
415
|
}
|
|
408
416
|
|
|
417
|
+
export type PikkuListFunction<
|
|
418
|
+
F extends Record<string, unknown> = {},
|
|
419
|
+
Row = unknown,
|
|
420
|
+
S extends string = never
|
|
421
|
+
> =
|
|
422
|
+
| PikkuFunction<ListInput<F, S>, ListOutput<Row>, 'session' | 'rpc'>
|
|
423
|
+
| PikkuFunctionSessionless<
|
|
424
|
+
ListInput<F, S>,
|
|
425
|
+
ListOutput<Row>,
|
|
426
|
+
'session' | 'rpc'
|
|
427
|
+
>
|
|
428
|
+
|
|
429
|
+
export const pikkuListFunc = <
|
|
430
|
+
F extends Record<string, unknown> = {},
|
|
431
|
+
Row = unknown,
|
|
432
|
+
S extends string = never
|
|
433
|
+
>(
|
|
434
|
+
config: PikkuFunctionConfig<
|
|
435
|
+
ListInput<F, S>,
|
|
436
|
+
ListOutput<Row>,
|
|
437
|
+
'session' | 'rpc'
|
|
438
|
+
>
|
|
439
|
+
): PikkuFunctionConfig<ListInput<F, S>, ListOutput<Row>, 'session' | 'rpc'> => {
|
|
440
|
+
return pikkuFunc(config)
|
|
441
|
+
}
|
|
442
|
+
|
|
409
443
|
/**
|
|
410
444
|
* Configuration object for sessionless Pikku functions with Zod schema validation.
|
|
411
445
|
*/
|
|
446
|
+
/**
|
|
447
|
+
* Schema-overload variant for pikkuSessionlessFunc. Derived from
|
|
448
|
+
* CorePikkuFunctionConfig to stay in sync with the generic-typed config.
|
|
449
|
+
*/
|
|
412
450
|
export type PikkuFunctionSessionlessConfigWithSchema<
|
|
413
451
|
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
414
452
|
OutputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
415
453
|
RequiredWires extends keyof PikkuWire = never
|
|
416
|
-
> =
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
internal?: boolean
|
|
423
|
-
remote?: boolean
|
|
424
|
-
approvalRequired?: boolean
|
|
425
|
-
approvalDescription?: InputSchema extends StandardSchemaV1 ? PikkuApprovalDescription<InferSchemaOutput<InputSchema>> : never
|
|
454
|
+
> = Omit<
|
|
455
|
+
CorePikkuFunctionConfig<
|
|
456
|
+
PikkuFunctionSessionless<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
|
|
457
|
+
>,
|
|
458
|
+
'func' | 'input' | 'output' | 'permissions' | 'approvalDescription'
|
|
459
|
+
> & {
|
|
426
460
|
func: PikkuFunctionSessionless<
|
|
427
|
-
|
|
428
|
-
|
|
461
|
+
SchemaInferred<InputSchema>,
|
|
462
|
+
SchemaInferred<OutputSchema>,
|
|
429
463
|
RequiredWires
|
|
430
464
|
>
|
|
431
|
-
auth?: boolean
|
|
432
|
-
permissions?: InputSchema extends StandardSchemaV1 ? CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>> : undefined
|
|
433
|
-
middleware?: PikkuMiddleware[]
|
|
434
465
|
input?: InputSchema
|
|
435
466
|
output?: OutputSchema
|
|
436
|
-
|
|
437
|
-
|
|
467
|
+
permissions?: InputSchema extends StandardSchemaV1
|
|
468
|
+
? CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>>
|
|
469
|
+
: undefined
|
|
470
|
+
approvalDescription?: InputSchema extends StandardSchemaV1
|
|
471
|
+
? PikkuApprovalDescription<InferSchemaOutput<InputSchema>>
|
|
472
|
+
: never
|
|
438
473
|
}
|
|
439
474
|
|
|
440
475
|
/**
|
|
@@ -512,27 +547,23 @@ export const pikkuVoidFunc = (
|
|
|
512
547
|
}
|
|
513
548
|
|
|
514
549
|
/**
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
* without type compatibility issues.
|
|
550
|
+
* References a registered function by name for use in any wiring.
|
|
551
|
+
* Works for both local and addon functions — resolves via RPC at runtime.
|
|
518
552
|
*
|
|
519
|
-
* @template Name - The
|
|
520
|
-
* @param rpcName - The name of the
|
|
521
|
-
* @returns A Pikku function that proxies calls
|
|
553
|
+
* @template Name - The function name (must be a key in FlattenedRPCMap)
|
|
554
|
+
* @param rpcName - The name of the function to reference
|
|
555
|
+
* @returns A Pikku function config that proxies calls via RPC
|
|
522
556
|
*
|
|
523
557
|
* @example
|
|
524
558
|
* ```typescript
|
|
525
|
-
* //
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
*
|
|
529
|
-
*
|
|
530
|
-
* func: addon('ext:hello'),
|
|
531
|
-
* tags: ['addon'],
|
|
532
|
-
* })
|
|
559
|
+
* // Use in agent tools
|
|
560
|
+
* tools: [ref('todos:listTodos'), ref('myLocalFunc')]
|
|
561
|
+
*
|
|
562
|
+
* // Use in HTTP wiring
|
|
563
|
+
* wireHTTP({ route: '/greet', method: 'post', func: ref('greet') })
|
|
533
564
|
* ```
|
|
534
565
|
*/
|
|
535
|
-
export const
|
|
566
|
+
export const ref = <Name extends keyof FlattenedRPCMap>(
|
|
536
567
|
rpcName: Name
|
|
537
568
|
): PikkuFunctionConfig<
|
|
538
569
|
FlattenedRPCMap[Name]['input'],
|
|
@@ -591,12 +622,27 @@ export const pikkuConfig = (
|
|
|
591
622
|
* ```
|
|
592
623
|
*/
|
|
593
624
|
export const pikkuServices = (
|
|
594
|
-
func: (config: Config, existingServices: Partial<SingletonServices>) => Promise<RequiredSingletonServices
|
|
625
|
+
func: (config: Config, existingServices: Partial<SingletonServices>) => Promise<Partial<Omit<RequiredSingletonServices, 'auth'>>>
|
|
595
626
|
) => {
|
|
596
627
|
return async (config: Config, existingServices: Partial<SingletonServices> = {}) => {
|
|
597
|
-
const
|
|
598
|
-
|
|
599
|
-
|
|
628
|
+
const createdServices = await func(config, existingServices)
|
|
629
|
+
const services = { ...existingServices, ...createdServices }
|
|
630
|
+
const authFactory = __pikkuState(null, 'package', 'authFactory')
|
|
631
|
+
if (authFactory) {
|
|
632
|
+
let authInstance: Promise<unknown> | undefined
|
|
633
|
+
;(services as any).auth = () => {
|
|
634
|
+
authInstance ??= Promise.resolve()
|
|
635
|
+
.then(() => authFactory(services as any))
|
|
636
|
+
.catch((error) => {
|
|
637
|
+
authInstance = undefined
|
|
638
|
+
throw error
|
|
639
|
+
})
|
|
640
|
+
return authInstance
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
const resolved = services as RequiredSingletonServices
|
|
644
|
+
__pikkuState(null, 'package', 'singletonServices', resolved as any)
|
|
645
|
+
return resolved
|
|
600
646
|
}
|
|
601
647
|
}
|
|
602
648
|
|
|
@@ -629,58 +675,80 @@ export const pikkuWireServices = (
|
|
|
629
675
|
}
|
|
630
676
|
|
|
631
677
|
/**
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
* This function allows you to register middleware that will be applied to
|
|
635
|
-
* any wiring (HTTP, Channel, Queue, Scheduler, MCP) that includes the matching tag.
|
|
636
|
-
*
|
|
637
|
-
* @param tag - The tag that the middleware should apply to.
|
|
638
|
-
* @param middleware - The middleware array to apply for the specified tag.
|
|
639
|
-
*
|
|
640
|
-
* @throws Error if middleware for the tag already exists.
|
|
678
|
+
* Tag-scoped middleware. Applies to any wiring that carries the matching tag.
|
|
641
679
|
*
|
|
642
680
|
* @example
|
|
643
|
-
*
|
|
644
|
-
* // Add admin middleware for admin endpoints
|
|
645
|
-
* addMiddleware('admin', [adminMiddleware])
|
|
646
|
-
*
|
|
647
|
-
* // Add authentication middleware for auth endpoints
|
|
648
|
-
* addMiddleware('auth', [authMiddleware])
|
|
649
|
-
*
|
|
650
|
-
* // Add logging middleware for all API endpoints
|
|
651
|
-
* addMiddleware('api', [loggingMiddleware])
|
|
652
|
-
* ```
|
|
681
|
+
* addTagMiddleware('admin', [adminMiddleware])
|
|
653
682
|
*/
|
|
654
|
-
export const
|
|
655
|
-
|
|
683
|
+
export const addTagMiddleware = (tag: string, middleware: PikkuMiddleware[]) => {
|
|
684
|
+
addTagMiddlewareCore(tag, middleware as any, '@pikku/addon-meta-conversions')
|
|
656
685
|
}
|
|
657
686
|
|
|
658
687
|
/**
|
|
659
|
-
*
|
|
688
|
+
* Wire-agnostic global middleware. Runs at the top of every wiring's
|
|
689
|
+
* middleware chain — before wire-, tag-, and function-level entries.
|
|
660
690
|
*
|
|
661
|
-
*
|
|
662
|
-
* any wiring (HTTP, Channel, Queue, Scheduler, MCP) that includes the matching tag.
|
|
691
|
+
* Resolution order: global -> wire -> tag -> function.
|
|
663
692
|
*
|
|
664
|
-
* @
|
|
665
|
-
*
|
|
666
|
-
|
|
667
|
-
|
|
693
|
+
* @example
|
|
694
|
+
* addGlobalMiddleware([telemetryMiddleware])
|
|
695
|
+
*/
|
|
696
|
+
export const addGlobalMiddleware = (middleware: PikkuMiddleware[]) => {
|
|
697
|
+
addGlobalMiddlewareCore(middleware as any, '@pikku/addon-meta-conversions')
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Tag-scoped permissions. Applies to any wiring that carries the matching tag.
|
|
668
702
|
*
|
|
669
703
|
* @example
|
|
670
|
-
*
|
|
671
|
-
|
|
672
|
-
|
|
704
|
+
* addTagPermission('admin', [adminPermission])
|
|
705
|
+
*/
|
|
706
|
+
export const addTagPermission = <In = unknown>(tag: string, permissions: CorePermissionGroup<PikkuPermission<In>> | PikkuPermission<In>[]) => {
|
|
707
|
+
addTagPermissionCore(tag, permissions as any, '@pikku/addon-meta-conversions')
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Wire-agnostic global permissions. Runs at the top of every wiring's
|
|
712
|
+
* permission resolution — before wire-, tag-, and function-level entries.
|
|
673
713
|
*
|
|
674
|
-
*
|
|
675
|
-
* addPermission('auth', [authPermission])
|
|
714
|
+
* Resolution order: global -> wire -> tag -> function.
|
|
676
715
|
*
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
* ```
|
|
716
|
+
* @example
|
|
717
|
+
* addGlobalPermission([signedInUser])
|
|
680
718
|
*/
|
|
681
|
-
export const
|
|
682
|
-
|
|
719
|
+
export const addGlobalPermission = <In = unknown>(permissions: CorePermissionGroup<PikkuPermission<In>> | PikkuPermission<In>[]) => {
|
|
720
|
+
addGlobalPermissionCore(permissions as any, '@pikku/addon-meta-conversions')
|
|
683
721
|
}
|
|
684
722
|
|
|
685
|
-
export { wireAddon } from '@pikku/core'
|
|
686
|
-
export type { WireAddonConfig } from '@pikku/core'
|
|
723
|
+
export { wireAddon } from '@pikku/core/rpc'
|
|
724
|
+
export type { WireAddonConfig } from '@pikku/core/rpc'
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Addon contract references. Generated from each wired addon's published
|
|
729
|
+
* contract metadata — no addon source is imported. Functions are proxied via
|
|
730
|
+
* ref() (RPC) exactly like ref('namespace:fn').
|
|
731
|
+
*/
|
|
732
|
+
const __addonHttp = {} as const
|
|
733
|
+
const __addonChannel = {} as const
|
|
734
|
+
const __addonCli = {} as const
|
|
735
|
+
|
|
736
|
+
export const refHTTP = <Name extends keyof typeof __addonHttp>(
|
|
737
|
+
name: Name,
|
|
738
|
+
options?: { basePath?: string }
|
|
739
|
+
): (typeof __addonHttp)[Name] => {
|
|
740
|
+
const contract = __addonHttp[name] as any
|
|
741
|
+
return (
|
|
742
|
+
options?.basePath !== undefined
|
|
743
|
+
? { ...contract, basePath: options.basePath }
|
|
744
|
+
: contract
|
|
745
|
+
) as (typeof __addonHttp)[Name]
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
export const refChannel = <Name extends keyof typeof __addonChannel>(
|
|
749
|
+
name: Name
|
|
750
|
+
): (typeof __addonChannel)[Name] => __addonChannel[name]
|
|
751
|
+
|
|
752
|
+
export const refCLI = <Name extends keyof typeof __addonCli>(
|
|
753
|
+
name: Name
|
|
754
|
+
): (typeof __addonCli)[Name] => __addonCli[name]
|
|
@@ -19,8 +19,11 @@
|
|
|
19
19
|
"outputs": [
|
|
20
20
|
"EventSendOutput"
|
|
21
21
|
],
|
|
22
|
+
"implementationHash": "289d4066fc71925f",
|
|
22
23
|
"description": "Send server-side conversion events to Meta via the Conversions API",
|
|
23
24
|
"isDirectFunction": false,
|
|
25
|
+
"sourceFile": "/home/runner/work/addons/addons/packages/analytics/meta-conversions/src/functions/events/send.function.ts",
|
|
26
|
+
"exportedName": "eventSend",
|
|
24
27
|
"contractHash": "5864ea42d4379da5",
|
|
25
28
|
"inputHash": "0030f99c",
|
|
26
29
|
"outputHash": "39d1f240"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
3
|
*/
|
|
4
4
|
/* Import and register functions used by RPCs */
|
|
5
|
-
import { addFunction } from '@pikku/core';
|
|
5
|
+
import { addFunction } from '@pikku/core/function';
|
|
6
6
|
import { eventSend } from '../../src/functions/events/send.function.js';
|
|
7
7
|
addFunction('eventSend', eventSend, '@pikku/addon-meta-conversions');
|
|
8
8
|
//# sourceMappingURL=pikku-functions.gen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pikku-functions.gen.js","sourceRoot":"","sources":["../../../.pikku/function/pikku-functions.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,gDAAgD;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pikku-functions.gen.js","sourceRoot":"","sources":["../../../.pikku/function/pikku-functions.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,gDAAgD;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAEvE,WAAW,CAAC,WAAW,EAAE,SAAS,EAAE,+BAA+B,CAAC,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
3
|
*/
|
|
4
4
|
/* Import and register functions used by RPCs */
|
|
5
|
-
import { addFunction } from '@pikku/core'
|
|
5
|
+
import { addFunction } from '@pikku/core/function'
|
|
6
6
|
import { eventSend } from '../../src/functions/events/send.function.js'
|
|
7
7
|
|
|
8
8
|
addFunction('eventSend', eventSend, '@pikku/addon-meta-conversions')
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* HTTP-specific type definitions for tree-shaking optimization
|
|
6
|
+
*/
|
|
7
|
+
import { AssertHTTPWiringParams } from '@pikku/core/http';
|
|
8
|
+
import type { PikkuFunction, PikkuFunctionSessionless, PikkuPermission, PikkuMiddleware, PikkuFunctionConfig } from '../function/pikku-function-types.gen.js';
|
|
9
|
+
import type { CoreHTTPFunctionWiring, HTTPMethod, HTTPRouteBaseConfig } from '@pikku/core/http';
|
|
10
|
+
/**
|
|
11
|
+
* Type definition for HTTP API wirings with type-safe path parameters.
|
|
12
|
+
* Supports both authenticated and unauthenticated functions.
|
|
13
|
+
*
|
|
14
|
+
* @template In - Input type for the HTTP wiring
|
|
15
|
+
* @template Out - Output type for the HTTP wiring
|
|
16
|
+
* @template Route - String literal type for the HTTP path (e.g., "/users/:id")
|
|
17
|
+
*/
|
|
18
|
+
type HTTPWiring<In, Out, Route extends string> = CoreHTTPFunctionWiring<In, Out, Route, PikkuFunction<In, Out, 'rpc' | 'session'>, PikkuFunctionSessionless<In, Out, 'rpc' | 'session'>, PikkuPermission<In>, PikkuMiddleware>;
|
|
19
|
+
/**
|
|
20
|
+
* Registers an HTTP wiring with the Pikku framework.
|
|
21
|
+
*
|
|
22
|
+
* @template In - Input type for the HTTP wiring
|
|
23
|
+
* @template Out - Output type for the HTTP wiring
|
|
24
|
+
* @template Route - String literal type for the HTTP path (e.g., "/users/:id")
|
|
25
|
+
* @param httpWiring - HTTP wiring definition with handler, method, and optional middleware
|
|
26
|
+
*/
|
|
27
|
+
export declare const wireHTTP: <In, Out, Route extends string>(httpWiring: HTTPWiring<In, Out, Route> & AssertHTTPWiringParams<In, Route>) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Registers HTTP middleware either globally or for a specific route pattern.
|
|
30
|
+
*
|
|
31
|
+
* When a string route pattern is provided along with middleware, the middleware
|
|
32
|
+
* is applied only to that route. Otherwise, if an array is provided, it is treated
|
|
33
|
+
* as global middleware (applied to all routes).
|
|
34
|
+
*
|
|
35
|
+
* @param routeOrMiddleware - Either a global middleware array or a route pattern string
|
|
36
|
+
* @param middleware - The middleware array to apply when a route pattern is specified
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* // Add global HTTP middleware
|
|
41
|
+
* addHTTPMiddleware([authMiddleware, loggingMiddleware])
|
|
42
|
+
*
|
|
43
|
+
* // Add route-specific middleware
|
|
44
|
+
* addHTTPMiddleware('/api/admin/*', [adminAuthMiddleware])
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare const addHTTPMiddleware: (routeOrMiddleware: PikkuMiddleware[] | string, middleware?: PikkuMiddleware[]) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Registers HTTP permissions either globally or for a specific route pattern.
|
|
50
|
+
*
|
|
51
|
+
* When a string route pattern is provided along with permissions, the permissions
|
|
52
|
+
* are applied only to that route. Permissions can be passed as an array or as a
|
|
53
|
+
* permission group object.
|
|
54
|
+
*
|
|
55
|
+
* @param pattern - Route pattern string (e.g., '*' for all routes, '/api/*' for specific routes)
|
|
56
|
+
* @param permissions - The permissions to apply for the specified route pattern
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* // Add global HTTP permissions
|
|
61
|
+
* addHTTPPermission('*', { global: globalPermission })
|
|
62
|
+
*
|
|
63
|
+
* // Add route-specific permissions
|
|
64
|
+
* addHTTPPermission('/api/admin/*', { admin: adminPermission })
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare const addHTTPPermission: <In = unknown>(pattern: string, permissions: Record<string, PikkuPermission<In>> | PikkuPermission<In>[]) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Route configuration for wireHTTPRoutes with proper typing
|
|
70
|
+
*/
|
|
71
|
+
type HTTPRouteConfig = HTTPRouteBaseConfig & {
|
|
72
|
+
method: HTTPMethod;
|
|
73
|
+
route: string;
|
|
74
|
+
func: PikkuFunctionConfig<any, any, any, any, any, any>;
|
|
75
|
+
auth?: boolean;
|
|
76
|
+
permissions?: Record<string, PikkuPermission | PikkuPermission[]>;
|
|
77
|
+
middleware?: PikkuMiddleware[];
|
|
78
|
+
sse?: boolean;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Typed route map for wireHTTPRoutes
|
|
82
|
+
*/
|
|
83
|
+
type TypedHTTPRouteMap = {
|
|
84
|
+
[key: string]: HTTPRouteConfig | TypedHTTPRouteMap | TypedHTTPRouteContract;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Typed route contract for defineHTTPRoutes
|
|
88
|
+
*/
|
|
89
|
+
type TypedHTTPRouteContract<T extends TypedHTTPRouteMap = TypedHTTPRouteMap> = TypedHTTPRoutesGroupConfig & {
|
|
90
|
+
routes: T;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Group config with typed middleware/permissions
|
|
94
|
+
*/
|
|
95
|
+
type TypedHTTPRoutesGroupConfig = {
|
|
96
|
+
basePath?: string;
|
|
97
|
+
tags?: string[];
|
|
98
|
+
auth?: boolean;
|
|
99
|
+
middleware?: PikkuMiddleware[];
|
|
100
|
+
permissions?: Record<string, PikkuPermission | PikkuPermission[]>;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Full config for wireHTTPRoutes
|
|
104
|
+
*/
|
|
105
|
+
type TypedWireHTTPRoutesConfig = TypedHTTPRoutesGroupConfig & {
|
|
106
|
+
routes: TypedHTTPRouteMap | HTTPRouteConfig[];
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Type-safe helper for defining route contracts that can be composed.
|
|
110
|
+
*/
|
|
111
|
+
export declare function defineHTTPRoutes<T extends TypedHTTPRouteMap>(routes: T): TypedHTTPRouteContract<T>;
|
|
112
|
+
export declare function defineHTTPRoutes<T extends TypedHTTPRouteMap>(config: TypedHTTPRoutesGroupConfig & {
|
|
113
|
+
routes: T;
|
|
114
|
+
}): TypedHTTPRouteContract<T>;
|
|
115
|
+
/**
|
|
116
|
+
* Wires multiple HTTP routes from a nested map or array configuration.
|
|
117
|
+
*/
|
|
118
|
+
export declare const wireHTTPRoutes: (config: TypedWireHTTPRoutesConfig) => void;
|
|
119
|
+
export {};
|
|
120
|
+
//# sourceMappingURL=pikku-http-types.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pikku-http-types.gen.d.ts","sourceRoot":"","sources":["../../../.pikku/http/pikku-http-types.gen.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* HTTP-specific type definitions for tree-shaking optimization
|
|
6
|
+
*/
|
|
7
|
+
import { wireHTTP as wireHTTPCore, addHTTPMiddleware as addHTTPMiddlewareCore, addHTTPPermission as addHTTPPermissionCore, wireHTTPRoutes as wireHTTPRoutesCore, defineHTTPRoutes as defineHTTPRoutesCore } from '@pikku/core/http';
|
|
8
|
+
/**
|
|
9
|
+
* Registers an HTTP wiring with the Pikku framework.
|
|
10
|
+
*
|
|
11
|
+
* @template In - Input type for the HTTP wiring
|
|
12
|
+
* @template Out - Output type for the HTTP wiring
|
|
13
|
+
* @template Route - String literal type for the HTTP path (e.g., "/users/:id")
|
|
14
|
+
* @param httpWiring - HTTP wiring definition with handler, method, and optional middleware
|
|
15
|
+
*/
|
|
16
|
+
export const wireHTTP = (httpWiring) => {
|
|
17
|
+
wireHTTPCore(httpWiring);
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Registers HTTP middleware either globally or for a specific route pattern.
|
|
21
|
+
*
|
|
22
|
+
* When a string route pattern is provided along with middleware, the middleware
|
|
23
|
+
* is applied only to that route. Otherwise, if an array is provided, it is treated
|
|
24
|
+
* as global middleware (applied to all routes).
|
|
25
|
+
*
|
|
26
|
+
* @param routeOrMiddleware - Either a global middleware array or a route pattern string
|
|
27
|
+
* @param middleware - The middleware array to apply when a route pattern is specified
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* // Add global HTTP middleware
|
|
32
|
+
* addHTTPMiddleware([authMiddleware, loggingMiddleware])
|
|
33
|
+
*
|
|
34
|
+
* // Add route-specific middleware
|
|
35
|
+
* addHTTPMiddleware('/api/admin/*', [adminAuthMiddleware])
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export const addHTTPMiddleware = (routeOrMiddleware, middleware) => {
|
|
39
|
+
addHTTPMiddlewareCore(routeOrMiddleware, middleware);
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Registers HTTP permissions either globally or for a specific route pattern.
|
|
43
|
+
*
|
|
44
|
+
* When a string route pattern is provided along with permissions, the permissions
|
|
45
|
+
* are applied only to that route. Permissions can be passed as an array or as a
|
|
46
|
+
* permission group object.
|
|
47
|
+
*
|
|
48
|
+
* @param pattern - Route pattern string (e.g., '*' for all routes, '/api/*' for specific routes)
|
|
49
|
+
* @param permissions - The permissions to apply for the specified route pattern
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* // Add global HTTP permissions
|
|
54
|
+
* addHTTPPermission('*', { global: globalPermission })
|
|
55
|
+
*
|
|
56
|
+
* // Add route-specific permissions
|
|
57
|
+
* addHTTPPermission('/api/admin/*', { admin: adminPermission })
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export const addHTTPPermission = (pattern, permissions) => {
|
|
61
|
+
addHTTPPermissionCore(pattern, permissions);
|
|
62
|
+
};
|
|
63
|
+
export function defineHTTPRoutes(configOrRoutes) {
|
|
64
|
+
return defineHTTPRoutesCore(configOrRoutes);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Wires multiple HTTP routes from a nested map or array configuration.
|
|
68
|
+
*/
|
|
69
|
+
export const wireHTTPRoutes = (config) => {
|
|
70
|
+
wireHTTPRoutesCore(config);
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=pikku-http-types.gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pikku-http-types.gen.js","sourceRoot":"","sources":["../../../.pikku/http/pikku-http-types.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;GAEG;AAEH,OAAO,EAA0B,QAAQ,IAAI,YAAY,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,cAAc,IAAI,kBAAkB,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAc3P;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,UAA0E,EAC1E,EAAE;IACF,YAAY,CAAC,UAAiB,CAAC,CAAA;AACjC,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,iBAA6C,EAC7C,UAA8B,EAC9B,EAAE;IACF,qBAAqB,CAAC,iBAAwB,EAAE,UAAiB,CAAC,CAAA;AACpE,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,OAAe,EACf,WAAwE,EACxE,EAAE;IACF,qBAAqB,CAAC,OAAO,EAAE,WAAkB,CAAC,CAAA;AACpD,CAAC,CAAA;AAoDD,MAAM,UAAU,gBAAgB,CAA8B,cAAgE;IAC5H,OAAO,oBAAoB,CAAC,cAAqB,CAAyC,CAAA;AAC5F,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAiC,EAAQ,EAAE;IACxE,kBAAkB,CAAC,MAAa,CAAC,CAAA;AACnC,CAAC,CAAA"}
|