@pikku/addon-aws-s3 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/README.md +12 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +67 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts.map +1 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.js +78 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.js.map +1 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.ts +106 -0
- package/dist/.pikku/addon/pikku-package.gen.d.ts +2 -0
- package/dist/.pikku/addon/pikku-package.gen.d.ts.map +1 -0
- package/dist/.pikku/addon/pikku-package.gen.js +10 -0
- package/dist/.pikku/addon/pikku-package.gen.js.map +1 -0
- package/dist/.pikku/addon/pikku-package.gen.ts +11 -0
- package/dist/.pikku/agent/pikku-agent-map.gen.d.ts +4 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +47 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts.map +1 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.js +18 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.js.map +1 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.ts +82 -0
- 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 +7 -0
- package/dist/.pikku/console/pikku-node-types.gen.d.ts.map +1 -0
- package/dist/.pikku/console/pikku-node-types.gen.js +2 -0
- package/dist/.pikku/console/pikku-node-types.gen.js.map +1 -0
- package/dist/.pikku/console/pikku-node-types.gen.ts +8 -0
- package/dist/.pikku/credentials/pikku-credentials-meta.gen.json +10 -0
- package/dist/.pikku/credentials/pikku-credentials.gen.d.ts +15 -0
- package/dist/.pikku/credentials/pikku-credentials.gen.d.ts.map +1 -0
- package/dist/.pikku/credentials/pikku-credentials.gen.js +13 -0
- package/dist/.pikku/credentials/pikku-credentials.gen.js.map +1 -0
- package/dist/.pikku/credentials/pikku-credentials.gen.ts +23 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +490 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts.map +1 -0
- package/dist/.pikku/function/pikku-function-types.gen.js +334 -0
- package/dist/.pikku/function/pikku-function-types.gen.js.map +1 -0
- package/dist/.pikku/function/pikku-function-types.gen.ts +754 -0
- package/dist/.pikku/function/pikku-functions-meta-verbose.gen.json +350 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.d.ts +2 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.d.ts.map +1 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.js +7 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.js.map +1 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.json +230 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.ts +7 -0
- package/dist/.pikku/function/pikku-functions.gen.d.ts +2 -0
- package/dist/.pikku/function/pikku-functions.gen.d.ts.map +1 -0
- package/dist/.pikku/function/pikku-functions.gen.js +30 -0
- package/dist/.pikku/function/pikku-functions.gen.js.map +1 -0
- package/dist/.pikku/function/pikku-functions.gen.ts +30 -0
- 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 +9 -0
- package/dist/.pikku/pikku-bootstrap.gen.d.ts.map +1 -0
- package/dist/.pikku/pikku-bootstrap.gen.js +9 -0
- package/dist/.pikku/pikku-bootstrap.gen.js.map +1 -0
- package/dist/.pikku/pikku-bootstrap.gen.ts +8 -0
- 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 +35 -0
- package/dist/.pikku/pikku-services.gen.d.ts.map +1 -0
- package/dist/.pikku/pikku-services.gen.js +30 -0
- package/dist/.pikku/pikku-services.gen.js.map +1 -0
- package/dist/.pikku/pikku-services.gen.ts +42 -0
- package/dist/.pikku/pikku-types.gen.d.ts +12 -0
- package/dist/.pikku/pikku-types.gen.d.ts.map +1 -0
- package/dist/.pikku/pikku-types.gen.js +17 -0
- package/dist/.pikku/pikku-types.gen.js.map +1 -0
- package/dist/.pikku/pikku-types.gen.ts +21 -0
- 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 +187 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +199 -0
- 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 +14 -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.d.ts +2 -0
- package/dist/.pikku/schemas/register.gen.d.ts.map +1 -0
- package/dist/.pikku/schemas/register.gen.js +57 -0
- package/dist/.pikku/schemas/register.gen.js.map +1 -0
- package/dist/.pikku/schemas/register.gen.ts +107 -0
- package/dist/.pikku/schemas/schemas/BucketCreateInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/BucketCreateOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/BucketDeleteInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/BucketDeleteOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/BucketGetAllInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/BucketGetAllOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/BucketSearchInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/BucketSearchOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/CredentialSchema_awsS3.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FileCopyInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FileCopyOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FileDeleteInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FileDeleteOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FileDownloadInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FileDownloadOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FileGetAllInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FileGetAllOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FileUploadInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FileUploadOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FolderCreateInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FolderCreateOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FolderDeleteInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FolderDeleteOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FolderGetAllInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FolderGetAllOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/VariableSchema_AWS_S3_BASE_URL.schema.json +1 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +6 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts.map +1 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.js +5 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.js.map +1 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.ts +5 -0
- package/dist/.pikku/secrets/pikku-secrets-meta.gen.json +1 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +12 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts.map +1 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.js +11 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.js.map +1 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.ts +21 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +114 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts.map +1 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js +34 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js.map +1 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.ts +160 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +6 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts.map +1 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.js +5 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.js.map +1 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.ts +5 -0
- package/dist/.pikku/variables/pikku-variables-meta.gen.json +10 -0
- package/dist/.pikku/variables/pikku-variables.gen.d.ts +15 -0
- package/dist/.pikku/variables/pikku-variables.gen.d.ts.map +1 -0
- package/dist/.pikku/variables/pikku-variables.gen.js +13 -0
- package/dist/.pikku/variables/pikku-variables.gen.js.map +1 -0
- package/dist/.pikku/variables/pikku-variables.gen.ts +23 -0
- package/dist/.pikku/workflow/pikku-workflow-map.gen.d.ts +38 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +90 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +18 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.ts +167 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.d.ts +2 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.d.ts.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +7 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +9 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +5 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +5 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.ts +3 -0
- package/dist/src/aws-s3-api.service.d.ts +10 -0
- package/dist/src/aws-s3-api.service.d.ts.map +1 -0
- package/dist/src/aws-s3-api.service.js +161 -0
- package/dist/src/aws-s3-api.service.js.map +1 -0
- package/dist/src/aws-s3.credential.d.ts +5 -0
- package/dist/src/aws-s3.credential.d.ts.map +1 -0
- package/dist/src/aws-s3.credential.js +13 -0
- package/dist/src/aws-s3.credential.js.map +1 -0
- package/dist/src/aws-s3.types.d.ts +7 -0
- package/dist/src/aws-s3.types.d.ts.map +1 -0
- package/dist/src/aws-s3.types.js +8 -0
- package/dist/src/aws-s3.types.js.map +1 -0
- package/dist/src/aws-s3.variable.d.ts +5 -0
- package/dist/src/aws-s3.variable.d.ts.map +1 -0
- package/dist/src/aws-s3.variable.js +11 -0
- package/dist/src/aws-s3.variable.js.map +1 -0
- package/dist/src/functions/bucketCreate.function.d.ts +21 -0
- package/dist/src/functions/bucketCreate.function.d.ts.map +1 -0
- package/dist/src/functions/bucketCreate.function.js +17 -0
- package/dist/src/functions/bucketCreate.function.js.map +1 -0
- package/dist/src/functions/bucketDelete.function.d.ts +13 -0
- package/dist/src/functions/bucketDelete.function.d.ts.map +1 -0
- package/dist/src/functions/bucketDelete.function.js +15 -0
- package/dist/src/functions/bucketDelete.function.js.map +1 -0
- package/dist/src/functions/bucketGetAll.function.d.ts +13 -0
- package/dist/src/functions/bucketGetAll.function.d.ts.map +1 -0
- package/dist/src/functions/bucketGetAll.function.js +15 -0
- package/dist/src/functions/bucketGetAll.function.js.map +1 -0
- package/dist/src/functions/bucketSearch.function.d.ts +21 -0
- package/dist/src/functions/bucketSearch.function.d.ts.map +1 -0
- package/dist/src/functions/bucketSearch.function.js +17 -0
- package/dist/src/functions/bucketSearch.function.js.map +1 -0
- package/dist/src/functions/fileCopy.function.d.ts +21 -0
- package/dist/src/functions/fileCopy.function.d.ts.map +1 -0
- package/dist/src/functions/fileCopy.function.js +17 -0
- package/dist/src/functions/fileCopy.function.js.map +1 -0
- package/dist/src/functions/fileDelete.function.d.ts +17 -0
- package/dist/src/functions/fileDelete.function.d.ts.map +1 -0
- package/dist/src/functions/fileDelete.function.js +16 -0
- package/dist/src/functions/fileDelete.function.js.map +1 -0
- package/dist/src/functions/fileDownload.function.d.ts +17 -0
- package/dist/src/functions/fileDownload.function.d.ts.map +1 -0
- package/dist/src/functions/fileDownload.function.js +16 -0
- package/dist/src/functions/fileDownload.function.js.map +1 -0
- package/dist/src/functions/fileGetAll.function.d.ts +17 -0
- package/dist/src/functions/fileGetAll.function.d.ts.map +1 -0
- package/dist/src/functions/fileGetAll.function.js +16 -0
- package/dist/src/functions/fileGetAll.function.js.map +1 -0
- package/dist/src/functions/fileUpload.function.d.ts +25 -0
- package/dist/src/functions/fileUpload.function.d.ts.map +1 -0
- package/dist/src/functions/fileUpload.function.js +18 -0
- package/dist/src/functions/fileUpload.function.js.map +1 -0
- package/dist/src/functions/folderCreate.function.d.ts +21 -0
- package/dist/src/functions/folderCreate.function.d.ts.map +1 -0
- package/dist/src/functions/folderCreate.function.js +17 -0
- package/dist/src/functions/folderCreate.function.js.map +1 -0
- package/dist/src/functions/folderDelete.function.d.ts +17 -0
- package/dist/src/functions/folderDelete.function.d.ts.map +1 -0
- package/dist/src/functions/folderDelete.function.js +16 -0
- package/dist/src/functions/folderDelete.function.js.map +1 -0
- package/dist/src/functions/folderGetAll.function.d.ts +17 -0
- package/dist/src/functions/folderGetAll.function.d.ts.map +1 -0
- package/dist/src/functions/folderGetAll.function.js +16 -0
- package/dist/src/functions/folderGetAll.function.js.map +1 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +13 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/services.d.ts +2 -0
- package/dist/src/services.d.ts.map +1 -0
- package/dist/src/services.js +14 -0
- package/dist/src/services.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.54
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Core function, middleware, and permission types for all wirings
|
|
6
|
+
*/
|
|
7
|
+
import { pikkuAuth as pikkuAuthCore } from '@pikku/core/function';
|
|
8
|
+
import { addTagMiddleware as addTagMiddlewareCore, addGlobalMiddleware as addGlobalMiddlewareCore, addTagPermission as addTagPermissionCore, addGlobalPermission as addGlobalPermissionCore, } from '@pikku/core/middleware';
|
|
9
|
+
import { pikkuState as __pikkuState } from '@pikku/core/internal';
|
|
10
|
+
/**
|
|
11
|
+
* Factory function for creating permissions with tree-shaking support.
|
|
12
|
+
* Supports both direct function and configuration object syntax.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // Direct function syntax
|
|
17
|
+
* const permission = pikkuPermission(async ({ logger }, data, { session }) => {
|
|
18
|
+
* const session = await session?.get()
|
|
19
|
+
* return session?.role === 'admin'
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* // Configuration object syntax with metadata
|
|
23
|
+
* const adminPermission = pikkuPermission({
|
|
24
|
+
* name: 'Admin Permission',
|
|
25
|
+
* description: 'Checks if user has admin role',
|
|
26
|
+
* func: async ({ logger }, data, { session }) => {
|
|
27
|
+
* const session = await session?.get()
|
|
28
|
+
* return session?.role === 'admin'
|
|
29
|
+
* }
|
|
30
|
+
* })
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export const pikkuPermission = (permission) => {
|
|
34
|
+
return typeof permission === 'function' ? permission : permission.func;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Factory function for creating auth-only permissions with tree-shaking support.
|
|
38
|
+
* Auth permissions only receive services and session (no request data),
|
|
39
|
+
* making them evaluable before request data is available.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* \`\`\`typescript
|
|
43
|
+
* const isAuthenticated = pikkuAuth(async ({ logger }, session) => {
|
|
44
|
+
* return !!session
|
|
45
|
+
* })
|
|
46
|
+
*
|
|
47
|
+
* const isAdmin = pikkuAuth({
|
|
48
|
+
* name: 'Admin Auth',
|
|
49
|
+
* description: 'Checks if user is an admin',
|
|
50
|
+
* func: async ({ logger }, session) => {
|
|
51
|
+
* return session?.role === 'admin'
|
|
52
|
+
* }
|
|
53
|
+
* })
|
|
54
|
+
* \`\`\`
|
|
55
|
+
*/
|
|
56
|
+
export const pikkuAuth = (auth) => {
|
|
57
|
+
return pikkuAuthCore(auth);
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Factory function for creating middleware with tree-shaking support.
|
|
61
|
+
* Supports both direct function and configuration object syntax.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* // Direct function syntax
|
|
66
|
+
* const middleware = pikkuMiddleware(({ logger }, wires, next) => {
|
|
67
|
+
* logger.info('Middleware executed')
|
|
68
|
+
* await next()
|
|
69
|
+
* })
|
|
70
|
+
*
|
|
71
|
+
* // Configuration object syntax with metadata
|
|
72
|
+
* const logMiddleware = pikkuMiddleware({
|
|
73
|
+
* name: 'Request Logger',
|
|
74
|
+
* description: 'Logs all incoming requests',
|
|
75
|
+
* func: async ({ logger }, wires, next) => {
|
|
76
|
+
* logger.info('Request started')
|
|
77
|
+
* await next()
|
|
78
|
+
* }
|
|
79
|
+
* })
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export const pikkuMiddleware = (middleware) => {
|
|
83
|
+
return typeof middleware === 'function' ? middleware : middleware.func;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Factory function for creating middleware factories
|
|
87
|
+
* Use this when your middleware needs configuration/input parameters
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* export const logMiddleware = pikkuMiddlewareFactory<LogOptions>(({
|
|
92
|
+
* message,
|
|
93
|
+
* level = 'info'
|
|
94
|
+
* }) => {
|
|
95
|
+
* return pikkuMiddleware(async ({ logger }, next) => {
|
|
96
|
+
* logger[level](message)
|
|
97
|
+
* await next()
|
|
98
|
+
* })
|
|
99
|
+
* })
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export const pikkuMiddlewareFactory = (factory) => {
|
|
103
|
+
return factory;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Factory function for creating permission factories
|
|
107
|
+
* Use this when your permission needs configuration/input parameters
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* export const requireRole = pikkuPermissionFactory<{ role: string }>(({
|
|
112
|
+
* role
|
|
113
|
+
* }) => {
|
|
114
|
+
* return pikkuPermission(async ({ logger }, data, { session }) => {
|
|
115
|
+
* if (!session || session.role !== role) {
|
|
116
|
+
* logger.warn(`Permission denied: required role '${role}'`)
|
|
117
|
+
* return false
|
|
118
|
+
* }
|
|
119
|
+
* return true
|
|
120
|
+
* })
|
|
121
|
+
* })
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
export const pikkuPermissionFactory = (factory) => {
|
|
125
|
+
return factory;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Factory function for creating approval description functions with tree-shaking support.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* export const deleteTodoApproval = pikkuApprovalDescription(
|
|
133
|
+
* async ({ todoStore }, { id }) => {
|
|
134
|
+
* const todo = await todoStore.get(id)
|
|
135
|
+
* return \`Delete todo: "${todo.title}"\`
|
|
136
|
+
* }
|
|
137
|
+
* )
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
export const pikkuApprovalDescription = (fn) => {
|
|
141
|
+
return fn;
|
|
142
|
+
};
|
|
143
|
+
export function pikkuFunc(func) {
|
|
144
|
+
return typeof func === 'function' ? { func } : func;
|
|
145
|
+
}
|
|
146
|
+
export const pikkuListFunc = (config) => {
|
|
147
|
+
return pikkuFunc(config);
|
|
148
|
+
};
|
|
149
|
+
export function pikkuSessionlessFunc(func) {
|
|
150
|
+
return typeof func === 'function' ? { func } : func;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Creates a function that takes no input and returns no output.
|
|
154
|
+
* Useful for health checks, triggers, or cleanup operations.
|
|
155
|
+
*
|
|
156
|
+
* @param func - Function definition, either direct function or configuration object
|
|
157
|
+
* @returns The normalized configuration object
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* const cleanupTempFiles = pikkuVoidFunc(async ({fileSystem, logger}) => {
|
|
162
|
+
* logger.info('Starting cleanup of temporary files')
|
|
163
|
+
* await fileSystem.deleteDirectory('/tmp/uploads')
|
|
164
|
+
* logger.info('Cleanup completed')
|
|
165
|
+
* })
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
export const pikkuVoidFunc = (func) => {
|
|
169
|
+
return typeof func === 'function' ? { func } : func;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* References a registered function by name for use in any wiring.
|
|
173
|
+
* Works for both local and addon functions — resolves via RPC at runtime.
|
|
174
|
+
*
|
|
175
|
+
* @template Name - The function name (must be a key in FlattenedRPCMap)
|
|
176
|
+
* @param rpcName - The name of the function to reference
|
|
177
|
+
* @returns A Pikku function config that proxies calls via RPC
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* // Use in agent tools
|
|
182
|
+
* tools: [ref('todos:listTodos'), ref('myLocalFunc')]
|
|
183
|
+
*
|
|
184
|
+
* // Use in HTTP wiring
|
|
185
|
+
* wireHTTP({ route: '/greet', method: 'post', func: ref('greet') })
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
export const ref = (rpcName) => {
|
|
189
|
+
return {
|
|
190
|
+
func: async (_services, data, { rpc }) => {
|
|
191
|
+
return rpc.invoke(rpcName, data);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Creates a Pikku config factory.
|
|
197
|
+
* Use this to define your application's configuration factory.
|
|
198
|
+
*
|
|
199
|
+
* @param func - Config factory function that returns your application's config
|
|
200
|
+
* @returns The config factory function
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```typescript
|
|
204
|
+
* export const createConfig = pikkuConfig(async () => {
|
|
205
|
+
* return {
|
|
206
|
+
* apiUrl: process.env.API_URL || 'http://localhost:3000',
|
|
207
|
+
* dbUrl: process.env.DATABASE_URL
|
|
208
|
+
* }
|
|
209
|
+
* })
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
export const pikkuConfig = (func) => func;
|
|
213
|
+
/**
|
|
214
|
+
* Creates a Pikku singleton services factory.
|
|
215
|
+
* Use this to define services that are created once and shared across all requests.
|
|
216
|
+
*
|
|
217
|
+
* @param func - Singleton services factory function
|
|
218
|
+
* @returns The singleton services factory function
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* export const createSingletonServices = pikkuServices(async (config, existingServices) => {
|
|
223
|
+
* return {
|
|
224
|
+
* config,
|
|
225
|
+
* logger: new CustomLogger(),
|
|
226
|
+
* db: await createDatabaseConnection(config.dbUrl)
|
|
227
|
+
* }
|
|
228
|
+
* })
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
export const pikkuServices = (func) => {
|
|
232
|
+
return async (config, existingServices = {}) => {
|
|
233
|
+
const createdServices = await func(config, existingServices);
|
|
234
|
+
const services = { ...existingServices, ...createdServices };
|
|
235
|
+
const authFactory = __pikkuState(null, 'package', 'authFactory');
|
|
236
|
+
if (authFactory) {
|
|
237
|
+
let authInstance;
|
|
238
|
+
services.auth = () => {
|
|
239
|
+
authInstance ??= Promise.resolve()
|
|
240
|
+
.then(() => authFactory(services))
|
|
241
|
+
.catch((error) => {
|
|
242
|
+
authInstance = undefined;
|
|
243
|
+
throw error;
|
|
244
|
+
});
|
|
245
|
+
return authInstance;
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
const resolved = services;
|
|
249
|
+
__pikkuState(null, 'package', 'singletonServices', resolved);
|
|
250
|
+
return resolved;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Creates a Pikku wire services factory.
|
|
255
|
+
* Use this to define services that are created per-request/session.
|
|
256
|
+
*
|
|
257
|
+
* @param func - Wire services factory function
|
|
258
|
+
* @returns The wire services factory function
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```typescript
|
|
262
|
+
* export const createWireServices = pikkuWireServices(async (services, wire) => {
|
|
263
|
+
* const session = await wire.session?.get()
|
|
264
|
+
* return {
|
|
265
|
+
* userCache: new UserCache(session?.userId)
|
|
266
|
+
* }
|
|
267
|
+
* })
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
export const pikkuWireServices = (func) => {
|
|
271
|
+
const factories = __pikkuState(null, 'package', 'factories');
|
|
272
|
+
__pikkuState(null, 'package', 'factories', { ...factories, createWireServices: func });
|
|
273
|
+
return func;
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* Tag-scoped middleware. Applies to any wiring that carries the matching tag.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* addTagMiddleware('admin', [adminMiddleware])
|
|
280
|
+
*/
|
|
281
|
+
export const addTagMiddleware = (tag, middleware) => {
|
|
282
|
+
addTagMiddlewareCore(tag, middleware, '@pikku/addon-aws-s3');
|
|
283
|
+
};
|
|
284
|
+
/**
|
|
285
|
+
* Wire-agnostic global middleware. Runs at the top of every wiring's
|
|
286
|
+
* middleware chain — before wire-, tag-, and function-level entries.
|
|
287
|
+
*
|
|
288
|
+
* Resolution order: global -> wire -> tag -> function.
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* addGlobalMiddleware([telemetryMiddleware])
|
|
292
|
+
*/
|
|
293
|
+
export const addGlobalMiddleware = (middleware) => {
|
|
294
|
+
addGlobalMiddlewareCore(middleware, '@pikku/addon-aws-s3');
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* Tag-scoped permissions. Applies to any wiring that carries the matching tag.
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* addTagPermission('admin', [adminPermission])
|
|
301
|
+
*/
|
|
302
|
+
export const addTagPermission = (tag, permissions) => {
|
|
303
|
+
addTagPermissionCore(tag, permissions, '@pikku/addon-aws-s3');
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* Wire-agnostic global permissions. Runs at the top of every wiring's
|
|
307
|
+
* permission resolution — before wire-, tag-, and function-level entries.
|
|
308
|
+
*
|
|
309
|
+
* Resolution order: global -> wire -> tag -> function.
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* addGlobalPermission([signedInUser])
|
|
313
|
+
*/
|
|
314
|
+
export const addGlobalPermission = (permissions) => {
|
|
315
|
+
addGlobalPermissionCore(permissions, '@pikku/addon-aws-s3');
|
|
316
|
+
};
|
|
317
|
+
export { wireAddon } from '@pikku/core/rpc';
|
|
318
|
+
/**
|
|
319
|
+
* Addon contract references. Generated from each wired addon's published
|
|
320
|
+
* contract metadata — no addon source is imported. Functions are proxied via
|
|
321
|
+
* ref() (RPC) exactly like ref('namespace:fn').
|
|
322
|
+
*/
|
|
323
|
+
const __addonHttp = {};
|
|
324
|
+
const __addonChannel = {};
|
|
325
|
+
const __addonCli = {};
|
|
326
|
+
export const refHTTP = (name, options) => {
|
|
327
|
+
const contract = __addonHttp[name];
|
|
328
|
+
return (options?.basePath !== undefined
|
|
329
|
+
? { ...contract, basePath: options.basePath }
|
|
330
|
+
: contract);
|
|
331
|
+
};
|
|
332
|
+
export const refChannel = (name) => __addonChannel[name];
|
|
333
|
+
export const refCLI = (name) => __addonCli[name];
|
|
334
|
+
//# sourceMappingURL=pikku-function-types.gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pikku-function-types.gen.js","sourceRoot":"","sources":["../../../.pikku/function/pikku-function-types.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;GAEG;AAIH,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,EACL,gBAAgB,IAAI,oBAAoB,EACxC,mBAAmB,IAAI,uBAAuB,EAC9C,gBAAgB,IAAI,oBAAoB,EACxC,mBAAmB,IAAI,uBAAuB,GAC/C,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,UAAU,IAAI,YAAY,EAAsB,MAAM,sBAAsB,CAAA;AAyDrF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,UAA2D,EACtC,EAAE;IACvB,OAAO,OAAO,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAA;AACxE,CAAC,CAAA;AAgBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,IAAqE,EAC1C,EAAE;IAC7B,OAAO,aAAa,CAAC,IAAW,CAAQ,CAAA;AAC1C,CAAC,CAAA;AAcD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,UAAuF,EACpD,EAAE;IACrC,OAAO,OAAO,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAA;AACxE,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,OAAuC,EACL,EAAE;IACpC,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED;;;;;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