@walkeros/server-source-gcp 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -91,6 +91,7 @@ interface Response {
|
|
|
91
91
|
}
|
|
92
92
|
type Settings = z.infer<typeof SettingsSchema>;
|
|
93
93
|
type CorsOptions = z.infer<typeof CorsOptionsSchema>;
|
|
94
|
+
type InitSettings = Partial<Settings>;
|
|
94
95
|
interface Mapping {
|
|
95
96
|
}
|
|
96
97
|
type Push = (req: Request, res: Response) => Promise<void>;
|
|
@@ -98,10 +99,11 @@ interface Env extends Source.Env {
|
|
|
98
99
|
req?: Request;
|
|
99
100
|
res?: Response;
|
|
100
101
|
}
|
|
101
|
-
type Types = Source.Types<Settings, Mapping, Push, Env>;
|
|
102
|
+
type Types = Source.Types<Settings, Mapping, Push, Env, InitSettings>;
|
|
102
103
|
interface CloudFunctionSource extends Omit<Source.Instance<Types>, 'push'> {
|
|
103
104
|
push: Push;
|
|
104
105
|
}
|
|
106
|
+
type Config = Source.Config<Types>;
|
|
105
107
|
type PartialConfig = Source.PartialConfig<Types>;
|
|
106
108
|
interface EventRequest {
|
|
107
109
|
event: string;
|
|
@@ -120,10 +122,12 @@ type RequestBody = EventRequest;
|
|
|
120
122
|
type ResponseBody = EventResponse;
|
|
121
123
|
|
|
122
124
|
type types_CloudFunctionSource = CloudFunctionSource;
|
|
125
|
+
type types_Config = Config;
|
|
123
126
|
type types_CorsOptions = CorsOptions;
|
|
124
127
|
type types_Env = Env;
|
|
125
128
|
type types_EventRequest = EventRequest;
|
|
126
129
|
type types_EventResponse = EventResponse;
|
|
130
|
+
type types_InitSettings = InitSettings;
|
|
127
131
|
type types_Mapping = Mapping;
|
|
128
132
|
type types_PartialConfig = PartialConfig;
|
|
129
133
|
type types_Push = Push;
|
|
@@ -134,7 +138,7 @@ type types_ResponseBody = ResponseBody;
|
|
|
134
138
|
type types_Settings = Settings;
|
|
135
139
|
type types_Types = Types;
|
|
136
140
|
declare namespace types {
|
|
137
|
-
export type { types_CloudFunctionSource as CloudFunctionSource, types_CorsOptions as CorsOptions, types_Env as Env, types_EventRequest as EventRequest, types_EventResponse as EventResponse, types_Mapping as Mapping, types_PartialConfig as PartialConfig, types_Push as Push, types_Request as Request, types_RequestBody as RequestBody, types_Response as Response, types_ResponseBody as ResponseBody, types_Settings as Settings, types_Types as Types };
|
|
141
|
+
export type { types_CloudFunctionSource as CloudFunctionSource, types_Config as Config, types_CorsOptions as CorsOptions, types_Env as Env, types_EventRequest as EventRequest, types_EventResponse as EventResponse, types_InitSettings as InitSettings, types_Mapping as Mapping, types_PartialConfig as PartialConfig, types_Push as Push, types_Request as Request, types_RequestBody as RequestBody, types_Response as Response, types_ResponseBody as ResponseBody, types_Settings as Settings, types_Types as Types };
|
|
138
142
|
}
|
|
139
143
|
|
|
140
144
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,7 @@ interface Response {
|
|
|
91
91
|
}
|
|
92
92
|
type Settings = z.infer<typeof SettingsSchema>;
|
|
93
93
|
type CorsOptions = z.infer<typeof CorsOptionsSchema>;
|
|
94
|
+
type InitSettings = Partial<Settings>;
|
|
94
95
|
interface Mapping {
|
|
95
96
|
}
|
|
96
97
|
type Push = (req: Request, res: Response) => Promise<void>;
|
|
@@ -98,10 +99,11 @@ interface Env extends Source.Env {
|
|
|
98
99
|
req?: Request;
|
|
99
100
|
res?: Response;
|
|
100
101
|
}
|
|
101
|
-
type Types = Source.Types<Settings, Mapping, Push, Env>;
|
|
102
|
+
type Types = Source.Types<Settings, Mapping, Push, Env, InitSettings>;
|
|
102
103
|
interface CloudFunctionSource extends Omit<Source.Instance<Types>, 'push'> {
|
|
103
104
|
push: Push;
|
|
104
105
|
}
|
|
106
|
+
type Config = Source.Config<Types>;
|
|
105
107
|
type PartialConfig = Source.PartialConfig<Types>;
|
|
106
108
|
interface EventRequest {
|
|
107
109
|
event: string;
|
|
@@ -120,10 +122,12 @@ type RequestBody = EventRequest;
|
|
|
120
122
|
type ResponseBody = EventResponse;
|
|
121
123
|
|
|
122
124
|
type types_CloudFunctionSource = CloudFunctionSource;
|
|
125
|
+
type types_Config = Config;
|
|
123
126
|
type types_CorsOptions = CorsOptions;
|
|
124
127
|
type types_Env = Env;
|
|
125
128
|
type types_EventRequest = EventRequest;
|
|
126
129
|
type types_EventResponse = EventResponse;
|
|
130
|
+
type types_InitSettings = InitSettings;
|
|
127
131
|
type types_Mapping = Mapping;
|
|
128
132
|
type types_PartialConfig = PartialConfig;
|
|
129
133
|
type types_Push = Push;
|
|
@@ -134,7 +138,7 @@ type types_ResponseBody = ResponseBody;
|
|
|
134
138
|
type types_Settings = Settings;
|
|
135
139
|
type types_Types = Types;
|
|
136
140
|
declare namespace types {
|
|
137
|
-
export type { types_CloudFunctionSource as CloudFunctionSource, types_CorsOptions as CorsOptions, types_Env as Env, types_EventRequest as EventRequest, types_EventResponse as EventResponse, types_Mapping as Mapping, types_PartialConfig as PartialConfig, types_Push as Push, types_Request as Request, types_RequestBody as RequestBody, types_Response as Response, types_ResponseBody as ResponseBody, types_Settings as Settings, types_Types as Types };
|
|
141
|
+
export type { types_CloudFunctionSource as CloudFunctionSource, types_Config as Config, types_CorsOptions as CorsOptions, types_Env as Env, types_EventRequest as EventRequest, types_EventResponse as EventResponse, types_InitSettings as InitSettings, types_Mapping as Mapping, types_PartialConfig as PartialConfig, types_Push as Push, types_Request as Request, types_RequestBody as RequestBody, types_Response as Response, types_ResponseBody as ResponseBody, types_Settings as Settings, types_Types as Types };
|
|
138
142
|
}
|
|
139
143
|
|
|
140
144
|
/**
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/cloudfunction/utils.ts","../src/cloudfunction/push.ts","../src/cloudfunction/types.ts","../src/cloudfunction/schemas/index.ts","../src/cloudfunction/schemas/settings.ts","../src/cloudfunction/schemas/primitives.ts","../src/cloudfunction/examples/index.ts","../src/cloudfunction/examples/env.ts","../src/cloudfunction/index.ts"],"sourcesContent":["export * from './cloudfunction';\nexport { default as sourceCloudFunction } from './cloudfunction';\n","import type { RequestBody, EventRequest, CorsOptions, Response } from './types';\n\nexport function isEventRequest(body: RequestBody): body is EventRequest {\n return 'event' in body && typeof body.event === 'string';\n}\n\nexport function setCorsHeaders(\n res: Response,\n corsOptions: boolean | CorsOptions,\n): void {\n if (!corsOptions) return;\n\n if (corsOptions === true) {\n res.set('Access-Control-Allow-Origin', '*');\n res.set('Access-Control-Allow-Methods', 'POST, OPTIONS');\n res.set('Access-Control-Allow-Headers', 'Content-Type, Authorization');\n res.set('Access-Control-Max-Age', '3600');\n } else {\n if (corsOptions.origin) {\n const origin = Array.isArray(corsOptions.origin)\n ? corsOptions.origin.join(', ')\n : corsOptions.origin;\n res.set('Access-Control-Allow-Origin', origin);\n }\n if (corsOptions.methods) {\n res.set('Access-Control-Allow-Methods', corsOptions.methods.join(', '));\n }\n if (corsOptions.headers) {\n res.set('Access-Control-Allow-Headers', corsOptions.headers.join(', '));\n }\n if (corsOptions.credentials) {\n res.set('Access-Control-Allow-Credentials', 'true');\n }\n if (corsOptions.maxAge !== undefined) {\n res.set('Access-Control-Max-Age', corsOptions.maxAge.toString());\n }\n }\n}\n","import type { Collector, WalkerOS } from '@walkeros/core';\nimport type { EventRequest } from './types';\n\nexport async function processEvent(\n eventReq: EventRequest,\n push: Collector.PushFn,\n): Promise<{ id?: string; error?: string }> {\n try {\n const result = await push({\n name: eventReq.event,\n data: (eventReq.data || {}) as WalkerOS.Properties,\n context: eventReq.context as WalkerOS.OrderedProperties | undefined,\n user: eventReq.user as WalkerOS.User | undefined,\n globals: eventReq.globals as WalkerOS.Properties | undefined,\n consent: eventReq.consent as WalkerOS.Consent | undefined,\n });\n\n return { id: result?.event?.id };\n } catch (error) {\n return { error: error instanceof Error ? error.message : 'Unknown error' };\n }\n}\n","import type { WalkerOS, Source as CoreSource } from '@walkeros/core';\nimport type { SettingsSchema, CorsOptionsSchema } from './schemas';\nimport { z } from '@walkeros/core/dev';\n\n// Minimal request/response interfaces\nexport interface Request {\n method: string;\n body?: unknown;\n headers: Record<string, string | string[]>;\n get(name: string): string | undefined;\n}\n\nexport interface Response {\n status(code: number): Response;\n json(body: unknown): Response;\n send(body?: unknown): Response;\n set(key: string, value: string): Response;\n}\n\n// Types inferred from Zod schemas\nexport type Settings = z.infer<typeof SettingsSchema>;\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n\nexport interface Mapping {\n // Custom source event mapping properties\n}\n\n// CloudFunction-specific push type\nexport type Push = (req: Request, res: Response) => Promise<void>;\n\nexport interface Env extends CoreSource.Env {\n req?: Request;\n res?: Response;\n}\n\n// Type bundle (must be after Settings, Mapping, Push, Env are defined)\nexport type Types = CoreSource.Types<Settings, Mapping, Push, Env>;\n\nexport interface CloudFunctionSource\n extends Omit<CoreSource.Instance<Types>, 'push'> {\n push: Push;\n}\n\n// Removed custom Config type - using Source.Config<Types> directly\nexport type PartialConfig = CoreSource.PartialConfig<Types>;\n\n// Cloud function source doesn't follow standard Source.Init pattern due to HTTP handler interface\n\nexport interface EventRequest {\n event: string;\n data?: WalkerOS.AnyObject;\n context?: WalkerOS.AnyObject;\n user?: WalkerOS.AnyObject;\n globals?: WalkerOS.AnyObject;\n consent?: WalkerOS.AnyObject;\n}\n\nexport interface EventResponse {\n success: boolean;\n id?: string;\n error?: string;\n}\n\nexport type RequestBody = EventRequest;\nexport type ResponseBody = EventResponse;\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export primitives\nexport * from './primitives';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable and documentation tools)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema } from './primitives';\n\n/**\n * GCP CloudFunction source settings schema\n */\nexport const SettingsSchema = z.object({\n cors: z\n .union([z.boolean(), CorsOptionsSchema])\n .describe(\n 'CORS configuration: false = disabled, true = allow all origins, object = custom configuration',\n )\n .optional(),\n\n timeout: z\n .number()\n .int()\n .positive()\n .max(540000) // GCP Cloud Functions max timeout: 9 minutes\n .describe('Request timeout in milliseconds (max: 540000 for GCP)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * HTTP methods enum\n */\nexport const HttpMethod = z.enum([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n 'HEAD',\n]);\n\n/**\n * CORS origin configuration\n * Accepts:\n * - '*' for all origins\n * - Single URL string\n * - Array of URL strings\n */\nexport const CorsOrigin = z.union([\n z.string(),\n z.array(z.string()),\n z.literal('*'),\n]);\n\n/**\n * CORS options schema\n * Configuration for Cross-Origin Resource Sharing\n */\nexport const CorsOptionsSchema = z.object({\n origin: CorsOrigin.describe(\n 'Allowed origins (* for all, URL string, or array of URLs)',\n ).optional(),\n\n methods: z.array(HttpMethod).describe('Allowed HTTP methods').optional(),\n\n headers: z.array(z.string()).describe('Allowed request headers').optional(),\n\n credentials: z\n .boolean()\n .describe('Allow credentials (cookies, authorization headers)')\n .optional(),\n\n maxAge: z\n .number()\n .int()\n .positive()\n .describe('Preflight cache duration in seconds')\n .optional(),\n});\n\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n","export * as env from './env';\n","import type { Env } from '../types';\nimport type { Elb } from '@walkeros/core';\n\n/**\n * Example environment configurations for GCP Cloud Function source\n *\n * These environments provide standardized mock structures for testing\n * HTTP request handling without requiring actual cloud function deployment.\n */\n\n// Create a properly typed elb/push/command function that returns a promise with PushResult\nconst createMockElbFn = (): Elb.Fn => {\n const fn = (() =>\n Promise.resolve({\n ok: true,\n successful: [],\n queued: [],\n failed: [],\n })) as Elb.Fn;\n return fn;\n};\n\n/**\n * Standard mock environment for testing cloud function source\n *\n * Use this for testing HTTP event ingestion and request/response handling\n * without requiring a real GCP Cloud Function environment.\n */\nexport const push: Env = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n};\n","import type {\n Env,\n CloudFunctionSource,\n Settings,\n EventResponse,\n RequestBody,\n Request,\n Response,\n Mapping,\n Types,\n} from './types';\nimport type { Source } from '@walkeros/core';\nimport { isEventRequest, setCorsHeaders } from './utils';\nimport { processEvent } from './push';\n\nexport * as SourceCloudFunction from './types';\nexport * as schemas from './schemas';\n\n// Export examples\nexport * as examples from './examples';\n\nconst DEFAULT_SETTINGS: Settings = {\n cors: true,\n timeout: 30000,\n};\n\nexport const sourceCloudFunction = async (\n config: Partial<Source.Config<Types>> = {},\n env: Env,\n): Promise<CloudFunctionSource> => {\n const { push: envPush } = env;\n\n const settings: Settings = {\n ...DEFAULT_SETTINGS,\n ...(config.settings || {}),\n };\n\n const fullConfig: Source.Config<Types> = {\n ...config,\n settings,\n };\n\n const push = async (req: Request, res: Response): Promise<void> => {\n try {\n setCorsHeaders(res, settings.cors || false);\n\n if (req.method === 'OPTIONS') {\n res.status(204).send();\n return;\n }\n\n if (req.method !== 'POST') {\n res.status(405).json({\n success: false,\n error: 'Method not allowed. Use POST.',\n });\n return;\n }\n\n if (!req.body) {\n res.status(400).json({\n success: false,\n error: 'Request body is required',\n });\n return;\n }\n\n const body = req.body as RequestBody;\n\n if (isEventRequest(body)) {\n const result = await processEvent(body, envPush);\n\n if (result.error) {\n res.status(400).json({\n success: false,\n error: result.error,\n } as EventResponse);\n } else {\n res.status(200).json({\n success: true,\n id: result.id,\n } as EventResponse);\n }\n } else {\n res.status(400).json({\n success: false,\n error: 'Invalid request format. Expected event object.',\n });\n }\n } catch (error) {\n res.status(500).json({\n success: false,\n error: error instanceof Error ? error.message : 'Internal server error',\n });\n }\n };\n\n return {\n type: 'cloudfunction',\n config: fullConfig,\n push,\n };\n};\n\nexport default sourceCloudFunction;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,SAAS,eAAe,MAAyC;AACtE,SAAO,WAAW,QAAQ,OAAO,KAAK,UAAU;AAClD;AAEO,SAAS,eACd,KACA,aACM;AACN,MAAI,CAAC,YAAa;AAElB,MAAI,gBAAgB,MAAM;AACxB,QAAI,IAAI,+BAA+B,GAAG;AAC1C,QAAI,IAAI,gCAAgC,eAAe;AACvD,QAAI,IAAI,gCAAgC,6BAA6B;AACrE,QAAI,IAAI,0BAA0B,MAAM;AAAA,EAC1C,OAAO;AACL,QAAI,YAAY,QAAQ;AACtB,YAAM,SAAS,MAAM,QAAQ,YAAY,MAAM,IAC3C,YAAY,OAAO,KAAK,IAAI,IAC5B,YAAY;AAChB,UAAI,IAAI,+BAA+B,MAAM;AAAA,IAC/C;AACA,QAAI,YAAY,SAAS;AACvB,UAAI,IAAI,gCAAgC,YAAY,QAAQ,KAAK,IAAI,CAAC;AAAA,IACxE;AACA,QAAI,YAAY,SAAS;AACvB,UAAI,IAAI,gCAAgC,YAAY,QAAQ,KAAK,IAAI,CAAC;AAAA,IACxE;AACA,QAAI,YAAY,aAAa;AAC3B,UAAI,IAAI,oCAAoC,MAAM;AAAA,IACpD;AACA,QAAI,YAAY,WAAW,QAAW;AACpC,UAAI,IAAI,0BAA0B,YAAY,OAAO,SAAS,CAAC;AAAA,IACjE;AAAA,EACF;AACF;;;AClCA,eAAsB,aACpB,UACAA,OAC0C;AAN5C;AAOE,MAAI;AACF,UAAM,SAAS,MAAMA,MAAK;AAAA,MACxB,MAAM,SAAS;AAAA,MACf,MAAO,SAAS,QAAQ,CAAC;AAAA,MACzB,SAAS,SAAS;AAAA,MAClB,MAAM,SAAS;AAAA,MACf,SAAS,SAAS;AAAA,MAClB,SAAS,SA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AAI,GAAG;AACxB,cAAM,SAAS,MAAM,aAAa,MAAM,OAAO;AAE/C,YAAI,OAAO,OAAO;AAChB,cAAI,OAAO,GAAG,EAAE,KAAK;AAAA,YACnB,SAAS;AAAA,YACT,OAAO,OAAO;AAAA,UAChB,CAAkB;AAAA,QACpB,OAAO;AACL,cAAI,OAAO,GAAG,EAAE,KAAK;AAAA,YACnB,SAAS;AAAA,YACT,IAAI,OAAO;AAAA,UACb,CAAkB;AAAA,QACpB;AAAA,MACF,OAAO;AACL,YAAI,OAAO,GAAG,EAAE,KAAK;AAAA,UACnB,SAAS;AAAA,UACT,OAAO;AAAA,QACT,CAAC;AAAA,MACH;AAAA,IACF,SAAS,OAAO;AACd,UAAI,OAAO,GAAG,EAAE,KAAK;AAAA,QACnB,SAAS;AAAA,QACT,OAAO,iBAAiB,QAAQ,MAAM,UAAU;AAAA,MAClD,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAAC;AAAA,EACF;AACF;AAEA,IAAO,wBAAQ;","names":["push","import_dev","import_dev","settings","push"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/cloudfunction/utils.ts","../src/cloudfunction/push.ts","../src/cloudfunction/types.ts","../src/cloudfunction/schemas/index.ts","../src/cloudfunction/schemas/settings.ts","../src/cloudfunction/schemas/primitives.ts","../src/cloudfunction/examples/index.ts","../src/cloudfunction/examples/env.ts","../src/cloudfunction/index.ts"],"sourcesContent":["export * from './cloudfunction';\nexport { default as sourceCloudFunction } from './cloudfunction';\n","import type { RequestBody, EventRequest, CorsOptions, Response } from './types';\n\nexport function isEventRequest(body: RequestBody): body is EventRequest {\n return 'event' in body && typeof body.event === 'string';\n}\n\nexport function setCorsHeaders(\n res: Response,\n corsOptions: boolean | CorsOptions,\n): void {\n if (!corsOptions) return;\n\n if (corsOptions === true) {\n res.set('Access-Control-Allow-Origin', '*');\n res.set('Access-Control-Allow-Methods', 'POST, OPTIONS');\n res.set('Access-Control-Allow-Headers', 'Content-Type, Authorization');\n res.set('Access-Control-Max-Age', '3600');\n } else {\n if (corsOptions.origin) {\n const origin = Array.isArray(corsOptions.origin)\n ? corsOptions.origin.join(', ')\n : corsOptions.origin;\n res.set('Access-Control-Allow-Origin', origin);\n }\n if (corsOptions.methods) {\n res.set('Access-Control-Allow-Methods', corsOptions.methods.join(', '));\n }\n if (corsOptions.headers) {\n res.set('Access-Control-Allow-Headers', corsOptions.headers.join(', '));\n }\n if (corsOptions.credentials) {\n res.set('Access-Control-Allow-Credentials', 'true');\n }\n if (corsOptions.maxAge !== undefined) {\n res.set('Access-Control-Max-Age', corsOptions.maxAge.toString());\n }\n }\n}\n","import type { Collector, WalkerOS } from '@walkeros/core';\nimport type { EventRequest } from './types';\n\nexport async function processEvent(\n eventReq: EventRequest,\n push: Collector.PushFn,\n): Promise<{ id?: string; error?: string }> {\n try {\n const result = await push({\n name: eventReq.event,\n data: (eventReq.data || {}) as WalkerOS.Properties,\n context: eventReq.context as WalkerOS.OrderedProperties | undefined,\n user: eventReq.user as WalkerOS.User | undefined,\n globals: eventReq.globals as WalkerOS.Properties | undefined,\n consent: eventReq.consent as WalkerOS.Consent | undefined,\n });\n\n return { id: result?.event?.id };\n } catch (error) {\n return { error: error instanceof Error ? error.message : 'Unknown error' };\n }\n}\n","import type { WalkerOS, Source as CoreSource } from '@walkeros/core';\nimport type { SettingsSchema, CorsOptionsSchema } from './schemas';\nimport { z } from '@walkeros/core/dev';\n\n// Minimal request/response interfaces\nexport interface Request {\n method: string;\n body?: unknown;\n headers: Record<string, string | string[]>;\n get(name: string): string | undefined;\n}\n\nexport interface Response {\n status(code: number): Response;\n json(body: unknown): Response;\n send(body?: unknown): Response;\n set(key: string, value: string): Response;\n}\n\n// Types inferred from Zod schemas\nexport type Settings = z.infer<typeof SettingsSchema>;\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n\n// InitSettings: user input (all optional)\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {\n // Custom source event mapping properties\n}\n\n// CloudFunction-specific push type\nexport type Push = (req: Request, res: Response) => Promise<void>;\n\nexport interface Env extends CoreSource.Env {\n req?: Request;\n res?: Response;\n}\n\n// Type bundle (must be after Settings, Mapping, Push, Env are defined)\nexport type Types = CoreSource.Types<\n Settings,\n Mapping,\n Push,\n Env,\n InitSettings\n>;\n\nexport interface CloudFunctionSource\n extends Omit<CoreSource.Instance<Types>, 'push'> {\n push: Push;\n}\n\n// Convenience Config type\nexport type Config = CoreSource.Config<Types>;\nexport type PartialConfig = CoreSource.PartialConfig<Types>;\n\n// Cloud function source doesn't follow standard Source.Init pattern due to HTTP handler interface\n\nexport interface EventRequest {\n event: string;\n data?: WalkerOS.AnyObject;\n context?: WalkerOS.AnyObject;\n user?: WalkerOS.AnyObject;\n globals?: WalkerOS.AnyObject;\n consent?: WalkerOS.AnyObject;\n}\n\nexport interface EventResponse {\n success: boolean;\n id?: string;\n error?: string;\n}\n\nexport type RequestBody = EventRequest;\nexport type ResponseBody = EventResponse;\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export primitives\nexport * from './primitives';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable and documentation tools)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema } from './primitives';\n\n/**\n * GCP CloudFunction source settings schema\n */\nexport const SettingsSchema = z.object({\n cors: z\n .union([z.boolean(), CorsOptionsSchema])\n .describe(\n 'CORS configuration: false = disabled, true = allow all origins, object = custom configuration',\n )\n .optional(),\n\n timeout: z\n .number()\n .int()\n .positive()\n .max(540000) // GCP Cloud Functions max timeout: 9 minutes\n .describe('Request timeout in milliseconds (max: 540000 for GCP)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * HTTP methods enum\n */\nexport const HttpMethod = z.enum([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n 'HEAD',\n]);\n\n/**\n * CORS origin configuration\n * Accepts:\n * - '*' for all origins\n * - Single URL string\n * - Array of URL strings\n */\nexport const CorsOrigin = z.union([\n z.string(),\n z.array(z.string()),\n z.literal('*'),\n]);\n\n/**\n * CORS options schema\n * Configuration for Cross-Origin Resource Sharing\n */\nexport const CorsOptionsSchema = z.object({\n origin: CorsOrigin.describe(\n 'Allowed origins (* for all, URL string, or array of URLs)',\n ).optional(),\n\n methods: z.array(HttpMethod).describe('Allowed HTTP methods').optional(),\n\n headers: z.array(z.string()).describe('Allowed request headers').optional(),\n\n credentials: z\n .boolean()\n .describe('Allow credentials (cookies, authorization headers)')\n .optional(),\n\n maxAge: z\n .number()\n .int()\n .positive()\n .describe('Preflight cache duration in seconds')\n .optional(),\n});\n\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n","export * as env from './env';\n","import type { Env } from '../types';\nimport type { Elb } from '@walkeros/core';\n\n/**\n * Example environment configurations for GCP Cloud Function source\n *\n * These environments provide standardized mock structures for testing\n * HTTP request handling without requiring actual cloud function deployment.\n */\n\n// Create a properly typed elb/push/command function that returns a promise with PushResult\nconst createMockElbFn = (): Elb.Fn => {\n const fn = (() =>\n Promise.resolve({\n ok: true,\n successful: [],\n queued: [],\n failed: [],\n })) as Elb.Fn;\n return fn;\n};\n\n/**\n * Standard mock environment for testing cloud function source\n *\n * Use this for testing HTTP event ingestion and request/response handling\n * without requiring a real GCP Cloud Function environment.\n */\nexport const push: Env = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n};\n","import type {\n Env,\n CloudFunctionSource,\n Settings,\n EventResponse,\n RequestBody,\n Request,\n Response,\n Mapping,\n Types,\n} from './types';\nimport type { Source } from '@walkeros/core';\nimport { isEventRequest, setCorsHeaders } from './utils';\nimport { processEvent } from './push';\n\nexport * as SourceCloudFunction from './types';\nexport * as schemas from './schemas';\n\n// Export examples\nexport * as examples from './examples';\n\nconst DEFAULT_SETTINGS: Settings = {\n cors: true,\n timeout: 30000,\n};\n\nexport const sourceCloudFunction = async (\n config: Partial<Source.Config<Types>> = {},\n env: Env,\n): Promise<CloudFunctionSource> => {\n const { push: envPush } = env;\n\n const settings: Settings = {\n ...DEFAULT_SETTINGS,\n ...(config.settings || {}),\n };\n\n const fullConfig: Source.Config<Types> = {\n ...config,\n settings,\n };\n\n const push = async (req: Request, res: Response): Promise<void> => {\n try {\n setCorsHeaders(res, settings.cors || false);\n\n if (req.method === 'OPTIONS') {\n res.status(204).send();\n return;\n }\n\n if (req.method !== 'POST') {\n res.status(405).json({\n success: false,\n error: 'Method not allowed. Use POST.',\n });\n return;\n }\n\n if (!req.body) {\n res.status(400).json({\n success: false,\n error: 'Request body is required',\n });\n return;\n }\n\n const body = req.body as RequestBody;\n\n if (isEventRequest(body)) {\n const result = await processEvent(body, envPush);\n\n if (result.error) {\n res.status(400).json({\n success: false,\n error: result.error,\n } as EventResponse);\n } else {\n res.status(200).json({\n success: true,\n id: result.id,\n } as EventResponse);\n }\n } else {\n res.status(400).json({\n success: false,\n error: 'Invalid request format. Expected event object.',\n });\n }\n } catch (error) {\n res.status(500).json({\n success: false,\n error: error instanceof Error ? error.message : 'Internal server error',\n });\n }\n };\n\n return {\n type: 'cloudfunction',\n config: fullConfig,\n push,\n };\n};\n\nexport default sourceCloudFunction;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,SAAS,eAAe,MAAyC;AACtE,SAAO,WAAW,QAAQ,OAAO,KAAK,UAAU;AAClD;AAEO,SAAS,eACd,KACA,aACM;AACN,MAAI,CAAC,YAAa;AAElB,MAAI,gBAAgB,MAAM;AACxB,QAAI,IAAI,+BAA+B,GAAG;AAC1C,QAAI,IAAI,gCAAgC,eAAe;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QACT,CAAC;AAAA,MACH;AAAA,IACF,SAAS,OAAO;AACd,UAAI,OAAO,GAAG,EAAE,KAAK;AAAA,QACnB,SAAS;AAAA,QACT,OAAO,iBAAiB,QAAQ,MAAM,UAAU;AAAA,MAClD,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAAC;AAAA,EACF;AACF;AAEA,IAAO,wBAAQ;","names":["push","import_dev","import_dev","settings","push"]}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cloudfunction/utils.ts","../src/cloudfunction/push.ts","../src/cloudfunction/types.ts","../src/cloudfunction/schemas/index.ts","../src/cloudfunction/schemas/settings.ts","../src/cloudfunction/schemas/primitives.ts","../src/cloudfunction/examples/index.ts","../src/cloudfunction/examples/env.ts","../src/cloudfunction/index.ts"],"sourcesContent":["import type { RequestBody, EventRequest, CorsOptions, Response } from './types';\n\nexport function isEventRequest(body: RequestBody): body is EventRequest {\n return 'event' in body && typeof body.event === 'string';\n}\n\nexport function setCorsHeaders(\n res: Response,\n corsOptions: boolean | CorsOptions,\n): void {\n if (!corsOptions) return;\n\n if (corsOptions === true) {\n res.set('Access-Control-Allow-Origin', '*');\n res.set('Access-Control-Allow-Methods', 'POST, OPTIONS');\n res.set('Access-Control-Allow-Headers', 'Content-Type, Authorization');\n res.set('Access-Control-Max-Age', '3600');\n } else {\n if (corsOptions.origin) {\n const origin = Array.isArray(corsOptions.origin)\n ? corsOptions.origin.join(', ')\n : corsOptions.origin;\n res.set('Access-Control-Allow-Origin', origin);\n }\n if (corsOptions.methods) {\n res.set('Access-Control-Allow-Methods', corsOptions.methods.join(', '));\n }\n if (corsOptions.headers) {\n res.set('Access-Control-Allow-Headers', corsOptions.headers.join(', '));\n }\n if (corsOptions.credentials) {\n res.set('Access-Control-Allow-Credentials', 'true');\n }\n if (corsOptions.maxAge !== undefined) {\n res.set('Access-Control-Max-Age', corsOptions.maxAge.toString());\n }\n }\n}\n","import type { Collector, WalkerOS } from '@walkeros/core';\nimport type { EventRequest } from './types';\n\nexport async function processEvent(\n eventReq: EventRequest,\n push: Collector.PushFn,\n): Promise<{ id?: string; error?: string }> {\n try {\n const result = await push({\n name: eventReq.event,\n data: (eventReq.data || {}) as WalkerOS.Properties,\n context: eventReq.context as WalkerOS.OrderedProperties | undefined,\n user: eventReq.user as WalkerOS.User | undefined,\n globals: eventReq.globals as WalkerOS.Properties | undefined,\n consent: eventReq.consent as WalkerOS.Consent | undefined,\n });\n\n return { id: result?.event?.id };\n } catch (error) {\n return { error: error instanceof Error ? error.message : 'Unknown error' };\n }\n}\n","import type { WalkerOS, Source as CoreSource } from '@walkeros/core';\nimport type { SettingsSchema, CorsOptionsSchema } from './schemas';\nimport { z } from '@walkeros/core/dev';\n\n// Minimal request/response interfaces\nexport interface Request {\n method: string;\n body?: unknown;\n headers: Record<string, string | string[]>;\n get(name: string): string | undefined;\n}\n\nexport interface Response {\n status(code: number): Response;\n json(body: unknown): Response;\n send(body?: unknown): Response;\n set(key: string, value: string): Response;\n}\n\n// Types inferred from Zod schemas\nexport type Settings = z.infer<typeof SettingsSchema>;\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n\nexport interface Mapping {\n // Custom source event mapping properties\n}\n\n// CloudFunction-specific push type\nexport type Push = (req: Request, res: Response) => Promise<void>;\n\nexport interface Env extends CoreSource.Env {\n req?: Request;\n res?: Response;\n}\n\n// Type bundle (must be after Settings, Mapping, Push, Env are defined)\nexport type Types = CoreSource.Types<Settings, Mapping, Push, Env>;\n\nexport interface CloudFunctionSource\n extends Omit<CoreSource.Instance<Types>, 'push'> {\n push: Push;\n}\n\n// Removed custom Config type - using Source.Config<Types> directly\nexport type PartialConfig = CoreSource.PartialConfig<Types>;\n\n// Cloud function source doesn't follow standard Source.Init pattern due to HTTP handler interface\n\nexport interface EventRequest {\n event: string;\n data?: WalkerOS.AnyObject;\n context?: WalkerOS.AnyObject;\n user?: WalkerOS.AnyObject;\n globals?: WalkerOS.AnyObject;\n consent?: WalkerOS.AnyObject;\n}\n\nexport interface EventResponse {\n success: boolean;\n id?: string;\n error?: string;\n}\n\nexport type RequestBody = EventRequest;\nexport type ResponseBody = EventResponse;\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export primitives\nexport * from './primitives';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable and documentation tools)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema } from './primitives';\n\n/**\n * GCP CloudFunction source settings schema\n */\nexport const SettingsSchema = z.object({\n cors: z\n .union([z.boolean(), CorsOptionsSchema])\n .describe(\n 'CORS configuration: false = disabled, true = allow all origins, object = custom configuration',\n )\n .optional(),\n\n timeout: z\n .number()\n .int()\n .positive()\n .max(540000) // GCP Cloud Functions max timeout: 9 minutes\n .describe('Request timeout in milliseconds (max: 540000 for GCP)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * HTTP methods enum\n */\nexport const HttpMethod = z.enum([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n 'HEAD',\n]);\n\n/**\n * CORS origin configuration\n * Accepts:\n * - '*' for all origins\n * - Single URL string\n * - Array of URL strings\n */\nexport const CorsOrigin = z.union([\n z.string(),\n z.array(z.string()),\n z.literal('*'),\n]);\n\n/**\n * CORS options schema\n * Configuration for Cross-Origin Resource Sharing\n */\nexport const CorsOptionsSchema = z.object({\n origin: CorsOrigin.describe(\n 'Allowed origins (* for all, URL string, or array of URLs)',\n ).optional(),\n\n methods: z.array(HttpMethod).describe('Allowed HTTP methods').optional(),\n\n headers: z.array(z.string()).describe('Allowed request headers').optional(),\n\n credentials: z\n .boolean()\n .describe('Allow credentials (cookies, authorization headers)')\n .optional(),\n\n maxAge: z\n .number()\n .int()\n .positive()\n .describe('Preflight cache duration in seconds')\n .optional(),\n});\n\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n","export * as env from './env';\n","import type { Env } from '../types';\nimport type { Elb } from '@walkeros/core';\n\n/**\n * Example environment configurations for GCP Cloud Function source\n *\n * These environments provide standardized mock structures for testing\n * HTTP request handling without requiring actual cloud function deployment.\n */\n\n// Create a properly typed elb/push/command function that returns a promise with PushResult\nconst createMockElbFn = (): Elb.Fn => {\n const fn = (() =>\n Promise.resolve({\n ok: true,\n successful: [],\n queued: [],\n failed: [],\n })) as Elb.Fn;\n return fn;\n};\n\n/**\n * Standard mock environment for testing cloud function source\n *\n * Use this for testing HTTP event ingestion and request/response handling\n * without requiring a real GCP Cloud Function environment.\n */\nexport const push: Env = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n};\n","import type {\n Env,\n CloudFunctionSource,\n Settings,\n EventResponse,\n RequestBody,\n Request,\n Response,\n Mapping,\n Types,\n} from './types';\nimport type { Source } from '@walkeros/core';\nimport { isEventRequest, setCorsHeaders } from './utils';\nimport { processEvent } from './push';\n\nexport * as SourceCloudFunction from './types';\nexport * as schemas from './schemas';\n\n// Export examples\nexport * as examples from './examples';\n\nconst DEFAULT_SETTINGS: Settings = {\n cors: true,\n timeout: 30000,\n};\n\nexport const sourceCloudFunction = async (\n config: Partial<Source.Config<Types>> = {},\n env: Env,\n): Promise<CloudFunctionSource> => {\n const { push: envPush } = env;\n\n const settings: Settings = {\n ...DEFAULT_SETTINGS,\n ...(config.settings || {}),\n };\n\n const fullConfig: Source.Config<Types> = {\n ...config,\n settings,\n };\n\n const push = async (req: Request, res: Response): Promise<void> => {\n try {\n setCorsHeaders(res, settings.cors || false);\n\n if (req.method === 'OPTIONS') {\n res.status(204).send();\n return;\n }\n\n if (req.method !== 'POST') {\n res.status(405).json({\n success: false,\n error: 'Method not allowed. Use POST.',\n });\n return;\n }\n\n if (!req.body) {\n res.status(400).json({\n success: false,\n error: 'Request body is required',\n });\n return;\n }\n\n const body = req.body as RequestBody;\n\n if (isEventRequest(body)) {\n const result = await processEvent(body, envPush);\n\n if (result.error) {\n res.status(400).json({\n success: false,\n error: result.error,\n } as EventResponse);\n } else {\n res.status(200).json({\n success: true,\n id: result.id,\n } as EventResponse);\n }\n } else {\n res.status(400).json({\n success: false,\n error: 'Invalid request format. Expected event object.',\n });\n }\n } catch (error) {\n res.status(500).json({\n success: false,\n error: error instanceof Error ? error.message : 'Internal server error',\n });\n }\n };\n\n return {\n type: 'cloudfunction',\n config: fullConfig,\n push,\n };\n};\n\nexport default sourceCloudFunction;\n"],"mappings":";;;;;;;AAEO,SAAS,eAAe,MAAyC;AACtE,SAAO,WAAW,QAAQ,OAAO,KAAK,UAAU;AAClD;AAEO,SAAS,eACd,KACA,aACM;AACN,MAAI,CAAC,YAAa;AAElB,MAAI,gBAAgB,MAAM;AACxB,QAAI,IAAI,+BAA+B,GAAG;AAC1C,QAAI,IAAI,gCAAgC,eAAe;AACvD,QAAI,IAAI,gCAAgC,6BAA6B;AACrE,QAAI,IAAI,0BAA0B,MAAM;AAAA,EAC1C,OAAO;AACL,QAAI,YAAY,QAAQ;AACtB,YAAM,SAAS,MAAM,QAAQ,YAAY,MAAM,IAC3C,YAAY,OAAO,KAAK,IAAI,IAC5B,YAAY;AAChB,UAAI,IAAI,+BAA+B,MAAM;AAAA,IAC/C;AACA,QAAI,YAAY,SAAS;AACvB,UAAI,IAAI,gCAAgC,YAAY,QAAQ,KAAK,IAAI,CAAC;AAAA,IACxE;AACA,QAAI,YAAY,SAAS;AACvB,UAAI,IAAI,gCAAgC,YAAY,QAAQ,KAAK,IAAI,CAAC;AAAA,IACxE;AACA,QAAI,YAAY,aAAa;AAC3B,UAAI,IAAI,oCAAoC,MAAM;AAAA,IACpD;AACA,QAAI,YAAY,WAAW,QAAW;AACpC,UAAI,IAAI,0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AAI,IAAI,WAAW,QAAQ;AACzB,YAAI,OAAO,GAAG,EAAE,KAAK;AAAA,UACnB,SAAS;AAAA,UACT,OAAO;AAAA,QACT,CAAC;AACD;AAAA,MACF;AAEA,UAAI,CAAC,IAAI,MAAM;AACb,YAAI,OAAO,GAAG,EAAE,KAAK;AAAA,UACnB,SAAS;AAAA,UACT,OAAO;AAAA,QACT,CAAC;AACD;AAAA,MACF;AAEA,YAAM,OAAO,IAAI;AAEjB,UAAI,eAAe,IAAI,GAAG;AACxB,cAAM,SAAS,MAAM,aAAa,MAAM,OAAO;AAE/C,YAAI,OAAO,OAAO;AAChB,cAAI,OAAO,GAAG,EAAE,KAAK;AAAA,YACnB,SAAS;AAAA,YACT,OAAO,OAAO;AAAA,UAChB,CAAkB;AAAA,QACpB,OAAO;AACL,cAAI,OAAO,GAAG,EAAE,KAAK;AAAA,YACnB,SAAS;AAAA,YACT,IAAI,OAAO;AAAA,UACb,CAAkB;AAAA,QACpB;AAAA,MACF,OAAO;AACL,YAAI,OAAO,GAAG,EAAE,KAAK;AAAA,UACnB,SAAS;AAAA,UACT,OAAO;AAAA,QACT,CAAC;AAAA,MACH;AAAA,IACF,SAAS,OAAO;AACd,UAAI,OAAO,GAAG,EAAE,KAAK;AAAA,QACnB,SAAS;AAAA,QACT,OAAO,iBAAiB,QAAQ,MAAM,UAAU;AAAA,MAClD,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAAC;AAAA,EACF;AACF;AAEA,IAAO,wBAAQ;","names":["push","z","z","settings","push"]}
|
|
1
|
+
{"version":3,"sources":["../src/cloudfunction/utils.ts","../src/cloudfunction/push.ts","../src/cloudfunction/types.ts","../src/cloudfunction/schemas/index.ts","../src/cloudfunction/schemas/settings.ts","../src/cloudfunction/schemas/primitives.ts","../src/cloudfunction/examples/index.ts","../src/cloudfunction/examples/env.ts","../src/cloudfunction/index.ts"],"sourcesContent":["import type { RequestBody, EventRequest, CorsOptions, Response } from './types';\n\nexport function isEventRequest(body: RequestBody): body is EventRequest {\n return 'event' in body && typeof body.event === 'string';\n}\n\nexport function setCorsHeaders(\n res: Response,\n corsOptions: boolean | CorsOptions,\n): void {\n if (!corsOptions) return;\n\n if (corsOptions === true) {\n res.set('Access-Control-Allow-Origin', '*');\n res.set('Access-Control-Allow-Methods', 'POST, OPTIONS');\n res.set('Access-Control-Allow-Headers', 'Content-Type, Authorization');\n res.set('Access-Control-Max-Age', '3600');\n } else {\n if (corsOptions.origin) {\n const origin = Array.isArray(corsOptions.origin)\n ? corsOptions.origin.join(', ')\n : corsOptions.origin;\n res.set('Access-Control-Allow-Origin', origin);\n }\n if (corsOptions.methods) {\n res.set('Access-Control-Allow-Methods', corsOptions.methods.join(', '));\n }\n if (corsOptions.headers) {\n res.set('Access-Control-Allow-Headers', corsOptions.headers.join(', '));\n }\n if (corsOptions.credentials) {\n res.set('Access-Control-Allow-Credentials', 'true');\n }\n if (corsOptions.maxAge !== undefined) {\n res.set('Access-Control-Max-Age', corsOptions.maxAge.toString());\n }\n }\n}\n","import type { Collector, WalkerOS } from '@walkeros/core';\nimport type { EventRequest } from './types';\n\nexport async function processEvent(\n eventReq: EventRequest,\n push: Collector.PushFn,\n): Promise<{ id?: string; error?: string }> {\n try {\n const result = await push({\n name: eventReq.event,\n data: (eventReq.data || {}) as WalkerOS.Properties,\n context: eventReq.context as WalkerOS.OrderedProperties | undefined,\n user: eventReq.user as WalkerOS.User | undefined,\n globals: eventReq.globals as WalkerOS.Properties | undefined,\n consent: eventReq.consent as WalkerOS.Consent | undefined,\n });\n\n return { id: result?.event?.id };\n } catch (error) {\n return { error: error instanceof Error ? error.message : 'Unknown error' };\n }\n}\n","import type { WalkerOS, Source as CoreSource } from '@walkeros/core';\nimport type { SettingsSchema, CorsOptionsSchema } from './schemas';\nimport { z } from '@walkeros/core/dev';\n\n// Minimal request/response interfaces\nexport interface Request {\n method: string;\n body?: unknown;\n headers: Record<string, string | string[]>;\n get(name: string): string | undefined;\n}\n\nexport interface Response {\n status(code: number): Response;\n json(body: unknown): Response;\n send(body?: unknown): Response;\n set(key: string, value: string): Response;\n}\n\n// Types inferred from Zod schemas\nexport type Settings = z.infer<typeof SettingsSchema>;\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n\n// InitSettings: user input (all optional)\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {\n // Custom source event mapping properties\n}\n\n// CloudFunction-specific push type\nexport type Push = (req: Request, res: Response) => Promise<void>;\n\nexport interface Env extends CoreSource.Env {\n req?: Request;\n res?: Response;\n}\n\n// Type bundle (must be after Settings, Mapping, Push, Env are defined)\nexport type Types = CoreSource.Types<\n Settings,\n Mapping,\n Push,\n Env,\n InitSettings\n>;\n\nexport interface CloudFunctionSource\n extends Omit<CoreSource.Instance<Types>, 'push'> {\n push: Push;\n}\n\n// Convenience Config type\nexport type Config = CoreSource.Config<Types>;\nexport type PartialConfig = CoreSource.PartialConfig<Types>;\n\n// Cloud function source doesn't follow standard Source.Init pattern due to HTTP handler interface\n\nexport interface EventRequest {\n event: string;\n data?: WalkerOS.AnyObject;\n context?: WalkerOS.AnyObject;\n user?: WalkerOS.AnyObject;\n globals?: WalkerOS.AnyObject;\n consent?: WalkerOS.AnyObject;\n}\n\nexport interface EventResponse {\n success: boolean;\n id?: string;\n error?: string;\n}\n\nexport type RequestBody = EventRequest;\nexport type ResponseBody = EventResponse;\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export primitives\nexport * from './primitives';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable and documentation tools)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema } from './primitives';\n\n/**\n * GCP CloudFunction source settings schema\n */\nexport const SettingsSchema = z.object({\n cors: z\n .union([z.boolean(), CorsOptionsSchema])\n .describe(\n 'CORS configuration: false = disabled, true = allow all origins, object = custom configuration',\n )\n .optional(),\n\n timeout: z\n .number()\n .int()\n .positive()\n .max(540000) // GCP Cloud Functions max timeout: 9 minutes\n .describe('Request timeout in milliseconds (max: 540000 for GCP)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * HTTP methods enum\n */\nexport const HttpMethod = z.enum([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n 'HEAD',\n]);\n\n/**\n * CORS origin configuration\n * Accepts:\n * - '*' for all origins\n * - Single URL string\n * - Array of URL strings\n */\nexport const CorsOrigin = z.union([\n z.string(),\n z.array(z.string()),\n z.literal('*'),\n]);\n\n/**\n * CORS options schema\n * Configuration for Cross-Origin Resource Sharing\n */\nexport const CorsOptionsSchema = z.object({\n origin: CorsOrigin.describe(\n 'Allowed origins (* for all, URL string, or array of URLs)',\n ).optional(),\n\n methods: z.array(HttpMethod).describe('Allowed HTTP methods').optional(),\n\n headers: z.array(z.string()).describe('Allowed request headers').optional(),\n\n credentials: z\n .boolean()\n .describe('Allow credentials (cookies, authorization headers)')\n .optional(),\n\n maxAge: z\n .number()\n .int()\n .positive()\n .describe('Preflight cache duration in seconds')\n .optional(),\n});\n\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n","export * as env from './env';\n","import type { Env } from '../types';\nimport type { Elb } from '@walkeros/core';\n\n/**\n * Example environment configurations for GCP Cloud Function source\n *\n * These environments provide standardized mock structures for testing\n * HTTP request handling without requiring actual cloud function deployment.\n */\n\n// Create a properly typed elb/push/command function that returns a promise with PushResult\nconst createMockElbFn = (): Elb.Fn => {\n const fn = (() =>\n Promise.resolve({\n ok: true,\n successful: [],\n queued: [],\n failed: [],\n })) as Elb.Fn;\n return fn;\n};\n\n/**\n * Standard mock environment for testing cloud function source\n *\n * Use this for testing HTTP event ingestion and request/response handling\n * without requiring a real GCP Cloud Function environment.\n */\nexport const push: Env = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n};\n","import type {\n Env,\n CloudFunctionSource,\n Settings,\n EventResponse,\n RequestBody,\n Request,\n Response,\n Mapping,\n Types,\n} from './types';\nimport type { Source } from '@walkeros/core';\nimport { isEventRequest, setCorsHeaders } from './utils';\nimport { processEvent } from './push';\n\nexport * as SourceCloudFunction from './types';\nexport * as schemas from './schemas';\n\n// Export examples\nexport * as examples from './examples';\n\nconst DEFAULT_SETTINGS: Settings = {\n cors: true,\n timeout: 30000,\n};\n\nexport const sourceCloudFunction = async (\n config: Partial<Source.Config<Types>> = {},\n env: Env,\n): Promise<CloudFunctionSource> => {\n const { push: envPush } = env;\n\n const settings: Settings = {\n ...DEFAULT_SETTINGS,\n ...(config.settings || {}),\n };\n\n const fullConfig: Source.Config<Types> = {\n ...config,\n settings,\n };\n\n const push = async (req: Request, res: Response): Promise<void> => {\n try {\n setCorsHeaders(res, settings.cors || false);\n\n if (req.method === 'OPTIONS') {\n res.status(204).send();\n return;\n }\n\n if (req.method !== 'POST') {\n res.status(405).json({\n success: false,\n error: 'Method not allowed. Use POST.',\n });\n return;\n }\n\n if (!req.body) {\n res.status(400).json({\n success: false,\n error: 'Request body is required',\n });\n return;\n }\n\n const body = req.body as RequestBody;\n\n if (isEventRequest(body)) {\n const result = await processEvent(body, envPush);\n\n if (result.error) {\n res.status(400).json({\n success: false,\n error: result.error,\n } as EventResponse);\n } else {\n res.status(200).json({\n success: true,\n id: result.id,\n } as EventResponse);\n }\n } else {\n res.status(400).json({\n success: false,\n error: 'Invalid request format. Expected event object.',\n });\n }\n } catch (error) {\n res.status(500).json({\n success: false,\n error: error instanceof Error ? error.message : 'Internal server error',\n });\n }\n };\n\n return {\n type: 'cloudfunction',\n config: fullConfig,\n push,\n };\n};\n\nexport default sourceCloudFunction;\n"],"mappings":";;;;;;;AAEO,SAAS,eAAe,MAAyC;AACtE,SAAO,WAAW,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,GAAG,EAAE,KAAK;AAAA,YACnB,SAAS;AAAA,YACT,IAAI,OAAO;AAAA,UACb,CAAkB;AAAA,QACpB;AAAA,MACF,OAAO;AACL,YAAI,OAAO,GAAG,EAAE,KAAK;AAAA,UACnB,SAAS;AAAA,UACT,OAAO;AAAA,QACT,CAAC;AAAA,MACH;AAAA,IACF,SAAS,OAAO;AACd,UAAI,OAAO,GAAG,EAAE,KAAK;AAAA,QACnB,SAAS;AAAA,QACT,OAAO,iBAAiB,QAAQ,MAAM,UAAU;AAAA,MAClD,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAAC;AAAA,EACF;AACF;AAEA,IAAO,wBAAQ;","names":["push","z","z","settings","push"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/server-source-gcp",
|
|
3
3
|
"description": "Google Cloud Platform server sources for walkerOS (Cloud Functions)",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"update": "npx npm-check-updates -u && npm update"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@walkeros/core": "0.4.
|
|
21
|
+
"@walkeros/core": "0.4.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@google-cloud/functions-framework": "^3.0.0"
|