@pikku/addon-gotify 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.
Files changed (191) hide show
  1. package/README.md +12 -0
  2. package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +67 -0
  3. package/dist/.pikku/addon/pikku-addon-types.gen.d.ts.map +1 -0
  4. package/dist/.pikku/addon/pikku-addon-types.gen.js +78 -0
  5. package/dist/.pikku/addon/pikku-addon-types.gen.js.map +1 -0
  6. package/dist/.pikku/addon/pikku-addon-types.gen.ts +106 -0
  7. package/dist/.pikku/addon/pikku-package.gen.d.ts +2 -0
  8. package/dist/.pikku/addon/pikku-package.gen.d.ts.map +1 -0
  9. package/dist/.pikku/addon/pikku-package.gen.js +10 -0
  10. package/dist/.pikku/addon/pikku-package.gen.js.map +1 -0
  11. package/dist/.pikku/addon/pikku-package.gen.ts +11 -0
  12. package/dist/.pikku/agent/pikku-agent-map.gen.d.ts +4 -0
  13. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +47 -0
  14. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts.map +1 -0
  15. package/dist/.pikku/agent/pikku-agent-types.gen.js +18 -0
  16. package/dist/.pikku/agent/pikku-agent-types.gen.js.map +1 -0
  17. package/dist/.pikku/agent/pikku-agent-types.gen.ts +82 -0
  18. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +112 -0
  19. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts.map +1 -0
  20. package/dist/.pikku/channel/pikku-channel-types.gen.js +60 -0
  21. package/dist/.pikku/channel/pikku-channel-types.gen.js.map +1 -0
  22. package/dist/.pikku/channel/pikku-channel-types.gen.ts +177 -0
  23. package/dist/.pikku/console/pikku-node-types.gen.d.ts +7 -0
  24. package/dist/.pikku/console/pikku-node-types.gen.d.ts.map +1 -0
  25. package/dist/.pikku/console/pikku-node-types.gen.js +2 -0
  26. package/dist/.pikku/console/pikku-node-types.gen.js.map +1 -0
  27. package/dist/.pikku/console/pikku-node-types.gen.ts +8 -0
  28. package/dist/.pikku/credentials/pikku-credentials-meta.gen.json +10 -0
  29. package/dist/.pikku/credentials/pikku-credentials.gen.d.ts +15 -0
  30. package/dist/.pikku/credentials/pikku-credentials.gen.d.ts.map +1 -0
  31. package/dist/.pikku/credentials/pikku-credentials.gen.js +13 -0
  32. package/dist/.pikku/credentials/pikku-credentials.gen.js.map +1 -0
  33. package/dist/.pikku/credentials/pikku-credentials.gen.ts +23 -0
  34. package/dist/.pikku/function/pikku-function-types.gen.d.ts +490 -0
  35. package/dist/.pikku/function/pikku-function-types.gen.d.ts.map +1 -0
  36. package/dist/.pikku/function/pikku-function-types.gen.js +334 -0
  37. package/dist/.pikku/function/pikku-function-types.gen.js.map +1 -0
  38. package/dist/.pikku/function/pikku-function-types.gen.ts +754 -0
  39. package/dist/.pikku/function/pikku-functions-meta-verbose.gen.json +89 -0
  40. package/dist/.pikku/function/pikku-functions-meta.gen.d.ts +2 -0
  41. package/dist/.pikku/function/pikku-functions-meta.gen.d.ts.map +1 -0
  42. package/dist/.pikku/function/pikku-functions-meta.gen.js +7 -0
  43. package/dist/.pikku/function/pikku-functions-meta.gen.js.map +1 -0
  44. package/dist/.pikku/function/pikku-functions-meta.gen.json +59 -0
  45. package/dist/.pikku/function/pikku-functions-meta.gen.ts +7 -0
  46. package/dist/.pikku/function/pikku-functions.gen.d.ts +2 -0
  47. package/dist/.pikku/function/pikku-functions.gen.d.ts.map +1 -0
  48. package/dist/.pikku/function/pikku-functions.gen.js +12 -0
  49. package/dist/.pikku/function/pikku-functions.gen.js.map +1 -0
  50. package/dist/.pikku/function/pikku-functions.gen.ts +12 -0
  51. package/dist/.pikku/http/pikku-http-types.gen.d.ts +120 -0
  52. package/dist/.pikku/http/pikku-http-types.gen.d.ts.map +1 -0
  53. package/dist/.pikku/http/pikku-http-types.gen.js +72 -0
  54. package/dist/.pikku/http/pikku-http-types.gen.js.map +1 -0
  55. package/dist/.pikku/http/pikku-http-types.gen.ts +147 -0
  56. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +131 -0
  57. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts.map +1 -0
  58. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +38 -0
  59. package/dist/.pikku/mcp/pikku-mcp-types.gen.js.map +1 -0
  60. package/dist/.pikku/mcp/pikku-mcp-types.gen.ts +183 -0
  61. package/dist/.pikku/pikku-bootstrap.gen.d.ts +9 -0
  62. package/dist/.pikku/pikku-bootstrap.gen.d.ts.map +1 -0
  63. package/dist/.pikku/pikku-bootstrap.gen.js +9 -0
  64. package/dist/.pikku/pikku-bootstrap.gen.js.map +1 -0
  65. package/dist/.pikku/pikku-bootstrap.gen.ts +8 -0
  66. package/dist/.pikku/pikku-meta-service.gen.d.ts +8 -0
  67. package/dist/.pikku/pikku-meta-service.gen.d.ts.map +1 -0
  68. package/dist/.pikku/pikku-meta-service.gen.js +10 -0
  69. package/dist/.pikku/pikku-meta-service.gen.js.map +1 -0
  70. package/dist/.pikku/pikku-meta-service.gen.ts +10 -0
  71. package/dist/.pikku/pikku-services.gen.d.ts +35 -0
  72. package/dist/.pikku/pikku-services.gen.d.ts.map +1 -0
  73. package/dist/.pikku/pikku-services.gen.js +30 -0
  74. package/dist/.pikku/pikku-services.gen.js.map +1 -0
  75. package/dist/.pikku/pikku-services.gen.ts +42 -0
  76. package/dist/.pikku/pikku-types.gen.d.ts +12 -0
  77. package/dist/.pikku/pikku-types.gen.d.ts.map +1 -0
  78. package/dist/.pikku/pikku-types.gen.js +17 -0
  79. package/dist/.pikku/pikku-types.gen.js.map +1 -0
  80. package/dist/.pikku/pikku-types.gen.ts +21 -0
  81. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +24 -0
  82. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts.map +1 -0
  83. package/dist/.pikku/queue/pikku-queue-types.gen.js +17 -0
  84. package/dist/.pikku/queue/pikku-queue-types.gen.js.map +1 -0
  85. package/dist/.pikku/queue/pikku-queue-types.gen.ts +27 -0
  86. package/dist/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +119 -0
  87. package/dist/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +122 -0
  88. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts +2 -0
  89. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts.map +1 -0
  90. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +7 -0
  91. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js.map +1 -0
  92. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +5 -0
  93. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -0
  94. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +22 -0
  95. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts.map +1 -0
  96. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +17 -0
  97. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js.map +1 -0
  98. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
  99. package/dist/.pikku/schemas/register.gen.d.ts +2 -0
  100. package/dist/.pikku/schemas/register.gen.d.ts.map +1 -0
  101. package/dist/.pikku/schemas/register.gen.js +21 -0
  102. package/dist/.pikku/schemas/register.gen.js.map +1 -0
  103. package/dist/.pikku/schemas/register.gen.ts +35 -0
  104. package/dist/.pikku/schemas/schemas/CredentialSchema_gotify.schema.json +1 -0
  105. package/dist/.pikku/schemas/schemas/MessageCreateInput.schema.json +1 -0
  106. package/dist/.pikku/schemas/schemas/MessageCreateOutput.schema.json +1 -0
  107. package/dist/.pikku/schemas/schemas/MessageDeleteInput.schema.json +1 -0
  108. package/dist/.pikku/schemas/schemas/MessageDeleteOutput.schema.json +1 -0
  109. package/dist/.pikku/schemas/schemas/MessageGetAllInput.schema.json +1 -0
  110. package/dist/.pikku/schemas/schemas/MessageGetAllOutput.schema.json +1 -0
  111. package/dist/.pikku/schemas/schemas/VariableSchema_GOTIFY_BASE_URL.schema.json +1 -0
  112. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +6 -0
  113. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts.map +1 -0
  114. package/dist/.pikku/secrets/pikku-secret-types.gen.js +5 -0
  115. package/dist/.pikku/secrets/pikku-secret-types.gen.js.map +1 -0
  116. package/dist/.pikku/secrets/pikku-secret-types.gen.ts +5 -0
  117. package/dist/.pikku/secrets/pikku-secrets-meta.gen.json +1 -0
  118. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +12 -0
  119. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts.map +1 -0
  120. package/dist/.pikku/secrets/pikku-secrets.gen.js +11 -0
  121. package/dist/.pikku/secrets/pikku-secrets.gen.js.map +1 -0
  122. package/dist/.pikku/secrets/pikku-secrets.gen.ts +21 -0
  123. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +114 -0
  124. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts.map +1 -0
  125. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +34 -0
  126. package/dist/.pikku/trigger/pikku-trigger-types.gen.js.map +1 -0
  127. package/dist/.pikku/trigger/pikku-trigger-types.gen.ts +160 -0
  128. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +6 -0
  129. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts.map +1 -0
  130. package/dist/.pikku/variables/pikku-variable-types.gen.js +5 -0
  131. package/dist/.pikku/variables/pikku-variable-types.gen.js.map +1 -0
  132. package/dist/.pikku/variables/pikku-variable-types.gen.ts +5 -0
  133. package/dist/.pikku/variables/pikku-variables-meta.gen.json +10 -0
  134. package/dist/.pikku/variables/pikku-variables.gen.d.ts +15 -0
  135. package/dist/.pikku/variables/pikku-variables.gen.d.ts.map +1 -0
  136. package/dist/.pikku/variables/pikku-variables.gen.js +13 -0
  137. package/dist/.pikku/variables/pikku-variables.gen.js.map +1 -0
  138. package/dist/.pikku/variables/pikku-variables.gen.ts +23 -0
  139. package/dist/.pikku/workflow/pikku-workflow-map.gen.d.ts +38 -0
  140. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +90 -0
  141. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts.map +1 -0
  142. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +18 -0
  143. package/dist/.pikku/workflow/pikku-workflow-types.gen.js.map +1 -0
  144. package/dist/.pikku/workflow/pikku-workflow-types.gen.ts +167 -0
  145. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.d.ts +2 -0
  146. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.d.ts.map +1 -0
  147. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +7 -0
  148. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js.map +1 -0
  149. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +9 -0
  150. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +5 -0
  151. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts.map +1 -0
  152. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +5 -0
  153. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js.map +1 -0
  154. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.ts +3 -0
  155. package/dist/src/functions/messageCreate.function.d.ts +21 -0
  156. package/dist/src/functions/messageCreate.function.d.ts.map +1 -0
  157. package/dist/src/functions/messageCreate.function.js +17 -0
  158. package/dist/src/functions/messageCreate.function.js.map +1 -0
  159. package/dist/src/functions/messageDelete.function.d.ts +13 -0
  160. package/dist/src/functions/messageDelete.function.d.ts.map +1 -0
  161. package/dist/src/functions/messageDelete.function.js +15 -0
  162. package/dist/src/functions/messageDelete.function.js.map +1 -0
  163. package/dist/src/functions/messageGetAll.function.d.ts +13 -0
  164. package/dist/src/functions/messageGetAll.function.d.ts.map +1 -0
  165. package/dist/src/functions/messageGetAll.function.js +15 -0
  166. package/dist/src/functions/messageGetAll.function.js.map +1 -0
  167. package/dist/src/gotify-api.service.d.ts +10 -0
  168. package/dist/src/gotify-api.service.d.ts.map +1 -0
  169. package/dist/src/gotify-api.service.js +94 -0
  170. package/dist/src/gotify-api.service.js.map +1 -0
  171. package/dist/src/gotify.credential.d.ts +5 -0
  172. package/dist/src/gotify.credential.d.ts.map +1 -0
  173. package/dist/src/gotify.credential.js +13 -0
  174. package/dist/src/gotify.credential.js.map +1 -0
  175. package/dist/src/gotify.types.d.ts +7 -0
  176. package/dist/src/gotify.types.d.ts.map +1 -0
  177. package/dist/src/gotify.types.js +8 -0
  178. package/dist/src/gotify.types.js.map +1 -0
  179. package/dist/src/gotify.variable.d.ts +5 -0
  180. package/dist/src/gotify.variable.d.ts.map +1 -0
  181. package/dist/src/gotify.variable.js +11 -0
  182. package/dist/src/gotify.variable.js.map +1 -0
  183. package/dist/src/index.d.ts +4 -0
  184. package/dist/src/index.d.ts.map +1 -0
  185. package/dist/src/index.js +4 -0
  186. package/dist/src/index.js.map +1 -0
  187. package/dist/src/services.d.ts +2 -0
  188. package/dist/src/services.d.ts.map +1 -0
  189. package/dist/src/services.js +14 -0
  190. package/dist/src/services.js.map +1 -0
  191. 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-gotify');
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-gotify');
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-gotify');
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-gotify');
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,OAA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