@walkeros/server-source-gcp 4.7.0-next-1790722899482 → 4.7.0

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/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dev.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/examples/step.ts","../src/cloudfunction/examples/trigger.ts","../src/pubsub/pull/schemas/index.ts","../src/pubsub/pull/schemas/settings.ts","../src/pubsub/pull/schemas/setup.ts","../src/pubsub/pull/examples/index.ts","../src/pubsub/pull/examples/env.ts","../src/pubsub/pull/examples/step.ts","../src/pubsub/pull/examples/trigger.ts","../src/pubsub/push/schemas/index.ts","../src/pubsub/push/schemas/settings.ts","../src/pubsub/push/examples/index.ts","../src/pubsub/push/examples/env.ts","../src/pubsub/push/examples/step.ts","../src/pubsub/push/examples/trigger.ts"],"sourcesContent":["export * as schemas from './cloudfunction/schemas';\nexport * as examples from './cloudfunction/examples';\nexport * as pubsubPullSchemas from './pubsub/pull/schemas';\nexport * as pubsubPullExamples from './pubsub/pull/examples';\nexport * as pubsubPushSchemas from './pubsub/push/schemas';\nexport * as pubsubPushExamples from './pubsub/push/examples';\n\nimport * as cloudFunctionExamplesNs from './cloudfunction/examples';\nimport * as pubsubPullExamplesNs from './pubsub/pull/examples';\nimport * as pubsubPushExamplesNs from './pubsub/push/examples';\n\n/** Dev examples per export, keyed by the export names in package.json. */\nexport const exportExamples = {\n sourceCloudFunction: cloudFunctionExamplesNs,\n sourcePubSubPull: pubsubPullExamplesNs,\n sourcePubSubPush: pubsubPushExamplesNs,\n};\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 maxBatchSize: z\n .number()\n .int()\n .min(1)\n .describe('Maximum number of events accepted in a single batch request')\n .default(100),\n\n enablePixelTracking: z\n .boolean()\n .describe('Serve a tracking pixel for GET requests')\n .default(true),\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';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\n","import type { Env } from '../types';\nimport type { Elb, Logger } 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 })) as Elb.Fn;\n return fn;\n};\n\n// Simple no-op logger for demo purposes\nconst noopFn = () => {};\nconst noopLogger: Logger.Instance = {\n error: noopFn,\n warn: noopFn,\n info: noopFn,\n debug: noopFn,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noopFn,\n scope: () => noopLogger,\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 logger: noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const postEvent: Flow.StepExample = {\n title: 'POST event',\n description:\n 'A GCP Cloud Function HTTP POST with a JSON body becomes a single walker elb event.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n body: {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n headers: { 'content-type': 'application/json' },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n ],\n ],\n};\n\nexport const orderEvent: Flow.StepExample = {\n title: 'Order POST',\n description:\n 'A Cloud Function HTTP POST carrying an order payload becomes a walker order complete event.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n body: {\n name: 'order complete',\n data: { id: 'ORD-700', total: 99.99, currency: 'EUR' },\n },\n headers: { 'content-type': 'application/json' },\n },\n out: [\n [\n 'elb',\n {\n name: 'order complete',\n data: { id: 'ORD-700', total: 99.99, currency: 'EUR' },\n },\n ],\n ],\n};\n\nexport const cloudFunctionPostForwardsSource: Flow.StepExample = {\n title: 'POST with provenance',\n description:\n 'A POST body carrying a source map is forwarded in full, so release and trace provenance survive the crossing.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n body: {\n name: 'page view',\n data: { title: 'Home' },\n source: { release: { web: 'r1' } },\n },\n headers: { 'content-type': 'application/json' },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Home' },\n source: { release: { web: 'r1' } },\n },\n ],\n ],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport type { CloudFunctionSource, Request, Response } from '../types';\nimport { startFlow } from '@walkeros/collector';\n\nexport interface Content {\n method: string;\n body: Record<string, unknown>;\n headers?: Record<string, string>;\n}\n\nexport interface Result {\n status: number;\n body: unknown;\n}\n\n/**\n * Find the cloudfunction source instance from collector.sources.\n */\nfunction findGcpSource(\n collector: Collector.Instance,\n): CloudFunctionSource | undefined {\n for (const source of Object.values(collector.sources || {})) {\n if ((source as { type?: string }).type === 'cloudfunction')\n return source as unknown as CloudFunctionSource;\n }\n return undefined;\n}\n\n/**\n * GCP CloudFunction source createTrigger.\n *\n * Boots a real collector via startFlow, then synthesizes mock req/res\n * (matching the GCP Functions Framework pattern) and calls source.push(req, res).\n * This is the realistic approach for GCP Cloud Functions - the Functions Framework\n * synthesizes these objects in production too.\n */\nconst createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n // Lazy startFlow\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const source = findGcpSource(flow.collector);\n if (!source)\n throw new Error(\n 'CloudFunction source not found in collector — ensure it is configured in sources',\n );\n\n // Adapt body: step examples use `name`, source expects `event`\n const body = { ...content.body };\n if (body.name && !body.event) {\n body.event = body.name;\n delete body.name;\n }\n\n const headers = content.headers || {\n 'content-type': 'application/json',\n };\n\n // Synthesize mock req matching GCP Functions Framework pattern\n const req = {\n method: content.method,\n body,\n headers,\n get: (h: string) => headers[h.toLowerCase()],\n } as Request;\n\n // Synthesize mock res that captures status and response body\n let statusCode = 200;\n let responseBody: unknown;\n const res = {\n status: (code: number) => {\n statusCode = code;\n return res;\n },\n json: (data: unknown) => {\n responseBody = data;\n return res;\n },\n send: (data: unknown) => {\n responseBody = data;\n return res;\n },\n set: () => res,\n } as unknown as Response;\n\n // GCP source awaits env.push() — no detached promises\n await source.push(req, res);\n\n return { status: statusCode, body: responseBody };\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\nexport { createTrigger };\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { SetupSchema } from './setup';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { SetupSchema, type Setup } from './setup';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const setup = zodToSchema(SetupSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub pull source settings schema.\n *\n * Required: projectId, subscription. All other fields optional with sensible\n * defaults applied at runtime by `getConfig`.\n */\nexport const SettingsSchema = z.object({\n client: z\n .any()\n .describe(\n 'Pre-configured Google Cloud Pub/Sub client (like new PubSub({ projectId })). Bypasses credentials resolution when supplied.',\n )\n .optional(),\n projectId: z\n .string()\n .min(1)\n .describe('Google Cloud Project ID (like my-gcp-project).'),\n subscription: z\n .string()\n .min(1)\n .describe(\n 'Pub/Sub subscription short name (like events-sub). The full resource name projects/<projectId>/subscriptions/<subscription> is built by the SDK.',\n ),\n topic: z\n .string()\n .describe(\n 'Pub/Sub topic short name. Required when setup.createTopic is true; otherwise informational.',\n )\n .optional(),\n credentials: z\n .any()\n .describe(\n 'Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)',\n )\n .optional(),\n apiEndpoint: z\n .string()\n .describe(\n 'Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).',\n )\n .optional(),\n decoder: z\n .enum(['json', 'text', 'raw'])\n .describe(\n 'Decoder for the message data field. json (default) parses JSON, text decodes UTF-8, raw forwards the Buffer.',\n )\n .optional(),\n flowControl: z\n .object({\n maxMessages: z\n .number()\n .describe('Maximum in-flight messages. Default: 100.')\n .optional(),\n maxBytes: z\n .number()\n .describe('Maximum in-flight bytes. Default: 10485760 (10 MB).')\n .optional(),\n })\n .describe('Subscriber flow control. Tightens the SDK defaults.')\n .optional(),\n ackDeadline: z\n .number()\n .describe('Subscriber ack deadline in seconds. Default: 60.')\n .optional(),\n shutdownTimeoutMs: z\n .number()\n .describe(\n 'Graceful shutdown timeout in milliseconds. Default: 30000. After this window, destroy() force-closes the subscriber.',\n )\n .optional(),\n onPushError: z\n .enum(['nack', 'ack'])\n .describe(\n 'Behavior when forwarding to the collector throws. nack (default) redelivers the message; ack drops it.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub pull source setup schema.\n *\n * Provisioning options for `walkeros setup source.<id>`. Idempotent\n * subscription creation, plus optional topic and dead-letter topic\n * auto-create. Triggered only by the explicit CLI command.\n */\nexport const SetupSchema = z.object({\n createTopic: z\n .boolean()\n .describe(\n 'Create the topic if it does not exist. Requires settings.topic. Default: false (require pre-existing topic).',\n )\n .optional(),\n ackDeadlineSeconds: z\n .number()\n .describe('Subscription ack deadline in seconds. Default: 60.')\n .optional(),\n messageRetentionDuration: z\n .object({\n seconds: z\n .number()\n .describe('Retention window in seconds. Default: project default.'),\n })\n .describe('Subscription-level retention configuration.')\n .optional(),\n filter: z\n .string()\n .describe(\n 'Subscription filter expression. Only messages matching this filter are delivered.',\n )\n .optional(),\n deadLetterPolicy: z\n .object({\n deadLetterTopic: z.string().describe('Dead-letter topic short name.'),\n maxDeliveryAttempts: z\n .number()\n .describe(\n 'Maximum delivery attempts before forwarding to the dead-letter topic.',\n ),\n createDeadLetterTopic: z\n .boolean()\n .describe(\n 'Auto-create the dead-letter topic if it does not exist. Default: false.',\n )\n .optional(),\n })\n .describe('Dead-letter policy. Strongly recommended for production.')\n .optional(),\n retryPolicy: z\n .object({\n minimumBackoff: z.object({\n seconds: z.number().describe('Minimum backoff in seconds.'),\n }),\n maximumBackoff: z.object({\n seconds: z.number().describe('Maximum backoff in seconds.'),\n }),\n })\n .describe('Subscription retry policy.')\n .optional(),\n enableMessageOrdering: z\n .boolean()\n .describe('Enable message ordering on the subscription. Default: false.')\n .optional(),\n labels: z\n .record(z.string(), z.string())\n .describe('Subscription labels for organization and billing.')\n .optional(),\n expirationPolicy: z\n .object({\n ttl: z\n .object({\n seconds: z\n .number()\n .describe('TTL in seconds. null means never expire.'),\n })\n .nullable()\n .optional(),\n })\n .describe('Subscription expiration policy.')\n .optional(),\n});\n\nexport type Setup = z.infer<typeof SetupSchema>;\n","export * as env from './env';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\nexport type { Content, Result } from './trigger';\n","import type { Message, SubscriptionOptions } from '@google-cloud/pubsub';\nimport type { Env, PubSubPullClient, PullSubscription } from '../types';\nimport type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment for the Pub/Sub pull source.\n *\n * `push` injects a structural Pub/Sub client (`env.PubSub`), so a simulated\n * run never reaches Google Cloud and its subscription call can be recorded.\n * The unit tests keep substituting the SDK module-wide via\n * `jest.mock('@google-cloud/pubsub')`; they use `push` without the client.\n */\n\nconst noopFn = (): void => undefined;\nconst noopLogger: Logger.Instance = {\n error: noopFn,\n warn: noopFn,\n info: noopFn,\n debug: noopFn,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noopFn,\n scope: () => noopLogger,\n};\n\nconst createMockElbFn = (): Elb.Fn => {\n const fn: Elb.Fn = () => Promise.resolve({ ok: true });\n return fn;\n};\n\n/** A subscription that never receives: messages arrive by synthetic push. */\nclass MockSubscription implements PullSubscription {\n constructor(\n public name: string,\n public options?: SubscriptionOptions,\n ) {}\n\n on(\n _event: 'message' | 'error',\n _listener: ((message: Message) => void) | ((error: Error) => void),\n ): this {\n return this;\n }\n\n async close(): Promise<void> {}\n}\n\nclass MockPubSub implements PubSubPullClient {\n constructor(public options?: object) {}\n\n subscription(name: string, options?: SubscriptionOptions): MockSubscription {\n return new MockSubscription(name, options);\n }\n\n async close(): Promise<void> {}\n}\n\nfunction createEnv(): Env {\n return {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n logger: noopLogger,\n };\n}\n\n/** Standard mock environment, with the structural client for simulate. */\nexport const push: Env = Object.assign(createEnv(), { PubSub: MockPubSub });\n\n/**\n * The same environment without the client, for unit tests that substitute the\n * SDK module-wide with `jest.mock`.\n */\nexport const moduleMockEnv: Env = createEnv();\n\n/**\n * The subscription call binds the source to its subscription; messages then\n * arrive as events, not calls. Construction is not recorded: its options\n * carry credentials.\n */\nexport const simulation = ['call:PubSub.subscription'];\n","import type { Flow } from '@walkeros/core';\n\n/**\n * Pub/Sub pull step examples.\n *\n * Each example's `in` is a partial MessageLike (id, data Buffer, attributes,\n * publishTime). The trigger synthesizes the missing fields and invokes the\n * registered message handler. `out` is the array of recorded mock calls\n * produced by the handler. Recording shape is `[method, ...args]`.\n *\n * The `__triggerMessage` helper records each message's terminal state under\n * `message.ack` or `message.nack` so step examples can assert on that.\n */\n\nconst eventPayload = {\n name: 'page view',\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n};\n\nconst orderPayload = {\n name: 'order complete',\n data: { id: 'ORD-500', total: 199.99, currency: 'EUR' },\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A JSON-encoded page view event arrives on the subscription, decodes successfully, and is acked.',\n in: {\n id: 'msg-1',\n dataString: JSON.stringify(eventPayload),\n attributes: {},\n },\n out: [['message.ack', 'msg-1']],\n};\n\nexport const orderComplete: Flow.StepExample = {\n title: 'Order complete',\n description:\n 'A JSON-encoded order event arrives and is acked after successful collector forwarding.',\n in: {\n id: 'msg-2',\n dataString: JSON.stringify(orderPayload),\n attributes: { entity: 'order', action: 'complete' },\n },\n out: [['message.ack', 'msg-2']],\n};\n\nexport const decoderText: Flow.StepExample = {\n title: 'Text decoder',\n description:\n 'With decoder=text on the source settings, the message data is forwarded to the collector as a UTF-8 string and acked.',\n in: {\n id: 'msg-3',\n dataString: 'plain text payload',\n attributes: {},\n },\n out: [['message.ack', 'msg-3']],\n};\n\nexport const malformedJson: Flow.StepExample = {\n title: 'Malformed JSON nack',\n description:\n 'A non-JSON body with the default json decoder fails to decode; the message is nacked for redelivery.',\n in: {\n id: 'msg-4',\n dataString: 'not-json{',\n attributes: {},\n },\n out: [['message.nack', 'msg-4']],\n};\n\nexport const malformedJsonAck: Flow.StepExample = {\n title: 'Malformed JSON ack-and-drop',\n description:\n 'With onPushError=ack on the source settings, a malformed JSON message is acked-and-dropped instead of redelivered.',\n in: {\n id: 'msg-5',\n dataString: 'not-json{',\n attributes: {},\n },\n out: [['message.ack', 'msg-5']],\n};\n","import type { Collector, Trigger } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\nimport type { SyntheticMessage, SyntheticPushResult } from '../types';\n\n/**\n * Content shape for the pull-source trigger.\n *\n * The trigger synthesizes a message from this partial input and dispatches\n * it through the source's `push()` (the same pipeline the SDK subscriber\n * callback uses). `dataString` is the user-friendly way to provide the\n * message body; the trigger encodes it to a Buffer.\n */\nexport interface Content {\n id: string;\n dataString: string;\n attributes?: Record<string, string>;\n orderingKey?: string;\n}\n\n/**\n * Result shape for the pull-source trigger.\n *\n * Returns the recorded ack/nack as `[method, id]` entries, mirroring the\n * destination's `[method, ...args]` recording shape used elsewhere.\n */\nexport type Result = Array<[string, ...unknown[]]>;\n\ninterface PubSubPullSourceLike {\n type: string;\n push: (content?: SyntheticMessage) => Promise<SyntheticPushResult | void>;\n}\n\nfunction isPubSubPullSource(value: unknown): value is PubSubPullSourceLike {\n if (typeof value !== 'object' || value === null) return false;\n const candidate: { type?: unknown; push?: unknown } = value;\n return (\n candidate.type === 'pubsub-pull' && typeof candidate.push === 'function'\n );\n}\n\nfunction findSource(\n collector: Collector.Instance,\n): PubSubPullSourceLike | undefined {\n for (const source of Object.values(collector.sources ?? {})) {\n if (isPubSubPullSource(source)) return source;\n }\n return undefined;\n}\n\n/**\n * Pub/Sub pull source createTrigger.\n *\n * Boots the collector via startFlow, finds the registered pubsub-pull source,\n * and invokes its `push()` with a synthesized message. The source dispatches\n * the synthetic message through the same handler the SDK subscriber callback\n * uses, exercising the full decode / forward / ack-nack pipeline without\n * touching real Pub/Sub.\n *\n * Matches the convention used by other source triggers (express, lambda,\n * cloudfunction): find the source by type from the collector and call its\n * public `push()` interface.\n */\nexport const createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const source = findSource(flow.collector);\n if (!source)\n throw new Error(\n 'pubsub-pull source not registered in collector — ensure it is configured in sources',\n );\n\n const synthetic: SyntheticMessage = {\n id: content.id,\n data: Buffer.from(content.dataString, 'utf8'),\n attributes: content.attributes,\n orderingKey: content.orderingKey,\n };\n\n const result = await source.push(synthetic);\n const recorded: Result = [];\n if (result && typeof result === 'object') {\n if (result.acked) recorded.push(['message.ack', content.id]);\n if (result.nacked) recorded.push(['message.nack', content.id]);\n }\n return recorded;\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\n\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub push source settings schema.\n *\n * No required fields. The push source is a request-handler; configuration\n * tunables live here, but operators wire `source.push` into their own\n * express/lambda runtime.\n */\nexport const SettingsSchema = z.object({\n projectId: z\n .string()\n .describe(\n 'Google Cloud Project ID (informational, surfaced in error messages).',\n )\n .optional(),\n decoder: z\n .enum(['json', 'text', 'raw'])\n .describe(\n 'Decoder for the message data field. json (default) parses JSON, text decodes UTF-8, raw forwards the Buffer.',\n )\n .optional(),\n verifyOidc: z\n .boolean()\n .describe(\n 'Verify the OIDC bearer token Pub/Sub attaches to push requests. Default: false.',\n )\n .optional(),\n audience: z\n .string()\n .describe(\n 'OIDC audience (your endpoint URL or a custom audience). Required when verifyOidc is true.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as env from './env';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\nexport type { Content, Result } from './trigger';\n","import type { Env } from '../types';\nimport type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment for the Pub/Sub push source.\n *\n * Provides a no-op env compatible with `Source.Env` plus an optional\n * verifyOidcToken stub for tests that exercise OIDC verification.\n */\n\nconst noopFn = () => {};\nconst noopLogger: Logger.Instance = {\n error: noopFn,\n warn: noopFn,\n info: noopFn,\n debug: noopFn,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noopFn,\n scope: () => noopLogger,\n};\n\nconst createMockElbFn = (): Elb.Fn => {\n const fn = (() => Promise.resolve({ ok: true })) as Elb.Fn;\n return fn;\n};\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 logger: noopLogger,\n};\n\nexport const simulation: string[] = [];\n","import type { Flow } from '@walkeros/core';\n\n/**\n * Pub/Sub push step examples.\n *\n * Each example's `in` is a partial Pub/Sub push envelope (with `message.data`\n * pre-encoded as base64). The trigger constructs an HTTP-like Request from\n * `in` and invokes the source handler. `out` is the recorded HTTP response\n * shape (statusCode + JSON body).\n */\n\nconst eventPayload = {\n name: 'page view',\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n};\n\nconst orderPayload = {\n name: 'order complete',\n data: { id: 'ORD-500', total: 199.99, currency: 'EUR' },\n};\n\nfunction encodeData(value: unknown): string {\n return Buffer.from(JSON.stringify(value), 'utf8').toString('base64');\n}\n\nexport const validEnvelope: Flow.StepExample = {\n title: 'Valid push envelope',\n description:\n 'A well-formed Pub/Sub push envelope decodes the base64 data, parses JSON, and forwards the event to the collector with a 200 response.',\n in: {\n message: {\n messageId: 'push-1',\n data: encodeData(eventPayload),\n attributes: { source: 'analytics' },\n },\n subscription: 'projects/test/subscriptions/events-sub',\n },\n out: [['response', 200, { success: true, id: 'push-1' }]],\n};\n\nexport const orderEnvelope: Flow.StepExample = {\n title: 'Order envelope',\n description:\n 'A push envelope carrying an order event is decoded and forwarded to the collector.',\n in: {\n message: {\n messageId: 'push-2',\n data: encodeData(orderPayload),\n attributes: {},\n },\n subscription: 'projects/test/subscriptions/events-sub',\n },\n out: [['response', 200, { success: true, id: 'push-2' }]],\n};\n\nexport const malformedEnvelope: Flow.StepExample = {\n title: 'Malformed envelope',\n description:\n 'A POST body lacking message.messageId returns 400 Bad Request without forwarding to the collector.',\n in: {\n not_a: 'pubsub envelope',\n },\n out: [\n [\n 'response',\n 400,\n {\n success: false,\n error: 'Malformed Pub/Sub envelope (missing message.messageId).',\n },\n ],\n ],\n};\n","import type { Collector, Trigger } from '@walkeros/core';\nimport type { Request, Response } from '../types';\nimport { startFlow } from '@walkeros/collector';\n\n/** Content for the push trigger: a Pub/Sub envelope or any POST body. */\nexport type Content = Record<string, unknown>;\n\n/** Result: the recorded HTTP response (`status` + `json` body). */\nexport type Result = Array<[string, ...unknown[]]>;\n\ninterface RecordedResponse {\n statusCode?: number;\n body?: unknown;\n}\n\nfunction buildResponse(state: RecordedResponse): Response {\n const res: Response = {\n status(code: number) {\n state.statusCode = code;\n return res;\n },\n json(body: unknown) {\n state.body = body;\n return res;\n },\n send(body?: unknown) {\n state.body = body;\n return res;\n },\n set() {\n return res;\n },\n };\n return res;\n}\n\nfunction buildRequest(\n content: Content,\n headers: Record<string, string>,\n): Request {\n return {\n method: 'POST',\n body: content,\n headers,\n get(name: string) {\n const value = headers[name.toLowerCase()] ?? headers[name];\n return value;\n },\n };\n}\n\ninterface TriggerOptions {\n headers?: Record<string, string>;\n}\n\ninterface PushCapableSource {\n type: string;\n push: (req: Request, res: Response) => Promise<void>;\n}\n\nfunction isPushCapableSource(value: unknown): value is PushCapableSource {\n if (typeof value !== 'object' || value === null) return false;\n const candidate: { type?: unknown; push?: unknown } = value;\n return (\n typeof candidate.type === 'string' &&\n candidate.type === 'pubsub-push' &&\n typeof candidate.push === 'function'\n );\n}\n\nfunction findPushSource(\n collector: Collector.Instance,\n): PushCapableSource | undefined {\n for (const source of Object.values(collector.sources ?? {})) {\n if (isPushCapableSource(source)) return source;\n }\n return undefined;\n}\n\n/**\n * Pub/Sub push source createTrigger.\n *\n * Boots the collector via startFlow, builds a fake Request/Response pair\n * from the trigger Content, and invokes the source's HTTP handler. Returns\n * the recorded response as a Result entry.\n */\nexport const createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n (_type, options) =>\n async (content: Content): Promise<Result> => {\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const triggerOptions: TriggerOptions =\n typeof options === 'object' && options !== null\n ? (options as TriggerOptions)\n : {};\n const headers = triggerOptions.headers ?? {};\n\n const source = findPushSource(flow.collector);\n if (!source) throw new Error('pubsub-push source not registered');\n\n const state: RecordedResponse = {};\n const req = buildRequest(content, headers);\n const res = buildResponse(state);\n\n await source.push(req, res);\n\n const recorded: Result = [\n ['response', state.statusCode ?? 0, state.body ?? null],\n ];\n return recorded;\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n"],"m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M,QAA0B,CAAC;AACjC,UAAM,MAAM,aAAa,SAAS,OAAO;AACzC,UAAM,MAAM,cAAc,KAAK;AAE/B,UAAM,OAAO,KAAK,KAAK,GAAG;AAE1B,UAAM,WAAmB;AAAA,MACvB,CAAC,YAAY,MAAM,cAAc,GAAG,MAAM,QAAQ,IAAI;AAAA,IACxD;AACA,WAAO;AAAA,EACT;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;;;ApBlHO,IAAM,iBAAiB;AAAA,EAC5B,qBAAqB;AAAA,EACrB,kBAAkBC;AAAA,EAClB,kBAAkBA;AACpB;","names":["examples_exports","schemas_exports","import_dev","import_dev","schemas_exports","SettingsSchema","settings","import_dev","import_dev","SettingsSchema","import_dev","settings","SettingsSchema","examples_exports","createTrigger","env_exports","step_exports","env_exports","push","noopFn","noopLogger","createMockElbFn","step_exports","import_collector","createTrigger","result","schemas_exports","SettingsSchema","settings","import_dev","import_dev","SettingsSchema","settings","SettingsSchema","examples_exports","createTrigger","env_exports","step_exports","env_exports","push","simulation","noopFn","noopLogger","createMockElbFn","step_exports","eventPayload","orderPayload","import_collector","createTrigger","examples_exports"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/cloudfunction/examples/index.ts","../src/cloudfunction/examples/env.ts","../src/cloudfunction/examples/step.ts","../src/cloudfunction/examples/trigger.ts","../src/pubsub/pull/examples/index.ts","../src/pubsub/pull/examples/env.ts","../src/pubsub/pull/examples/step.ts","../src/pubsub/pull/examples/trigger.ts","../src/pubsub/push/examples/index.ts","../src/pubsub/push/examples/env.ts","../src/pubsub/push/examples/step.ts","../src/pubsub/push/examples/trigger.ts","../src/cloudfunction/schemas/index.ts","../src/cloudfunction/schemas/settings.ts","../src/cloudfunction/schemas/primitives.ts","../src/pubsub/pull/schemas/index.ts","../src/pubsub/pull/schemas/settings.ts","../src/pubsub/pull/schemas/setup.ts","../src/pubsub/push/schemas/index.ts","../src/pubsub/push/schemas/settings.ts"],"sourcesContent":["import * as cloudFunctionExamplesNs from './cloudfunction/examples';\nimport * as pubsubPullExamplesNs from './pubsub/pull/examples';\nimport * as pubsubPushExamplesNs from './pubsub/push/examples';\nimport * as cloudFunctionSchemasNs from './cloudfunction/schemas';\nimport * as pubsubPullSchemasNs from './pubsub/pull/schemas';\nimport * as pubsubPushSchemasNs from './pubsub/push/schemas';\n\nexport * as schemas from './cloudfunction/schemas';\nexport * as examples from './cloudfunction/examples';\nexport * as pubsubPullSchemas from './pubsub/pull/schemas';\nexport * as pubsubPullExamples from './pubsub/pull/examples';\nexport * as pubsubPushSchemas from './pubsub/push/schemas';\nexport * as pubsubPushExamples from './pubsub/push/examples';\n\n/** Dev examples per export, keyed by the export names in package.json. */\nexport const exportExamples = {\n sourceCloudFunction: cloudFunctionExamplesNs,\n sourcePubSubPull: pubsubPullExamplesNs,\n sourcePubSubPush: pubsubPushExamplesNs,\n};\n\n/** Schemas per export, keyed by the export names in package.json. */\nexport const exportSchemas = {\n sourceCloudFunction: { settings: cloudFunctionSchemasNs.settings },\n sourcePubSubPull: {\n settings: pubsubPullSchemasNs.settings,\n setup: pubsubPullSchemasNs.setup,\n },\n sourcePubSubPush: { settings: pubsubPushSchemasNs.settings },\n};\n","export * as env from './env';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\n","import type { Env } from '../types';\nimport type { Elb, Logger } 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 })) as Elb.Fn;\n return fn;\n};\n\n// Simple no-op logger for demo purposes\nconst noopFn = () => {};\nconst noopLogger: Logger.Instance = {\n error: noopFn,\n warn: noopFn,\n info: noopFn,\n debug: noopFn,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noopFn,\n scope: () => noopLogger,\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 logger: noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const postEvent: Flow.StepExample = {\n title: 'POST event',\n description:\n 'A GCP Cloud Function HTTP POST with a JSON body becomes a single walker elb event.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n body: {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n headers: { 'content-type': 'application/json' },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n ],\n ],\n};\n\nexport const orderEvent: Flow.StepExample = {\n title: 'Order POST',\n description:\n 'A Cloud Function HTTP POST carrying an order payload becomes a walker order complete event.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n body: {\n name: 'order complete',\n data: { id: 'ORD-700', total: 99.99, currency: 'EUR' },\n },\n headers: { 'content-type': 'application/json' },\n },\n out: [\n [\n 'elb',\n {\n name: 'order complete',\n data: { id: 'ORD-700', total: 99.99, currency: 'EUR' },\n },\n ],\n ],\n};\n\nexport const cloudFunctionPostForwardsSource: Flow.StepExample = {\n title: 'POST with provenance',\n description:\n 'A POST body carrying a source map is forwarded in full, so release and trace provenance survive the crossing.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n body: {\n name: 'page view',\n data: { title: 'Home' },\n source: { release: { web: 'r1' } },\n },\n headers: { 'content-type': 'application/json' },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Home' },\n source: { release: { web: 'r1' } },\n },\n ],\n ],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport type { CloudFunctionSource, Request, Response } from '../types';\nimport { startFlow } from '@walkeros/collector';\n\nexport interface Content {\n method: string;\n body: Record<string, unknown>;\n headers?: Record<string, string>;\n}\n\nexport interface Result {\n status: number;\n body: unknown;\n}\n\n/**\n * Find the cloudfunction source instance from collector.sources.\n */\nfunction findGcpSource(\n collector: Collector.Instance,\n): CloudFunctionSource | undefined {\n for (const source of Object.values(collector.sources || {})) {\n if ((source as { type?: string }).type === 'cloudfunction')\n return source as unknown as CloudFunctionSource;\n }\n return undefined;\n}\n\n/**\n * GCP CloudFunction source createTrigger.\n *\n * Boots a real collector via startFlow, then synthesizes mock req/res\n * (matching the GCP Functions Framework pattern) and calls source.push(req, res).\n * This is the realistic approach for GCP Cloud Functions - the Functions Framework\n * synthesizes these objects in production too.\n */\nconst createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n // Lazy startFlow\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const source = findGcpSource(flow.collector);\n if (!source)\n throw new Error(\n 'CloudFunction source not found in collector — ensure it is configured in sources',\n );\n\n // Adapt body: step examples use `name`, source expects `event`\n const body = { ...content.body };\n if (body.name && !body.event) {\n body.event = body.name;\n delete body.name;\n }\n\n const headers = content.headers || {\n 'content-type': 'application/json',\n };\n\n // Synthesize mock req matching GCP Functions Framework pattern\n const req = {\n method: content.method,\n body,\n headers,\n get: (h: string) => headers[h.toLowerCase()],\n } as Request;\n\n // Synthesize mock res that captures status and response body\n let statusCode = 200;\n let responseBody: unknown;\n const res = {\n status: (code: number) => {\n statusCode = code;\n return res;\n },\n json: (data: unknown) => {\n responseBody = data;\n return res;\n },\n send: (data: unknown) => {\n responseBody = data;\n return res;\n },\n set: () => res,\n } as unknown as Response;\n\n // GCP source awaits env.push() — no detached promises\n await source.push(req, res);\n\n return { status: statusCode, body: responseBody };\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\nexport { createTrigger };\n","export * as env from './env';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\nexport type { Content, Result } from './trigger';\n","import type { Message, SubscriptionOptions } from '@google-cloud/pubsub';\nimport type { Env, PubSubPullClient, PullSubscription } from '../types';\nimport type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment for the Pub/Sub pull source.\n *\n * `push` injects a structural Pub/Sub client (`env.PubSub`), so a simulated\n * run never reaches Google Cloud and its subscription call can be recorded.\n * The unit tests keep substituting the SDK module-wide via\n * `jest.mock('@google-cloud/pubsub')`; they use `push` without the client.\n */\n\nconst noopFn = (): void => undefined;\nconst noopLogger: Logger.Instance = {\n error: noopFn,\n warn: noopFn,\n info: noopFn,\n debug: noopFn,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noopFn,\n scope: () => noopLogger,\n};\n\nconst createMockElbFn = (): Elb.Fn => {\n const fn: Elb.Fn = () => Promise.resolve({ ok: true });\n return fn;\n};\n\n/** A subscription that never receives: messages arrive by synthetic push. */\nclass MockSubscription implements PullSubscription {\n constructor(\n public name: string,\n public options?: SubscriptionOptions,\n ) {}\n\n on(\n _event: 'message' | 'error',\n _listener: ((message: Message) => void) | ((error: Error) => void),\n ): this {\n return this;\n }\n\n async close(): Promise<void> {}\n}\n\nclass MockPubSub implements PubSubPullClient {\n constructor(public options?: object) {}\n\n subscription(name: string, options?: SubscriptionOptions): MockSubscription {\n return new MockSubscription(name, options);\n }\n\n async close(): Promise<void> {}\n}\n\nfunction createEnv(): Env {\n return {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n logger: noopLogger,\n };\n}\n\n/** Standard mock environment, with the structural client for simulate. */\nexport const push: Env = Object.assign(createEnv(), { PubSub: MockPubSub });\n\n/**\n * The same environment without the client, for unit tests that substitute the\n * SDK module-wide with `jest.mock`.\n */\nexport const moduleMockEnv: Env = createEnv();\n\n/**\n * The subscription call binds the source to its subscription; messages then\n * arrive as events, not calls. Construction is not recorded: its options\n * carry credentials.\n */\nexport const simulation = ['call:PubSub.subscription'];\n","import type { Flow } from '@walkeros/core';\n\n/**\n * Pub/Sub pull step examples.\n *\n * Each example's `in` is a partial MessageLike (id, data Buffer, attributes,\n * publishTime). The trigger synthesizes the missing fields and invokes the\n * registered message handler. `out` is the array of recorded mock calls\n * produced by the handler. Recording shape is `[method, ...args]`.\n *\n * The `__triggerMessage` helper records each message's terminal state under\n * `message.ack` or `message.nack` so step examples can assert on that.\n */\n\nconst eventPayload = {\n name: 'page view',\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n};\n\nconst orderPayload = {\n name: 'order complete',\n data: { id: 'ORD-500', total: 199.99, currency: 'EUR' },\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A JSON-encoded page view event arrives on the subscription, decodes successfully, and is acked.',\n in: {\n id: 'msg-1',\n dataString: JSON.stringify(eventPayload),\n attributes: {},\n },\n out: [['message.ack', 'msg-1']],\n};\n\nexport const orderComplete: Flow.StepExample = {\n title: 'Order complete',\n description:\n 'A JSON-encoded order event arrives and is acked after successful collector forwarding.',\n in: {\n id: 'msg-2',\n dataString: JSON.stringify(orderPayload),\n attributes: { entity: 'order', action: 'complete' },\n },\n out: [['message.ack', 'msg-2']],\n};\n\nexport const decoderText: Flow.StepExample = {\n title: 'Text decoder',\n description:\n 'With decoder=text on the source settings, the message data is forwarded to the collector as a UTF-8 string and acked.',\n in: {\n id: 'msg-3',\n dataString: 'plain text payload',\n attributes: {},\n },\n out: [['message.ack', 'msg-3']],\n};\n\nexport const malformedJson: Flow.StepExample = {\n title: 'Malformed JSON nack',\n description:\n 'A non-JSON body with the default json decoder fails to decode; the message is nacked for redelivery.',\n in: {\n id: 'msg-4',\n dataString: 'not-json{',\n attributes: {},\n },\n out: [['message.nack', 'msg-4']],\n};\n\nexport const malformedJsonAck: Flow.StepExample = {\n title: 'Malformed JSON ack-and-drop',\n description:\n 'With onPushError=ack on the source settings, a malformed JSON message is acked-and-dropped instead of redelivered.',\n in: {\n id: 'msg-5',\n dataString: 'not-json{',\n attributes: {},\n },\n out: [['message.ack', 'msg-5']],\n};\n","import type { Collector, Trigger } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\nimport type { SyntheticMessage, SyntheticPushResult } from '../types';\n\n/**\n * Content shape for the pull-source trigger.\n *\n * The trigger synthesizes a message from this partial input and dispatches\n * it through the source's `push()` (the same pipeline the SDK subscriber\n * callback uses). `dataString` is the user-friendly way to provide the\n * message body; the trigger encodes it to a Buffer.\n */\nexport interface Content {\n id: string;\n dataString: string;\n attributes?: Record<string, string>;\n orderingKey?: string;\n}\n\n/**\n * Result shape for the pull-source trigger.\n *\n * Returns the recorded ack/nack as `[method, id]` entries, mirroring the\n * destination's `[method, ...args]` recording shape used elsewhere.\n */\nexport type Result = Array<[string, ...unknown[]]>;\n\ninterface PubSubPullSourceLike {\n type: string;\n push: (content?: SyntheticMessage) => Promise<SyntheticPushResult | void>;\n}\n\nfunction isPubSubPullSource(value: unknown): value is PubSubPullSourceLike {\n if (typeof value !== 'object' || value === null) return false;\n const candidate: { type?: unknown; push?: unknown } = value;\n return (\n candidate.type === 'pubsub-pull' && typeof candidate.push === 'function'\n );\n}\n\nfunction findSource(\n collector: Collector.Instance,\n): PubSubPullSourceLike | undefined {\n for (const source of Object.values(collector.sources ?? {})) {\n if (isPubSubPullSource(source)) return source;\n }\n return undefined;\n}\n\n/**\n * Pub/Sub pull source createTrigger.\n *\n * Boots the collector via startFlow, finds the registered pubsub-pull source,\n * and invokes its `push()` with a synthesized message. The source dispatches\n * the synthetic message through the same handler the SDK subscriber callback\n * uses, exercising the full decode / forward / ack-nack pipeline without\n * touching real Pub/Sub.\n *\n * Matches the convention used by other source triggers (express, lambda,\n * cloudfunction): find the source by type from the collector and call its\n * public `push()` interface.\n */\nexport const createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const source = findSource(flow.collector);\n if (!source)\n throw new Error(\n 'pubsub-pull source not registered in collector — ensure it is configured in sources',\n );\n\n const synthetic: SyntheticMessage = {\n id: content.id,\n data: Buffer.from(content.dataString, 'utf8'),\n attributes: content.attributes,\n orderingKey: content.orderingKey,\n };\n\n const result = await source.push(synthetic);\n const recorded: Result = [];\n if (result && typeof result === 'object') {\n if (result.acked) recorded.push(['message.ack', content.id]);\n if (result.nacked) recorded.push(['message.nack', content.id]);\n }\n return recorded;\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n","export * as env from './env';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\nexport type { Content, Result } from './trigger';\n","import type { Env } from '../types';\nimport type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment for the Pub/Sub push source.\n *\n * Provides a no-op env compatible with `Source.Env` plus an optional\n * verifyOidcToken stub for tests that exercise OIDC verification.\n */\n\nconst noopFn = () => {};\nconst noopLogger: Logger.Instance = {\n error: noopFn,\n warn: noopFn,\n info: noopFn,\n debug: noopFn,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noopFn,\n scope: () => noopLogger,\n};\n\nconst createMockElbFn = (): Elb.Fn => {\n const fn = (() => Promise.resolve({ ok: true })) as Elb.Fn;\n return fn;\n};\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 logger: noopLogger,\n};\n\nexport const simulation: string[] = [];\n","import type { Flow } from '@walkeros/core';\n\n/**\n * Pub/Sub push step examples.\n *\n * Each example's `in` is a partial Pub/Sub push envelope (with `message.data`\n * pre-encoded as base64). The trigger constructs an HTTP-like Request from\n * `in` and invokes the source handler. `out` is the recorded HTTP response\n * shape (statusCode + JSON body).\n */\n\nconst eventPayload = {\n name: 'page view',\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n};\n\nconst orderPayload = {\n name: 'order complete',\n data: { id: 'ORD-500', total: 199.99, currency: 'EUR' },\n};\n\nfunction encodeData(value: unknown): string {\n return Buffer.from(JSON.stringify(value), 'utf8').toString('base64');\n}\n\nexport const validEnvelope: Flow.StepExample = {\n title: 'Valid push envelope',\n description:\n 'A well-formed Pub/Sub push envelope decodes the base64 data, parses JSON, and forwards the event to the collector with a 200 response.',\n in: {\n message: {\n messageId: 'push-1',\n data: encodeData(eventPayload),\n attributes: { source: 'analytics' },\n },\n subscription: 'projects/test/subscriptions/events-sub',\n },\n out: [['response', 200, { success: true, id: 'push-1' }]],\n};\n\nexport const orderEnvelope: Flow.StepExample = {\n title: 'Order envelope',\n description:\n 'A push envelope carrying an order event is decoded and forwarded to the collector.',\n in: {\n message: {\n messageId: 'push-2',\n data: encodeData(orderPayload),\n attributes: {},\n },\n subscription: 'projects/test/subscriptions/events-sub',\n },\n out: [['response', 200, { success: true, id: 'push-2' }]],\n};\n\nexport const malformedEnvelope: Flow.StepExample = {\n title: 'Malformed envelope',\n description:\n 'A POST body lacking message.messageId returns 400 Bad Request without forwarding to the collector.',\n in: {\n not_a: 'pubsub envelope',\n },\n out: [\n [\n 'response',\n 400,\n {\n success: false,\n error: 'Malformed Pub/Sub envelope (missing message.messageId).',\n },\n ],\n ],\n};\n","import type { Collector, Trigger } from '@walkeros/core';\nimport type { Request, Response } from '../types';\nimport { startFlow } from '@walkeros/collector';\n\n/** Content for the push trigger: a Pub/Sub envelope or any POST body. */\nexport type Content = Record<string, unknown>;\n\n/** Result: the recorded HTTP response (`status` + `json` body). */\nexport type Result = Array<[string, ...unknown[]]>;\n\ninterface RecordedResponse {\n statusCode?: number;\n body?: unknown;\n}\n\nfunction buildResponse(state: RecordedResponse): Response {\n const res: Response = {\n status(code: number) {\n state.statusCode = code;\n return res;\n },\n json(body: unknown) {\n state.body = body;\n return res;\n },\n send(body?: unknown) {\n state.body = body;\n return res;\n },\n set() {\n return res;\n },\n };\n return res;\n}\n\nfunction buildRequest(\n content: Content,\n headers: Record<string, string>,\n): Request {\n return {\n method: 'POST',\n body: content,\n headers,\n get(name: string) {\n const value = headers[name.toLowerCase()] ?? headers[name];\n return value;\n },\n };\n}\n\ninterface TriggerOptions {\n headers?: Record<string, string>;\n}\n\ninterface PushCapableSource {\n type: string;\n push: (req: Request, res: Response) => Promise<void>;\n}\n\nfunction isPushCapableSource(value: unknown): value is PushCapableSource {\n if (typeof value !== 'object' || value === null) return false;\n const candidate: { type?: unknown; push?: unknown } = value;\n return (\n typeof candidate.type === 'string' &&\n candidate.type === 'pubsub-push' &&\n typeof candidate.push === 'function'\n );\n}\n\nfunction findPushSource(\n collector: Collector.Instance,\n): PushCapableSource | undefined {\n for (const source of Object.values(collector.sources ?? {})) {\n if (isPushCapableSource(source)) return source;\n }\n return undefined;\n}\n\n/**\n * Pub/Sub push source createTrigger.\n *\n * Boots the collector via startFlow, builds a fake Request/Response pair\n * from the trigger Content, and invokes the source's HTTP handler. Returns\n * the recorded response as a Result entry.\n */\nexport const createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n (_type, options) =>\n async (content: Content): Promise<Result> => {\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const triggerOptions: TriggerOptions =\n typeof options === 'object' && options !== null\n ? (options as TriggerOptions)\n : {};\n const headers = triggerOptions.headers ?? {};\n\n const source = findPushSource(flow.collector);\n if (!source) throw new Error('pubsub-push source not registered');\n\n const state: RecordedResponse = {};\n const req = buildRequest(content, headers);\n const res = buildResponse(state);\n\n await source.push(req, res);\n\n const recorded: Result = [\n ['response', state.statusCode ?? 0, state.body ?? null],\n ];\n return recorded;\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\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 maxBatchSize: z\n .number()\n .int()\n .min(1)\n .describe('Maximum number of events accepted in a single batch request')\n .default(100),\n\n enablePixelTracking: z\n .boolean()\n .describe('Serve a tracking pixel for GET requests')\n .default(true),\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","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { SetupSchema } from './setup';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { SetupSchema, type Setup } from './setup';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const setup = zodToSchema(SetupSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub pull source settings schema.\n *\n * Required: projectId, subscription. All other fields optional with sensible\n * defaults applied at runtime by `getConfig`.\n */\nexport const SettingsSchema = z.object({\n client: z\n .any()\n .describe(\n 'Pre-configured Google Cloud Pub/Sub client (like new PubSub({ projectId })). Bypasses credentials resolution when supplied.',\n )\n .optional(),\n projectId: z\n .string()\n .min(1)\n .describe('Google Cloud Project ID (like my-gcp-project).'),\n subscription: z\n .string()\n .min(1)\n .describe(\n 'Pub/Sub subscription short name (like events-sub). The full resource name projects/<projectId>/subscriptions/<subscription> is built by the SDK.',\n ),\n topic: z\n .string()\n .describe(\n 'Pub/Sub topic short name. Required when setup.createTopic is true; otherwise informational.',\n )\n .optional(),\n credentials: z\n .any()\n .describe(\n 'Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)',\n )\n .optional(),\n apiEndpoint: z\n .string()\n .describe(\n 'Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).',\n )\n .optional(),\n decoder: z\n .enum(['json', 'text', 'raw'])\n .describe(\n 'Decoder for the message data field. json (default) parses JSON, text decodes UTF-8, raw forwards the Buffer.',\n )\n .optional(),\n flowControl: z\n .object({\n maxMessages: z\n .number()\n .describe('Maximum in-flight messages. Default: 100.')\n .optional(),\n maxBytes: z\n .number()\n .describe('Maximum in-flight bytes. Default: 10485760 (10 MB).')\n .optional(),\n })\n .describe('Subscriber flow control. Tightens the SDK defaults.')\n .optional(),\n ackDeadline: z\n .number()\n .describe('Subscriber ack deadline in seconds. Default: 60.')\n .optional(),\n shutdownTimeoutMs: z\n .number()\n .describe(\n 'Graceful shutdown timeout in milliseconds. Default: 30000. After this window, destroy() force-closes the subscriber.',\n )\n .optional(),\n onPushError: z\n .enum(['nack', 'ack'])\n .describe(\n 'Behavior when forwarding to the collector throws. nack (default) redelivers the message; ack drops it.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub pull source setup schema.\n *\n * Provisioning options for `walkeros setup source.<id>`. Idempotent\n * subscription creation, plus optional topic and dead-letter topic\n * auto-create. Triggered only by the explicit CLI command.\n */\nexport const SetupSchema = z.object({\n createTopic: z\n .boolean()\n .describe(\n 'Create the topic if it does not exist. Requires settings.topic. Default: false (require pre-existing topic).',\n )\n .optional(),\n ackDeadlineSeconds: z\n .number()\n .describe('Subscription ack deadline in seconds. Default: 60.')\n .optional(),\n messageRetentionDuration: z\n .object({\n seconds: z\n .number()\n .describe('Retention window in seconds. Default: project default.'),\n })\n .describe('Subscription-level retention configuration.')\n .optional(),\n filter: z\n .string()\n .describe(\n 'Subscription filter expression. Only messages matching this filter are delivered.',\n )\n .optional(),\n deadLetterPolicy: z\n .object({\n deadLetterTopic: z.string().describe('Dead-letter topic short name.'),\n maxDeliveryAttempts: z\n .number()\n .describe(\n 'Maximum delivery attempts before forwarding to the dead-letter topic.',\n ),\n createDeadLetterTopic: z\n .boolean()\n .describe(\n 'Auto-create the dead-letter topic if it does not exist. Default: false.',\n )\n .optional(),\n })\n .describe('Dead-letter policy. Strongly recommended for production.')\n .optional(),\n retryPolicy: z\n .object({\n minimumBackoff: z.object({\n seconds: z.number().describe('Minimum backoff in seconds.'),\n }),\n maximumBackoff: z.object({\n seconds: z.number().describe('Maximum backoff in seconds.'),\n }),\n })\n .describe('Subscription retry policy.')\n .optional(),\n enableMessageOrdering: z\n .boolean()\n .describe('Enable message ordering on the subscription. Default: false.')\n .optional(),\n labels: z\n .record(z.string(), z.string())\n .describe('Subscription labels for organization and billing.')\n .optional(),\n expirationPolicy: z\n .object({\n ttl: z\n .object({\n seconds: z\n .number()\n .describe('TTL in seconds. null means never expire.'),\n })\n .nullable()\n .optional(),\n })\n .describe('Subscription expiration policy.')\n .optional(),\n});\n\nexport type Setup = z.infer<typeof SetupSchema>;\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\n\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub push source settings schema.\n *\n * No required fields. The push source is a request-handler; configuration\n * tunables live here, but operators wire `source.push` into their own\n * express/lambda runtime.\n */\nexport const SettingsSchema = z.object({\n projectId: z\n .string()\n .describe(\n 'Google Cloud Project ID (informational, surfaced in error messages).',\n )\n .optional(),\n decoder: z\n .enum(['json', 'text', 'raw'])\n .describe(\n 'Decoder for the message data field. json (default) parses JSON, text decodes UTF-8, raw forwards the Buffer.',\n )\n .optional(),\n verifyOidc: z\n .boolean()\n .describe(\n 'Verify the OIDC bearer token Pub/Sub attaches to push requests. Default: false.',\n )\n .optional(),\n audience: z\n .string()\n .describe(\n 'OIDC audience (your endpoint URL or a custom audience). Required when verifyOidc is true.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA,EAAA,yBAAAC;AAAA,EAAA,0BAAAD;AAAA,EAAA,yBAAAC;AAAA,EAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAWA,IAAM,kBAAkB,MAAc;AACpC,QAAM,MAAM,MACV,QAAQ,QAAQ;AAAA,IACd,IAAI;AAAA,EACN,CAAC;AACH,SA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AnBU3C,IAAM,iBAAiB;AAAA,EAC5B,qBAAqB;AAAA,EACrB,kBAAkBC;AAAA,EAClB,kBAAkBA;AACpB;AAGO,IAAM,gBAAgB;AAAA,EAC3B,qBAAqB,EAAE,SAA0C;AAAA,EACjE,kBAAkB;AAAA,IAChB,UAA8BC;AAAA,IAC9B;AAAA,EACF;AAAA,EACA,kBAAkB,EAAE,UAA8BA,UAAS;AAC7D;","names":["examples_exports","schemas_exports","examples_exports","createTrigger","env_exports","step_exports","env_exports","push","noopFn","noopLogger","createMockElbFn","step_exports","import_collector","createTrigger","result","examples_exports","createTrigger","env_exports","step_exports","env_exports","push","simulation","noopFn","noopLogger","createMockElbFn","step_exports","eventPayload","orderPayload","import_collector","createTrigger","import_dev","import_dev","schemas_exports","SettingsSchema","settings","import_dev","import_dev","SettingsSchema","import_dev","settings","SettingsSchema","schemas_exports","SettingsSchema","settings","import_dev","import_dev","SettingsSchema","settings","SettingsSchema","examples_exports","settings"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,o)=>{for(var r in o)e(t,r,{get:o[r],enumerable:!0})},o={};t(o,{CorsOptionsSchema:()=>c,CorsOrigin:()=>a,HttpMethod:()=>n,SettingsSchema:()=>l,settings:()=>d});import{zodToSchema as r}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var n=i.enum(["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"]),a=i.union([i.string(),i.array(i.string()),i.literal("*")]),c=i.object({origin:a.describe("Allowed origins (* for all, URL string, or array of URLs)").optional(),methods:i.array(n).describe("Allowed HTTP methods").optional(),headers:i.array(i.string()).describe("Allowed request headers").optional(),credentials:i.boolean().describe("Allow credentials (cookies, authorization headers)").optional(),maxAge:i.number().int().positive().describe("Preflight cache duration in seconds").optional()}),l=s.object({cors:s.union([s.boolean(),c]).describe("CORS configuration: false = disabled, true = allow all origins, object = custom configuration").optional(),maxBatchSize:s.number().int().min(1).describe("Maximum number of events accepted in a single batch request").default(100),enablePixelTracking:s.boolean().describe("Serve a tracking pixel for GET requests").default(!0),timeout:s.number().int().positive().max(54e4).describe("Request timeout in milliseconds (max: 540000 for GCP)").optional()}),d=r(l),u={};t(u,{createTrigger:()=>P,env:()=>p,step:()=>h});var p={};t(p,{push:()=>g});var b=()=>()=>Promise.resolve({ok:!0}),m=()=>{},f={error:m,warn:m,info:m,debug:m,throw:e=>{throw"string"==typeof e?new Error(e):e},json:m,scope:()=>f},g={get push(){return b()},get command(){return b()},get elb(){return b()},logger:f},h={};t(h,{cloudFunctionPostForwardsSource:()=>y,orderEvent:()=>v,postEvent:()=>w});var w={title:"POST event",description:"A GCP Cloud Function HTTP POST with a JSON body becomes a single walker elb event.",trigger:{type:"POST"},in:{method:"POST",body:{name:"page view",data:{title:"Home",url:"https://example.com/"}},headers:{"content-type":"application/json"}},out:[["elb",{name:"page view",data:{title:"Home",url:"https://example.com/"}}]]},v={title:"Order POST",description:"A Cloud Function HTTP POST carrying an order payload becomes a walker order complete event.",trigger:{type:"POST"},in:{method:"POST",body:{name:"order complete",data:{id:"ORD-700",total:99.99,currency:"EUR"}},headers:{"content-type":"application/json"}},out:[["elb",{name:"order complete",data:{id:"ORD-700",total:99.99,currency:"EUR"}}]]},y={title:"POST with provenance",description:"A POST body carrying a source map is forwarded in full, so release and trace provenance survive the crossing.",trigger:{type:"POST"},in:{method:"POST",body:{name:"page view",data:{title:"Home"},source:{release:{web:"r1"}}},headers:{"content-type":"application/json"}},out:[["elb",{name:"page view",data:{title:"Home"},source:{release:{web:"r1"}}}]]};import{startFlow as S}from"@walkeros/collector";var P=async e=>{let t;return{get flow(){return t},trigger:()=>async o=>{if(!t){const o=await S(e);t={collector:o.collector,elb:o.elb}}const r=function(e){for(const t of Object.values(e.sources||{}))if("cloudfunction"===t.type)return t}(t.collector);if(!r)throw new Error("CloudFunction source not found in collector — ensure it is configured in sources");const s={...o.body};s.name&&!s.event&&(s.event=s.name,delete s.name);const i=o.headers||{"content-type":"application/json"},n={method:o.method,body:s,headers:i,get:e=>i[e.toLowerCase()]};let a,c=200;const l={status:e=>(c=e,l),json:e=>(a=e,l),send:e=>(a=e,l),set:()=>l};return await r.push(n,l),{status:c,body:a}}}},k={};t(k,{SettingsSchema:()=>T,SetupSchema:()=>D,settings:()=>E,setup:()=>C});import{zodToSchema as O}from"@walkeros/core/dev";import{z as j}from"@walkeros/core/dev";var T=j.object({client:j.any().describe("Pre-configured Google Cloud Pub/Sub client (like new PubSub({ projectId })). Bypasses credentials resolution when supplied.").optional(),projectId:j.string().min(1).describe("Google Cloud Project ID (like my-gcp-project)."),subscription:j.string().min(1).describe("Pub/Sub subscription short name (like events-sub). The full resource name projects/<projectId>/subscriptions/<subscription> is built by the SDK."),topic:j.string().describe("Pub/Sub topic short name. Required when setup.createTopic is true; otherwise informational.").optional(),credentials:j.any().describe("Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)").optional(),apiEndpoint:j.string().describe("Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).").optional(),decoder:j.enum(["json","text","raw"]).describe("Decoder for the message data field. json (default) parses JSON, text decodes UTF-8, raw forwards the Buffer.").optional(),flowControl:j.object({maxMessages:j.number().describe("Maximum in-flight messages. Default: 100.").optional(),maxBytes:j.number().describe("Maximum in-flight bytes. Default: 10485760 (10 MB).").optional()}).describe("Subscriber flow control. Tightens the SDK defaults.").optional(),ackDeadline:j.number().describe("Subscriber ack deadline in seconds. Default: 60.").optional(),shutdownTimeoutMs:j.number().describe("Graceful shutdown timeout in milliseconds. Default: 30000. After this window, destroy() force-closes the subscriber.").optional(),onPushError:j.enum(["nack","ack"]).describe("Behavior when forwarding to the collector throws. nack (default) redelivers the message; ack drops it.").optional()});import{z as x}from"@walkeros/core/dev";var D=x.object({createTopic:x.boolean().describe("Create the topic if it does not exist. Requires settings.topic. Default: false (require pre-existing topic).").optional(),ackDeadlineSeconds:x.number().describe("Subscription ack deadline in seconds. Default: 60.").optional(),messageRetentionDuration:x.object({seconds:x.number().describe("Retention window in seconds. Default: project default.")}).describe("Subscription-level retention configuration.").optional(),filter:x.string().describe("Subscription filter expression. Only messages matching this filter are delivered.").optional(),deadLetterPolicy:x.object({deadLetterTopic:x.string().describe("Dead-letter topic short name."),maxDeliveryAttempts:x.number().describe("Maximum delivery attempts before forwarding to the dead-letter topic."),createDeadLetterTopic:x.boolean().describe("Auto-create the dead-letter topic if it does not exist. Default: false.").optional()}).describe("Dead-letter policy. Strongly recommended for production.").optional(),retryPolicy:x.object({minimumBackoff:x.object({seconds:x.number().describe("Minimum backoff in seconds.")}),maximumBackoff:x.object({seconds:x.number().describe("Maximum backoff in seconds.")})}).describe("Subscription retry policy.").optional(),enableMessageOrdering:x.boolean().describe("Enable message ordering on the subscription. Default: false.").optional(),labels:x.record(x.string(),x.string()).describe("Subscription labels for organization and billing.").optional(),expirationPolicy:x.object({ttl:x.object({seconds:x.number().describe("TTL in seconds. null means never expire.")}).nullable().optional()}).describe("Subscription expiration policy.").optional()}),E=O(T),C=O(D),A={};t(A,{createTrigger:()=>Q,env:()=>R,step:()=>H});var R={};t(R,{moduleMockEnv:()=>F,push:()=>U,simulation:()=>q});var J=()=>{},M={error:J,warn:J,info:J,debug:J,throw:e=>{throw"string"==typeof e?new Error(e):e},json:J,scope:()=>M},N=()=>()=>Promise.resolve({ok:!0}),I=class{constructor(e,t){this.name=e,this.options=t}name;options;on(e,t){return this}async close(){}};function B(){return{get push(){return N()},get command(){return N()},get elb(){return N()},logger:M}}var U=Object.assign(B(),{PubSub:class{constructor(e){this.options=e}options;subscription(e,t){return new I(e,t)}async close(){}}}),F=B(),q=["call:PubSub.subscription"],H={};t(H,{decoderText:()=>G,malformedJson:()=>K,malformedJsonAck:()=>V,orderComplete:()=>z,pageView:()=>L});var L={title:"Page view",description:"A JSON-encoded page view event arrives on the subscription, decodes successfully, and is acked.",in:{id:"msg-1",dataString:JSON.stringify({name:"page view",data:{title:"Documentation",url:"https://example.com/docs"}}),attributes:{}},out:[["message.ack","msg-1"]]},z={title:"Order complete",description:"A JSON-encoded order event arrives and is acked after successful collector forwarding.",in:{id:"msg-2",dataString:JSON.stringify({name:"order complete",data:{id:"ORD-500",total:199.99,currency:"EUR"}}),attributes:{entity:"order",action:"complete"}},out:[["message.ack","msg-2"]]},G={title:"Text decoder",description:"With decoder=text on the source settings, the message data is forwarded to the collector as a UTF-8 string and acked.",in:{id:"msg-3",dataString:"plain text payload",attributes:{}},out:[["message.ack","msg-3"]]},K={title:"Malformed JSON nack",description:"A non-JSON body with the default json decoder fails to decode; the message is nacked for redelivery.",in:{id:"msg-4",dataString:"not-json{",attributes:{}},out:[["message.nack","msg-4"]]},V={title:"Malformed JSON ack-and-drop",description:"With onPushError=ack on the source settings, a malformed JSON message is acked-and-dropped instead of redelivered.",in:{id:"msg-5",dataString:"not-json{",attributes:{}},out:[["message.ack","msg-5"]]};import{startFlow as _}from"@walkeros/collector";function W(e){if("object"!=typeof e||null===e)return!1;const t=e;return"pubsub-pull"===t.type&&"function"==typeof t.push}var Q=async e=>{let t;return{get flow(){return t},trigger:()=>async o=>{if(!t){const o=await _(e);t={collector:o.collector,elb:o.elb}}const r=function(e){for(const t of Object.values(e.sources??{}))if(W(t))return t}(t.collector);if(!r)throw new Error("pubsub-pull source not registered in collector — ensure it is configured in sources");const s={id:o.id,data:Buffer.from(o.dataString,"utf8"),attributes:o.attributes,orderingKey:o.orderingKey},i=await r.push(s),n=[];return i&&"object"==typeof i&&(i.acked&&n.push(["message.ack",o.id]),i.nacked&&n.push(["message.nack",o.id])),n}}},X={};t(X,{SettingsSchema:()=>$,settings:()=>ee});import{zodToSchema as Y}from"@walkeros/core/dev";import{z as Z}from"@walkeros/core/dev";var $=Z.object({projectId:Z.string().describe("Google Cloud Project ID (informational, surfaced in error messages).").optional(),decoder:Z.enum(["json","text","raw"]).describe("Decoder for the message data field. json (default) parses JSON, text decodes UTF-8, raw forwards the Buffer.").optional(),verifyOidc:Z.boolean().describe("Verify the OIDC bearer token Pub/Sub attaches to push requests. Default: false.").optional(),audience:Z.string().describe("OIDC audience (your endpoint URL or a custom audience). Required when verifyOidc is true.").optional()}),ee=Y($),te={};t(te,{createTrigger:()=>fe,env:()=>oe,step:()=>ce});var oe={};t(oe,{push:()=>ne,simulation:()=>ae});var re=()=>{},se={error:re,warn:re,info:re,debug:re,throw:e=>{throw"string"==typeof e?new Error(e):e},json:re,scope:()=>se},ie=()=>()=>Promise.resolve({ok:!0}),ne={get push(){return ie()},get command(){return ie()},get elb(){return ie()},logger:se},ae=[],ce={};t(ce,{malformedEnvelope:()=>pe,orderEnvelope:()=>ue,validEnvelope:()=>de});function le(e){return Buffer.from(JSON.stringify(e),"utf8").toString("base64")}var de={title:"Valid push envelope",description:"A well-formed Pub/Sub push envelope decodes the base64 data, parses JSON, and forwards the event to the collector with a 200 response.",in:{message:{messageId:"push-1",data:le({name:"page view",data:{title:"Documentation",url:"https://example.com/docs"}}),attributes:{source:"analytics"}},subscription:"projects/test/subscriptions/events-sub"},out:[["response",200,{success:!0,id:"push-1"}]]},ue={title:"Order envelope",description:"A push envelope carrying an order event is decoded and forwarded to the collector.",in:{message:{messageId:"push-2",data:le({name:"order complete",data:{id:"ORD-500",total:199.99,currency:"EUR"}}),attributes:{}},subscription:"projects/test/subscriptions/events-sub"},out:[["response",200,{success:!0,id:"push-2"}]]},pe={title:"Malformed envelope",description:"A POST body lacking message.messageId returns 400 Bad Request without forwarding to the collector.",in:{not_a:"pubsub envelope"},out:[["response",400,{success:!1,error:"Malformed Pub/Sub envelope (missing message.messageId)."}]]};import{startFlow as be}from"@walkeros/collector";function me(e){if("object"!=typeof e||null===e)return!1;const t=e;return"string"==typeof t.type&&"pubsub-push"===t.type&&"function"==typeof t.push}var fe=async e=>{let t;return{get flow(){return t},trigger:(o,r)=>async o=>{if(!t){const o=await be(e);t={collector:o.collector,elb:o.elb}}const s=("object"==typeof r&&null!==r?r:{}).headers??{},i=function(e){for(const t of Object.values(e.sources??{}))if(me(t))return t}(t.collector);if(!i)throw new Error("pubsub-push source not registered");const n={},a=function(e,t){return{method:"POST",body:e,headers:t,get:e=>t[e.toLowerCase()]??t[e]}}(o,s),c=function(e){const t={status:o=>(e.statusCode=o,t),json:o=>(e.body=o,t),send:o=>(e.body=o,t),set:()=>t};return t}(n);await i.push(a,c);return[["response",n.statusCode??0,n.body??null]]}}},ge={sourceCloudFunction:u,sourcePubSubPull:A,sourcePubSubPush:te};export{u as examples,ge as exportExamples,A as pubsubPullExamples,k as pubsubPullSchemas,te as pubsubPushExamples,X as pubsubPushSchemas,o as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,o)=>{for(var r in o)e(t,r,{get:o[r],enumerable:!0})},o={};t(o,{createTrigger:()=>b,env:()=>r,step:()=>c});var r={};t(r,{push:()=>a});var s=()=>()=>Promise.resolve({ok:!0}),i=()=>{},n={error:i,warn:i,info:i,debug:i,throw:e=>{throw"string"==typeof e?new Error(e):e},json:i,scope:()=>n},a={get push(){return s()},get command(){return s()},get elb(){return s()},logger:n},c={};t(c,{cloudFunctionPostForwardsSource:()=>u,orderEvent:()=>d,postEvent:()=>l});var l={title:"POST event",description:"A GCP Cloud Function HTTP POST with a JSON body becomes a single walker elb event.",trigger:{type:"POST"},in:{method:"POST",body:{name:"page view",data:{title:"Home",url:"https://example.com/"}},headers:{"content-type":"application/json"}},out:[["elb",{name:"page view",data:{title:"Home",url:"https://example.com/"}}]]},d={title:"Order POST",description:"A Cloud Function HTTP POST carrying an order payload becomes a walker order complete event.",trigger:{type:"POST"},in:{method:"POST",body:{name:"order complete",data:{id:"ORD-700",total:99.99,currency:"EUR"}},headers:{"content-type":"application/json"}},out:[["elb",{name:"order complete",data:{id:"ORD-700",total:99.99,currency:"EUR"}}]]},u={title:"POST with provenance",description:"A POST body carrying a source map is forwarded in full, so release and trace provenance survive the crossing.",trigger:{type:"POST"},in:{method:"POST",body:{name:"page view",data:{title:"Home"},source:{release:{web:"r1"}}},headers:{"content-type":"application/json"}},out:[["elb",{name:"page view",data:{title:"Home"},source:{release:{web:"r1"}}}]]};import{startFlow as p}from"@walkeros/collector";var b=async e=>{let t;return{get flow(){return t},trigger:()=>async o=>{if(!t){const o=await p(e);t={collector:o.collector,elb:o.elb}}const r=function(e){for(const t of Object.values(e.sources||{}))if("cloudfunction"===t.type)return t}(t.collector);if(!r)throw new Error("CloudFunction source not found in collector — ensure it is configured in sources");const s={...o.body};s.name&&!s.event&&(s.event=s.name,delete s.name);const i=o.headers||{"content-type":"application/json"},n={method:o.method,body:s,headers:i,get:e=>i[e.toLowerCase()]};let a,c=200;const l={status:e=>(c=e,l),json:e=>(a=e,l),send:e=>(a=e,l),set:()=>l};return await r.push(n,l),{status:c,body:a}}}},m={};t(m,{createTrigger:()=>R,env:()=>g,step:()=>O});var g={};t(g,{moduleMockEnv:()=>P,push:()=>S,simulation:()=>k});var f=()=>{},h={error:f,warn:f,info:f,debug:f,throw:e=>{throw"string"==typeof e?new Error(e):e},json:f,scope:()=>h},w=()=>()=>Promise.resolve({ok:!0}),v=class{constructor(e,t){this.name=e,this.options=t}name;options;on(e,t){return this}async close(){}};function y(){return{get push(){return w()},get command(){return w()},get elb(){return w()},logger:h}}var S=Object.assign(y(),{PubSub:class{constructor(e){this.options=e}options;subscription(e,t){return new v(e,t)}async close(){}}}),P=y(),k=["call:PubSub.subscription"],O={};t(O,{decoderText:()=>x,malformedJson:()=>D,malformedJsonAck:()=>E,orderComplete:()=>T,pageView:()=>j});var j={title:"Page view",description:"A JSON-encoded page view event arrives on the subscription, decodes successfully, and is acked.",in:{id:"msg-1",dataString:JSON.stringify({name:"page view",data:{title:"Documentation",url:"https://example.com/docs"}}),attributes:{}},out:[["message.ack","msg-1"]]},T={title:"Order complete",description:"A JSON-encoded order event arrives and is acked after successful collector forwarding.",in:{id:"msg-2",dataString:JSON.stringify({name:"order complete",data:{id:"ORD-500",total:199.99,currency:"EUR"}}),attributes:{entity:"order",action:"complete"}},out:[["message.ack","msg-2"]]},x={title:"Text decoder",description:"With decoder=text on the source settings, the message data is forwarded to the collector as a UTF-8 string and acked.",in:{id:"msg-3",dataString:"plain text payload",attributes:{}},out:[["message.ack","msg-3"]]},D={title:"Malformed JSON nack",description:"A non-JSON body with the default json decoder fails to decode; the message is nacked for redelivery.",in:{id:"msg-4",dataString:"not-json{",attributes:{}},out:[["message.nack","msg-4"]]},E={title:"Malformed JSON ack-and-drop",description:"With onPushError=ack on the source settings, a malformed JSON message is acked-and-dropped instead of redelivered.",in:{id:"msg-5",dataString:"not-json{",attributes:{}},out:[["message.ack","msg-5"]]};import{startFlow as C}from"@walkeros/collector";function A(e){if("object"!=typeof e||null===e)return!1;const t=e;return"pubsub-pull"===t.type&&"function"==typeof t.push}var R=async e=>{let t;return{get flow(){return t},trigger:()=>async o=>{if(!t){const o=await C(e);t={collector:o.collector,elb:o.elb}}const r=function(e){for(const t of Object.values(e.sources??{}))if(A(t))return t}(t.collector);if(!r)throw new Error("pubsub-pull source not registered in collector — ensure it is configured in sources");const s={id:o.id,data:Buffer.from(o.dataString,"utf8"),attributes:o.attributes,orderingKey:o.orderingKey},i=await r.push(s),n=[];return i&&"object"==typeof i&&(i.acked&&n.push(["message.ack",o.id]),i.nacked&&n.push(["message.nack",o.id])),n}}},J={};t(J,{createTrigger:()=>_,env:()=>M,step:()=>q});var M={};t(M,{push:()=>F,simulation:()=>U});var N=()=>{},I={error:N,warn:N,info:N,debug:N,throw:e=>{throw"string"==typeof e?new Error(e):e},json:N,scope:()=>I},B=()=>()=>Promise.resolve({ok:!0}),F={get push(){return B()},get command(){return B()},get elb(){return B()},logger:I},U=[],q={};t(q,{malformedEnvelope:()=>G,orderEnvelope:()=>z,validEnvelope:()=>L});function H(e){return Buffer.from(JSON.stringify(e),"utf8").toString("base64")}var L={title:"Valid push envelope",description:"A well-formed Pub/Sub push envelope decodes the base64 data, parses JSON, and forwards the event to the collector with a 200 response.",in:{message:{messageId:"push-1",data:H({name:"page view",data:{title:"Documentation",url:"https://example.com/docs"}}),attributes:{source:"analytics"}},subscription:"projects/test/subscriptions/events-sub"},out:[["response",200,{success:!0,id:"push-1"}]]},z={title:"Order envelope",description:"A push envelope carrying an order event is decoded and forwarded to the collector.",in:{message:{messageId:"push-2",data:H({name:"order complete",data:{id:"ORD-500",total:199.99,currency:"EUR"}}),attributes:{}},subscription:"projects/test/subscriptions/events-sub"},out:[["response",200,{success:!0,id:"push-2"}]]},G={title:"Malformed envelope",description:"A POST body lacking message.messageId returns 400 Bad Request without forwarding to the collector.",in:{not_a:"pubsub envelope"},out:[["response",400,{success:!1,error:"Malformed Pub/Sub envelope (missing message.messageId)."}]]};import{startFlow as K}from"@walkeros/collector";function V(e){if("object"!=typeof e||null===e)return!1;const t=e;return"string"==typeof t.type&&"pubsub-push"===t.type&&"function"==typeof t.push}var _=async e=>{let t;return{get flow(){return t},trigger:(o,r)=>async o=>{if(!t){const o=await K(e);t={collector:o.collector,elb:o.elb}}const s=("object"==typeof r&&null!==r?r:{}).headers??{},i=function(e){for(const t of Object.values(e.sources??{}))if(V(t))return t}(t.collector);if(!i)throw new Error("pubsub-push source not registered");const n={},a=function(e,t){return{method:"POST",body:e,headers:t,get:e=>t[e.toLowerCase()]??t[e]}}(o,s),c=function(e){const t={status:o=>(e.statusCode=o,t),json:o=>(e.body=o,t),send:o=>(e.body=o,t),set:()=>t};return t}(n);await i.push(a,c);return[["response",n.statusCode??0,n.body??null]]}}},W={};t(W,{CorsOptionsSchema:()=>ee,CorsOrigin:()=>$,HttpMethod:()=>Z,SettingsSchema:()=>te,settings:()=>oe});import{zodToSchema as Q}from"@walkeros/core/dev";import{z as X}from"@walkeros/core/dev";import{z as Y}from"@walkeros/core/dev";var Z=Y.enum(["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"]),$=Y.union([Y.string(),Y.array(Y.string()),Y.literal("*")]),ee=Y.object({origin:$.describe("Allowed origins (* for all, URL string, or array of URLs)").optional(),methods:Y.array(Z).describe("Allowed HTTP methods").optional(),headers:Y.array(Y.string()).describe("Allowed request headers").optional(),credentials:Y.boolean().describe("Allow credentials (cookies, authorization headers)").optional(),maxAge:Y.number().int().positive().describe("Preflight cache duration in seconds").optional()}),te=X.object({cors:X.union([X.boolean(),ee]).describe("CORS configuration: false = disabled, true = allow all origins, object = custom configuration").optional(),maxBatchSize:X.number().int().min(1).describe("Maximum number of events accepted in a single batch request").default(100),enablePixelTracking:X.boolean().describe("Serve a tracking pixel for GET requests").default(!0),timeout:X.number().int().positive().max(54e4).describe("Request timeout in milliseconds (max: 540000 for GCP)").optional()}),oe=Q(te),re={};t(re,{SettingsSchema:()=>ne,SetupSchema:()=>ce,settings:()=>le,setup:()=>de});import{zodToSchema as se}from"@walkeros/core/dev";import{z as ie}from"@walkeros/core/dev";var ne=ie.object({client:ie.any().describe("Pre-configured Google Cloud Pub/Sub client (like new PubSub({ projectId })). Bypasses credentials resolution when supplied.").optional(),projectId:ie.string().min(1).describe("Google Cloud Project ID (like my-gcp-project)."),subscription:ie.string().min(1).describe("Pub/Sub subscription short name (like events-sub). The full resource name projects/<projectId>/subscriptions/<subscription> is built by the SDK."),topic:ie.string().describe("Pub/Sub topic short name. Required when setup.createTopic is true; otherwise informational.").optional(),credentials:ie.any().describe("Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)").optional(),apiEndpoint:ie.string().describe("Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).").optional(),decoder:ie.enum(["json","text","raw"]).describe("Decoder for the message data field. json (default) parses JSON, text decodes UTF-8, raw forwards the Buffer.").optional(),flowControl:ie.object({maxMessages:ie.number().describe("Maximum in-flight messages. Default: 100.").optional(),maxBytes:ie.number().describe("Maximum in-flight bytes. Default: 10485760 (10 MB).").optional()}).describe("Subscriber flow control. Tightens the SDK defaults.").optional(),ackDeadline:ie.number().describe("Subscriber ack deadline in seconds. Default: 60.").optional(),shutdownTimeoutMs:ie.number().describe("Graceful shutdown timeout in milliseconds. Default: 30000. After this window, destroy() force-closes the subscriber.").optional(),onPushError:ie.enum(["nack","ack"]).describe("Behavior when forwarding to the collector throws. nack (default) redelivers the message; ack drops it.").optional()});import{z as ae}from"@walkeros/core/dev";var ce=ae.object({createTopic:ae.boolean().describe("Create the topic if it does not exist. Requires settings.topic. Default: false (require pre-existing topic).").optional(),ackDeadlineSeconds:ae.number().describe("Subscription ack deadline in seconds. Default: 60.").optional(),messageRetentionDuration:ae.object({seconds:ae.number().describe("Retention window in seconds. Default: project default.")}).describe("Subscription-level retention configuration.").optional(),filter:ae.string().describe("Subscription filter expression. Only messages matching this filter are delivered.").optional(),deadLetterPolicy:ae.object({deadLetterTopic:ae.string().describe("Dead-letter topic short name."),maxDeliveryAttempts:ae.number().describe("Maximum delivery attempts before forwarding to the dead-letter topic."),createDeadLetterTopic:ae.boolean().describe("Auto-create the dead-letter topic if it does not exist. Default: false.").optional()}).describe("Dead-letter policy. Strongly recommended for production.").optional(),retryPolicy:ae.object({minimumBackoff:ae.object({seconds:ae.number().describe("Minimum backoff in seconds.")}),maximumBackoff:ae.object({seconds:ae.number().describe("Maximum backoff in seconds.")})}).describe("Subscription retry policy.").optional(),enableMessageOrdering:ae.boolean().describe("Enable message ordering on the subscription. Default: false.").optional(),labels:ae.record(ae.string(),ae.string()).describe("Subscription labels for organization and billing.").optional(),expirationPolicy:ae.object({ttl:ae.object({seconds:ae.number().describe("TTL in seconds. null means never expire.")}).nullable().optional()}).describe("Subscription expiration policy.").optional()}),le=se(ne),de=se(ce),ue={};t(ue,{SettingsSchema:()=>me,settings:()=>ge});import{zodToSchema as pe}from"@walkeros/core/dev";import{z as be}from"@walkeros/core/dev";var me=be.object({projectId:be.string().describe("Google Cloud Project ID (informational, surfaced in error messages).").optional(),decoder:be.enum(["json","text","raw"]).describe("Decoder for the message data field. json (default) parses JSON, text decodes UTF-8, raw forwards the Buffer.").optional(),verifyOidc:be.boolean().describe("Verify the OIDC bearer token Pub/Sub attaches to push requests. Default: false.").optional(),audience:be.string().describe("OIDC audience (your endpoint URL or a custom audience). Required when verifyOidc is true.").optional()}),ge=pe(me),fe={sourceCloudFunction:o,sourcePubSubPull:m,sourcePubSubPush:J},he={sourceCloudFunction:{settings:oe},sourcePubSubPull:{settings:le,setup:de},sourcePubSubPush:{settings:ge}};export{o as examples,fe as exportExamples,he as exportSchemas,m as pubsubPullExamples,re as pubsubPullSchemas,J as pubsubPushExamples,ue as pubsubPushSchemas,W as schemas};//# sourceMappingURL=dev.mjs.map
package/dist/dev.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../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/examples/step.ts","../src/cloudfunction/examples/trigger.ts","../src/pubsub/pull/schemas/index.ts","../src/pubsub/pull/schemas/settings.ts","../src/pubsub/pull/schemas/setup.ts","../src/pubsub/pull/examples/index.ts","../src/pubsub/pull/examples/env.ts","../src/pubsub/pull/examples/step.ts","../src/pubsub/pull/examples/trigger.ts","../src/pubsub/push/schemas/index.ts","../src/pubsub/push/schemas/settings.ts","../src/pubsub/push/examples/index.ts","../src/pubsub/push/examples/env.ts","../src/pubsub/push/examples/step.ts","../src/pubsub/push/examples/trigger.ts","../src/dev.ts"],"sourcesContent":["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 maxBatchSize: z\n .number()\n .int()\n .min(1)\n .describe('Maximum number of events accepted in a single batch request')\n .default(100),\n\n enablePixelTracking: z\n .boolean()\n .describe('Serve a tracking pixel for GET requests')\n .default(true),\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';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\n","import type { Env } from '../types';\nimport type { Elb, Logger } 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 })) as Elb.Fn;\n return fn;\n};\n\n// Simple no-op logger for demo purposes\nconst noopFn = () => {};\nconst noopLogger: Logger.Instance = {\n error: noopFn,\n warn: noopFn,\n info: noopFn,\n debug: noopFn,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noopFn,\n scope: () => noopLogger,\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 logger: noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const postEvent: Flow.StepExample = {\n title: 'POST event',\n description:\n 'A GCP Cloud Function HTTP POST with a JSON body becomes a single walker elb event.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n body: {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n headers: { 'content-type': 'application/json' },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n ],\n ],\n};\n\nexport const orderEvent: Flow.StepExample = {\n title: 'Order POST',\n description:\n 'A Cloud Function HTTP POST carrying an order payload becomes a walker order complete event.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n body: {\n name: 'order complete',\n data: { id: 'ORD-700', total: 99.99, currency: 'EUR' },\n },\n headers: { 'content-type': 'application/json' },\n },\n out: [\n [\n 'elb',\n {\n name: 'order complete',\n data: { id: 'ORD-700', total: 99.99, currency: 'EUR' },\n },\n ],\n ],\n};\n\nexport const cloudFunctionPostForwardsSource: Flow.StepExample = {\n title: 'POST with provenance',\n description:\n 'A POST body carrying a source map is forwarded in full, so release and trace provenance survive the crossing.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n body: {\n name: 'page view',\n data: { title: 'Home' },\n source: { release: { web: 'r1' } },\n },\n headers: { 'content-type': 'application/json' },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Home' },\n source: { release: { web: 'r1' } },\n },\n ],\n ],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport type { CloudFunctionSource, Request, Response } from '../types';\nimport { startFlow } from '@walkeros/collector';\n\nexport interface Content {\n method: string;\n body: Record<string, unknown>;\n headers?: Record<string, string>;\n}\n\nexport interface Result {\n status: number;\n body: unknown;\n}\n\n/**\n * Find the cloudfunction source instance from collector.sources.\n */\nfunction findGcpSource(\n collector: Collector.Instance,\n): CloudFunctionSource | undefined {\n for (const source of Object.values(collector.sources || {})) {\n if ((source as { type?: string }).type === 'cloudfunction')\n return source as unknown as CloudFunctionSource;\n }\n return undefined;\n}\n\n/**\n * GCP CloudFunction source createTrigger.\n *\n * Boots a real collector via startFlow, then synthesizes mock req/res\n * (matching the GCP Functions Framework pattern) and calls source.push(req, res).\n * This is the realistic approach for GCP Cloud Functions - the Functions Framework\n * synthesizes these objects in production too.\n */\nconst createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n // Lazy startFlow\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const source = findGcpSource(flow.collector);\n if (!source)\n throw new Error(\n 'CloudFunction source not found in collector — ensure it is configured in sources',\n );\n\n // Adapt body: step examples use `name`, source expects `event`\n const body = { ...content.body };\n if (body.name && !body.event) {\n body.event = body.name;\n delete body.name;\n }\n\n const headers = content.headers || {\n 'content-type': 'application/json',\n };\n\n // Synthesize mock req matching GCP Functions Framework pattern\n const req = {\n method: content.method,\n body,\n headers,\n get: (h: string) => headers[h.toLowerCase()],\n } as Request;\n\n // Synthesize mock res that captures status and response body\n let statusCode = 200;\n let responseBody: unknown;\n const res = {\n status: (code: number) => {\n statusCode = code;\n return res;\n },\n json: (data: unknown) => {\n responseBody = data;\n return res;\n },\n send: (data: unknown) => {\n responseBody = data;\n return res;\n },\n set: () => res,\n } as unknown as Response;\n\n // GCP source awaits env.push() — no detached promises\n await source.push(req, res);\n\n return { status: statusCode, body: responseBody };\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\nexport { createTrigger };\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { SetupSchema } from './setup';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { SetupSchema, type Setup } from './setup';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const setup = zodToSchema(SetupSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub pull source settings schema.\n *\n * Required: projectId, subscription. All other fields optional with sensible\n * defaults applied at runtime by `getConfig`.\n */\nexport const SettingsSchema = z.object({\n client: z\n .any()\n .describe(\n 'Pre-configured Google Cloud Pub/Sub client (like new PubSub({ projectId })). Bypasses credentials resolution when supplied.',\n )\n .optional(),\n projectId: z\n .string()\n .min(1)\n .describe('Google Cloud Project ID (like my-gcp-project).'),\n subscription: z\n .string()\n .min(1)\n .describe(\n 'Pub/Sub subscription short name (like events-sub). The full resource name projects/<projectId>/subscriptions/<subscription> is built by the SDK.',\n ),\n topic: z\n .string()\n .describe(\n 'Pub/Sub topic short name. Required when setup.createTopic is true; otherwise informational.',\n )\n .optional(),\n credentials: z\n .any()\n .describe(\n 'Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)',\n )\n .optional(),\n apiEndpoint: z\n .string()\n .describe(\n 'Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).',\n )\n .optional(),\n decoder: z\n .enum(['json', 'text', 'raw'])\n .describe(\n 'Decoder for the message data field. json (default) parses JSON, text decodes UTF-8, raw forwards the Buffer.',\n )\n .optional(),\n flowControl: z\n .object({\n maxMessages: z\n .number()\n .describe('Maximum in-flight messages. Default: 100.')\n .optional(),\n maxBytes: z\n .number()\n .describe('Maximum in-flight bytes. Default: 10485760 (10 MB).')\n .optional(),\n })\n .describe('Subscriber flow control. Tightens the SDK defaults.')\n .optional(),\n ackDeadline: z\n .number()\n .describe('Subscriber ack deadline in seconds. Default: 60.')\n .optional(),\n shutdownTimeoutMs: z\n .number()\n .describe(\n 'Graceful shutdown timeout in milliseconds. Default: 30000. After this window, destroy() force-closes the subscriber.',\n )\n .optional(),\n onPushError: z\n .enum(['nack', 'ack'])\n .describe(\n 'Behavior when forwarding to the collector throws. nack (default) redelivers the message; ack drops it.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub pull source setup schema.\n *\n * Provisioning options for `walkeros setup source.<id>`. Idempotent\n * subscription creation, plus optional topic and dead-letter topic\n * auto-create. Triggered only by the explicit CLI command.\n */\nexport const SetupSchema = z.object({\n createTopic: z\n .boolean()\n .describe(\n 'Create the topic if it does not exist. Requires settings.topic. Default: false (require pre-existing topic).',\n )\n .optional(),\n ackDeadlineSeconds: z\n .number()\n .describe('Subscription ack deadline in seconds. Default: 60.')\n .optional(),\n messageRetentionDuration: z\n .object({\n seconds: z\n .number()\n .describe('Retention window in seconds. Default: project default.'),\n })\n .describe('Subscription-level retention configuration.')\n .optional(),\n filter: z\n .string()\n .describe(\n 'Subscription filter expression. Only messages matching this filter are delivered.',\n )\n .optional(),\n deadLetterPolicy: z\n .object({\n deadLetterTopic: z.string().describe('Dead-letter topic short name.'),\n maxDeliveryAttempts: z\n .number()\n .describe(\n 'Maximum delivery attempts before forwarding to the dead-letter topic.',\n ),\n createDeadLetterTopic: z\n .boolean()\n .describe(\n 'Auto-create the dead-letter topic if it does not exist. Default: false.',\n )\n .optional(),\n })\n .describe('Dead-letter policy. Strongly recommended for production.')\n .optional(),\n retryPolicy: z\n .object({\n minimumBackoff: z.object({\n seconds: z.number().describe('Minimum backoff in seconds.'),\n }),\n maximumBackoff: z.object({\n seconds: z.number().describe('Maximum backoff in seconds.'),\n }),\n })\n .describe('Subscription retry policy.')\n .optional(),\n enableMessageOrdering: z\n .boolean()\n .describe('Enable message ordering on the subscription. Default: false.')\n .optional(),\n labels: z\n .record(z.string(), z.string())\n .describe('Subscription labels for organization and billing.')\n .optional(),\n expirationPolicy: z\n .object({\n ttl: z\n .object({\n seconds: z\n .number()\n .describe('TTL in seconds. null means never expire.'),\n })\n .nullable()\n .optional(),\n })\n .describe('Subscription expiration policy.')\n .optional(),\n});\n\nexport type Setup = z.infer<typeof SetupSchema>;\n","export * as env from './env';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\nexport type { Content, Result } from './trigger';\n","import type { Message, SubscriptionOptions } from '@google-cloud/pubsub';\nimport type { Env, PubSubPullClient, PullSubscription } from '../types';\nimport type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment for the Pub/Sub pull source.\n *\n * `push` injects a structural Pub/Sub client (`env.PubSub`), so a simulated\n * run never reaches Google Cloud and its subscription call can be recorded.\n * The unit tests keep substituting the SDK module-wide via\n * `jest.mock('@google-cloud/pubsub')`; they use `push` without the client.\n */\n\nconst noopFn = (): void => undefined;\nconst noopLogger: Logger.Instance = {\n error: noopFn,\n warn: noopFn,\n info: noopFn,\n debug: noopFn,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noopFn,\n scope: () => noopLogger,\n};\n\nconst createMockElbFn = (): Elb.Fn => {\n const fn: Elb.Fn = () => Promise.resolve({ ok: true });\n return fn;\n};\n\n/** A subscription that never receives: messages arrive by synthetic push. */\nclass MockSubscription implements PullSubscription {\n constructor(\n public name: string,\n public options?: SubscriptionOptions,\n ) {}\n\n on(\n _event: 'message' | 'error',\n _listener: ((message: Message) => void) | ((error: Error) => void),\n ): this {\n return this;\n }\n\n async close(): Promise<void> {}\n}\n\nclass MockPubSub implements PubSubPullClient {\n constructor(public options?: object) {}\n\n subscription(name: string, options?: SubscriptionOptions): MockSubscription {\n return new MockSubscription(name, options);\n }\n\n async close(): Promise<void> {}\n}\n\nfunction createEnv(): Env {\n return {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n logger: noopLogger,\n };\n}\n\n/** Standard mock environment, with the structural client for simulate. */\nexport const push: Env = Object.assign(createEnv(), { PubSub: MockPubSub });\n\n/**\n * The same environment without the client, for unit tests that substitute the\n * SDK module-wide with `jest.mock`.\n */\nexport const moduleMockEnv: Env = createEnv();\n\n/**\n * The subscription call binds the source to its subscription; messages then\n * arrive as events, not calls. Construction is not recorded: its options\n * carry credentials.\n */\nexport const simulation = ['call:PubSub.subscription'];\n","import type { Flow } from '@walkeros/core';\n\n/**\n * Pub/Sub pull step examples.\n *\n * Each example's `in` is a partial MessageLike (id, data Buffer, attributes,\n * publishTime). The trigger synthesizes the missing fields and invokes the\n * registered message handler. `out` is the array of recorded mock calls\n * produced by the handler. Recording shape is `[method, ...args]`.\n *\n * The `__triggerMessage` helper records each message's terminal state under\n * `message.ack` or `message.nack` so step examples can assert on that.\n */\n\nconst eventPayload = {\n name: 'page view',\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n};\n\nconst orderPayload = {\n name: 'order complete',\n data: { id: 'ORD-500', total: 199.99, currency: 'EUR' },\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A JSON-encoded page view event arrives on the subscription, decodes successfully, and is acked.',\n in: {\n id: 'msg-1',\n dataString: JSON.stringify(eventPayload),\n attributes: {},\n },\n out: [['message.ack', 'msg-1']],\n};\n\nexport const orderComplete: Flow.StepExample = {\n title: 'Order complete',\n description:\n 'A JSON-encoded order event arrives and is acked after successful collector forwarding.',\n in: {\n id: 'msg-2',\n dataString: JSON.stringify(orderPayload),\n attributes: { entity: 'order', action: 'complete' },\n },\n out: [['message.ack', 'msg-2']],\n};\n\nexport const decoderText: Flow.StepExample = {\n title: 'Text decoder',\n description:\n 'With decoder=text on the source settings, the message data is forwarded to the collector as a UTF-8 string and acked.',\n in: {\n id: 'msg-3',\n dataString: 'plain text payload',\n attributes: {},\n },\n out: [['message.ack', 'msg-3']],\n};\n\nexport const malformedJson: Flow.StepExample = {\n title: 'Malformed JSON nack',\n description:\n 'A non-JSON body with the default json decoder fails to decode; the message is nacked for redelivery.',\n in: {\n id: 'msg-4',\n dataString: 'not-json{',\n attributes: {},\n },\n out: [['message.nack', 'msg-4']],\n};\n\nexport const malformedJsonAck: Flow.StepExample = {\n title: 'Malformed JSON ack-and-drop',\n description:\n 'With onPushError=ack on the source settings, a malformed JSON message is acked-and-dropped instead of redelivered.',\n in: {\n id: 'msg-5',\n dataString: 'not-json{',\n attributes: {},\n },\n out: [['message.ack', 'msg-5']],\n};\n","import type { Collector, Trigger } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\nimport type { SyntheticMessage, SyntheticPushResult } from '../types';\n\n/**\n * Content shape for the pull-source trigger.\n *\n * The trigger synthesizes a message from this partial input and dispatches\n * it through the source's `push()` (the same pipeline the SDK subscriber\n * callback uses). `dataString` is the user-friendly way to provide the\n * message body; the trigger encodes it to a Buffer.\n */\nexport interface Content {\n id: string;\n dataString: string;\n attributes?: Record<string, string>;\n orderingKey?: string;\n}\n\n/**\n * Result shape for the pull-source trigger.\n *\n * Returns the recorded ack/nack as `[method, id]` entries, mirroring the\n * destination's `[method, ...args]` recording shape used elsewhere.\n */\nexport type Result = Array<[string, ...unknown[]]>;\n\ninterface PubSubPullSourceLike {\n type: string;\n push: (content?: SyntheticMessage) => Promise<SyntheticPushResult | void>;\n}\n\nfunction isPubSubPullSource(value: unknown): value is PubSubPullSourceLike {\n if (typeof value !== 'object' || value === null) return false;\n const candidate: { type?: unknown; push?: unknown } = value;\n return (\n candidate.type === 'pubsub-pull' && typeof candidate.push === 'function'\n );\n}\n\nfunction findSource(\n collector: Collector.Instance,\n): PubSubPullSourceLike | undefined {\n for (const source of Object.values(collector.sources ?? {})) {\n if (isPubSubPullSource(source)) return source;\n }\n return undefined;\n}\n\n/**\n * Pub/Sub pull source createTrigger.\n *\n * Boots the collector via startFlow, finds the registered pubsub-pull source,\n * and invokes its `push()` with a synthesized message. The source dispatches\n * the synthetic message through the same handler the SDK subscriber callback\n * uses, exercising the full decode / forward / ack-nack pipeline without\n * touching real Pub/Sub.\n *\n * Matches the convention used by other source triggers (express, lambda,\n * cloudfunction): find the source by type from the collector and call its\n * public `push()` interface.\n */\nexport const createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const source = findSource(flow.collector);\n if (!source)\n throw new Error(\n 'pubsub-pull source not registered in collector — ensure it is configured in sources',\n );\n\n const synthetic: SyntheticMessage = {\n id: content.id,\n data: Buffer.from(content.dataString, 'utf8'),\n attributes: content.attributes,\n orderingKey: content.orderingKey,\n };\n\n const result = await source.push(synthetic);\n const recorded: Result = [];\n if (result && typeof result === 'object') {\n if (result.acked) recorded.push(['message.ack', content.id]);\n if (result.nacked) recorded.push(['message.nack', content.id]);\n }\n return recorded;\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\n\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub push source settings schema.\n *\n * No required fields. The push source is a request-handler; configuration\n * tunables live here, but operators wire `source.push` into their own\n * express/lambda runtime.\n */\nexport const SettingsSchema = z.object({\n projectId: z\n .string()\n .describe(\n 'Google Cloud Project ID (informational, surfaced in error messages).',\n )\n .optional(),\n decoder: z\n .enum(['json', 'text', 'raw'])\n .describe(\n 'Decoder for the message data field. json (default) parses JSON, text decodes UTF-8, raw forwards the Buffer.',\n )\n .optional(),\n verifyOidc: z\n .boolean()\n .describe(\n 'Verify the OIDC bearer token Pub/Sub attaches to push requests. Default: false.',\n )\n .optional(),\n audience: z\n .string()\n .describe(\n 'OIDC audience (your endpoint URL or a custom audience). Required when verifyOidc is true.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as env from './env';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\nexport type { Content, Result } from './trigger';\n","import type { Env } from '../types';\nimport type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment for the Pub/Sub push source.\n *\n * Provides a no-op env compatible with `Source.Env` plus an optional\n * verifyOidcToken stub for tests that exercise OIDC verification.\n */\n\nconst noopFn = () => {};\nconst noopLogger: Logger.Instance = {\n error: noopFn,\n warn: noopFn,\n info: noopFn,\n debug: noopFn,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noopFn,\n scope: () => noopLogger,\n};\n\nconst createMockElbFn = (): Elb.Fn => {\n const fn = (() => Promise.resolve({ ok: true })) as Elb.Fn;\n return fn;\n};\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 logger: noopLogger,\n};\n\nexport const simulation: string[] = [];\n","import type { Flow } from '@walkeros/core';\n\n/**\n * Pub/Sub push step examples.\n *\n * Each example's `in` is a partial Pub/Sub push envelope (with `message.data`\n * pre-encoded as base64). The trigger constructs an HTTP-like Request from\n * `in` and invokes the source handler. `out` is the recorded HTTP response\n * shape (statusCode + JSON body).\n */\n\nconst eventPayload = {\n name: 'page view',\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n};\n\nconst orderPayload = {\n name: 'order complete',\n data: { id: 'ORD-500', total: 199.99, currency: 'EUR' },\n};\n\nfunction encodeData(value: unknown): string {\n return Buffer.from(JSON.stringify(value), 'utf8').toString('base64');\n}\n\nexport const validEnvelope: Flow.StepExample = {\n title: 'Valid push envelope',\n description:\n 'A well-formed Pub/Sub push envelope decodes the base64 data, parses JSON, and forwards the event to the collector with a 200 response.',\n in: {\n message: {\n messageId: 'push-1',\n data: encodeData(eventPayload),\n attributes: { source: 'analytics' },\n },\n subscription: 'projects/test/subscriptions/events-sub',\n },\n out: [['response', 200, { success: true, id: 'push-1' }]],\n};\n\nexport const orderEnvelope: Flow.StepExample = {\n title: 'Order envelope',\n description:\n 'A push envelope carrying an order event is decoded and forwarded to the collector.',\n in: {\n message: {\n messageId: 'push-2',\n data: encodeData(orderPayload),\n attributes: {},\n },\n subscription: 'projects/test/subscriptions/events-sub',\n },\n out: [['response', 200, { success: true, id: 'push-2' }]],\n};\n\nexport const malformedEnvelope: Flow.StepExample = {\n title: 'Malformed envelope',\n description:\n 'A POST body lacking message.messageId returns 400 Bad Request without forwarding to the collector.',\n in: {\n not_a: 'pubsub envelope',\n },\n out: [\n [\n 'response',\n 400,\n {\n success: false,\n error: 'Malformed Pub/Sub envelope (missing message.messageId).',\n },\n ],\n ],\n};\n","import type { Collector, Trigger } from '@walkeros/core';\nimport type { Request, Response } from '../types';\nimport { startFlow } from '@walkeros/collector';\n\n/** Content for the push trigger: a Pub/Sub envelope or any POST body. */\nexport type Content = Record<string, unknown>;\n\n/** Result: the recorded HTTP response (`status` + `json` body). */\nexport type Result = Array<[string, ...unknown[]]>;\n\ninterface RecordedResponse {\n statusCode?: number;\n body?: unknown;\n}\n\nfunction buildResponse(state: RecordedResponse): Response {\n const res: Response = {\n status(code: number) {\n state.statusCode = code;\n return res;\n },\n json(body: unknown) {\n state.body = body;\n return res;\n },\n send(body?: unknown) {\n state.body = body;\n return res;\n },\n set() {\n return res;\n },\n };\n return res;\n}\n\nfunction buildRequest(\n content: Content,\n headers: Record<string, string>,\n): Request {\n return {\n method: 'POST',\n body: content,\n headers,\n get(name: string) {\n const value = headers[name.toLowerCase()] ?? headers[name];\n return value;\n },\n };\n}\n\ninterface TriggerOptions {\n headers?: Record<string, string>;\n}\n\ninterface PushCapableSource {\n type: string;\n push: (req: Request, res: Response) => Promise<void>;\n}\n\nfunction isPushCapableSource(value: unknown): value is PushCapableSource {\n if (typeof value !== 'object' || value === null) return false;\n const candidate: { type?: unknown; push?: unknown } = value;\n return (\n typeof candidate.type === 'string' &&\n candidate.type === 'pubsub-push' &&\n typeof candidate.push === 'function'\n );\n}\n\nfunction findPushSource(\n collector: Collector.Instance,\n): PushCapableSource | undefined {\n for (const source of Object.values(collector.sources ?? {})) {\n if (isPushCapableSource(source)) return source;\n }\n return undefined;\n}\n\n/**\n * Pub/Sub push source createTrigger.\n *\n * Boots the collector via startFlow, builds a fake Request/Response pair\n * from the trigger Content, and invokes the source's HTTP handler. Returns\n * the recorded response as a Result entry.\n */\nexport const createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n (_type, options) =>\n async (content: Content): Promise<Result> => {\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const triggerOptions: TriggerOptions =\n typeof options === 'object' && options !== null\n ? (options as TriggerOptions)\n : {};\n const headers = triggerOptions.headers ?? {};\n\n const source = findPushSource(flow.collector);\n if (!source) throw new Error('pubsub-push source not registered');\n\n const state: RecordedResponse = {};\n const req = buildRequest(content, headers);\n const res = buildResponse(state);\n\n await source.push(req, res);\n\n const recorded: Result = [\n ['response', state.statusCode ?? 0, state.body ?? null],\n ];\n return recorded;\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n","export * as schemas from './cloudfunction/schemas';\nexport * as examples from './cloudfunction/examples';\nexport * as pubsubPullSchemas from './pubsub/pull/schemas';\nexport * as pubsubPullExamples from './pubsub/pull/examples';\nexport * as pubsubPushSchemas from './pubsub/push/schemas';\nexport * as pubsubPushExamples from './pubsub/push/examples';\n\nimport * as cloudFunctionExamplesNs from './cloudfunction/examples';\nimport * as pubsubPullExamplesNs from './pubsub/pull/examples';\nimport * as pubsubPushExamplesNs from './pubsub/push/examples';\n\n/** Dev examples per export, keyed by the export names in package.json. */\nexport const exportExamples = {\n sourceCloudFunction: cloudFunctionExamplesNs,\n sourcePubSubPull: pubsubPullExamplesNs,\n sourcePubSubPush: pubsubPushExamplesNs,\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAKX,IAAM,aAAa,EAAE,KAAK;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AASM,IAAM,aAAa,EAAE,MAAM;AAAA,EAChC,EAAE,OAAO;AAAA,EACT,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,EAClB,EAAE,QAAQ,GAAG;AACf,CAAC;AAMM,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,QAAQ,WAAW;AAAA,IACjB;AAAA,EACF,EAAE,SAAS;AAAA,EAEX,SAAS,EAAE,MAAM,UAAU,EAAE,SAAS,sBAAsB,EAAE,SAAS;AAAA,EAEvE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,yBAAyB,EAAE,SAAS;AAAA,EAE1E,aAAa,EACV,QAAQ,EACR,SAAS,oDAAoD,EAC7D,SAAS;AAAA,EAEZ,QAAQ,EACL,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,qCAAqC,EAC9C,SAAS;AACd,CAAC;;;AD9CM,IAAM,iBAAiBC,GAAE,OAAO;AAAA,EACrC,MAAMA,GACH,MAAM,CAACA,GAAE,QAAQ,GAAG,iBAAiB,CAAC,EACtC;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,cAAcA,GACX,OAAO,EACP,IAAI,EACJ,IAAI,CAAC,EACL,SAAS,6DAA6D,EACtE,QAA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AY,OACtC,UACD,CAAC;AACP,UAAM,UAAU,eAAe,WAAW,CAAC;AAE3C,UAAM,SAAS,eAAe,KAAK,SAAS;AAC5C,QAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,mCAAmC;AAEhE,UAAM,QAA0B,CAAC;AACjC,UAAM,MAAM,aAAa,SAAS,OAAO;AACzC,UAAM,MAAM,cAAc,KAAK;AAE/B,UAAM,OAAO,KAAK,KAAK,GAAG;AAE1B,UAAM,WAAmB;AAAA,MACvB,CAAC,YAAY,MAAM,cAAc,GAAG,MAAM,QAAQ,IAAI;AAAA,IACxD;AACA,WAAO;AAAA,EACT;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;;;AClHO,IAAM,iBAAiB;AAAA,EAC5B,qBAAqB;AAAA,EACrB,kBAAkBE;AAAA,EAClB,kBAAkBA;AACpB;","names":["z","z","schemas_exports","SettingsSchema","settings","zodToSchema","z","SettingsSchema","z","settings","zodToSchema","SettingsSchema","examples_exports","createTrigger","env_exports","step_exports","env_exports","push","noopFn","noopLogger","createMockElbFn","step_exports","startFlow","createTrigger","result","schemas_exports","SettingsSchema","settings","zodToSchema","z","SettingsSchema","settings","zodToSchema","SettingsSchema","examples_exports","createTrigger","env_exports","step_exports","env_exports","push","simulation","noopFn","noopLogger","createMockElbFn","step_exports","eventPayload","orderPayload","startFlow","createTrigger","examples_exports"]}
1
+ {"version":3,"sources":["../src/cloudfunction/examples/index.ts","../src/cloudfunction/examples/env.ts","../src/cloudfunction/examples/step.ts","../src/cloudfunction/examples/trigger.ts","../src/pubsub/pull/examples/index.ts","../src/pubsub/pull/examples/env.ts","../src/pubsub/pull/examples/step.ts","../src/pubsub/pull/examples/trigger.ts","../src/pubsub/push/examples/index.ts","../src/pubsub/push/examples/env.ts","../src/pubsub/push/examples/step.ts","../src/pubsub/push/examples/trigger.ts","../src/cloudfunction/schemas/index.ts","../src/cloudfunction/schemas/settings.ts","../src/cloudfunction/schemas/primitives.ts","../src/pubsub/pull/schemas/index.ts","../src/pubsub/pull/schemas/settings.ts","../src/pubsub/pull/schemas/setup.ts","../src/pubsub/push/schemas/index.ts","../src/pubsub/push/schemas/settings.ts","../src/dev.ts"],"sourcesContent":["export * as env from './env';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\n","import type { Env } from '../types';\nimport type { Elb, Logger } 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 })) as Elb.Fn;\n return fn;\n};\n\n// Simple no-op logger for demo purposes\nconst noopFn = () => {};\nconst noopLogger: Logger.Instance = {\n error: noopFn,\n warn: noopFn,\n info: noopFn,\n debug: noopFn,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noopFn,\n scope: () => noopLogger,\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 logger: noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const postEvent: Flow.StepExample = {\n title: 'POST event',\n description:\n 'A GCP Cloud Function HTTP POST with a JSON body becomes a single walker elb event.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n body: {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n headers: { 'content-type': 'application/json' },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n ],\n ],\n};\n\nexport const orderEvent: Flow.StepExample = {\n title: 'Order POST',\n description:\n 'A Cloud Function HTTP POST carrying an order payload becomes a walker order complete event.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n body: {\n name: 'order complete',\n data: { id: 'ORD-700', total: 99.99, currency: 'EUR' },\n },\n headers: { 'content-type': 'application/json' },\n },\n out: [\n [\n 'elb',\n {\n name: 'order complete',\n data: { id: 'ORD-700', total: 99.99, currency: 'EUR' },\n },\n ],\n ],\n};\n\nexport const cloudFunctionPostForwardsSource: Flow.StepExample = {\n title: 'POST with provenance',\n description:\n 'A POST body carrying a source map is forwarded in full, so release and trace provenance survive the crossing.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n body: {\n name: 'page view',\n data: { title: 'Home' },\n source: { release: { web: 'r1' } },\n },\n headers: { 'content-type': 'application/json' },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Home' },\n source: { release: { web: 'r1' } },\n },\n ],\n ],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport type { CloudFunctionSource, Request, Response } from '../types';\nimport { startFlow } from '@walkeros/collector';\n\nexport interface Content {\n method: string;\n body: Record<string, unknown>;\n headers?: Record<string, string>;\n}\n\nexport interface Result {\n status: number;\n body: unknown;\n}\n\n/**\n * Find the cloudfunction source instance from collector.sources.\n */\nfunction findGcpSource(\n collector: Collector.Instance,\n): CloudFunctionSource | undefined {\n for (const source of Object.values(collector.sources || {})) {\n if ((source as { type?: string }).type === 'cloudfunction')\n return source as unknown as CloudFunctionSource;\n }\n return undefined;\n}\n\n/**\n * GCP CloudFunction source createTrigger.\n *\n * Boots a real collector via startFlow, then synthesizes mock req/res\n * (matching the GCP Functions Framework pattern) and calls source.push(req, res).\n * This is the realistic approach for GCP Cloud Functions - the Functions Framework\n * synthesizes these objects in production too.\n */\nconst createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n // Lazy startFlow\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const source = findGcpSource(flow.collector);\n if (!source)\n throw new Error(\n 'CloudFunction source not found in collector — ensure it is configured in sources',\n );\n\n // Adapt body: step examples use `name`, source expects `event`\n const body = { ...content.body };\n if (body.name && !body.event) {\n body.event = body.name;\n delete body.name;\n }\n\n const headers = content.headers || {\n 'content-type': 'application/json',\n };\n\n // Synthesize mock req matching GCP Functions Framework pattern\n const req = {\n method: content.method,\n body,\n headers,\n get: (h: string) => headers[h.toLowerCase()],\n } as Request;\n\n // Synthesize mock res that captures status and response body\n let statusCode = 200;\n let responseBody: unknown;\n const res = {\n status: (code: number) => {\n statusCode = code;\n return res;\n },\n json: (data: unknown) => {\n responseBody = data;\n return res;\n },\n send: (data: unknown) => {\n responseBody = data;\n return res;\n },\n set: () => res,\n } as unknown as Response;\n\n // GCP source awaits env.push() — no detached promises\n await source.push(req, res);\n\n return { status: statusCode, body: responseBody };\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\nexport { createTrigger };\n","export * as env from './env';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\nexport type { Content, Result } from './trigger';\n","import type { Message, SubscriptionOptions } from '@google-cloud/pubsub';\nimport type { Env, PubSubPullClient, PullSubscription } from '../types';\nimport type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment for the Pub/Sub pull source.\n *\n * `push` injects a structural Pub/Sub client (`env.PubSub`), so a simulated\n * run never reaches Google Cloud and its subscription call can be recorded.\n * The unit tests keep substituting the SDK module-wide via\n * `jest.mock('@google-cloud/pubsub')`; they use `push` without the client.\n */\n\nconst noopFn = (): void => undefined;\nconst noopLogger: Logger.Instance = {\n error: noopFn,\n warn: noopFn,\n info: noopFn,\n debug: noopFn,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noopFn,\n scope: () => noopLogger,\n};\n\nconst createMockElbFn = (): Elb.Fn => {\n const fn: Elb.Fn = () => Promise.resolve({ ok: true });\n return fn;\n};\n\n/** A subscription that never receives: messages arrive by synthetic push. */\nclass MockSubscription implements PullSubscription {\n constructor(\n public name: string,\n public options?: SubscriptionOptions,\n ) {}\n\n on(\n _event: 'message' | 'error',\n _listener: ((message: Message) => void) | ((error: Error) => void),\n ): this {\n return this;\n }\n\n async close(): Promise<void> {}\n}\n\nclass MockPubSub implements PubSubPullClient {\n constructor(public options?: object) {}\n\n subscription(name: string, options?: SubscriptionOptions): MockSubscription {\n return new MockSubscription(name, options);\n }\n\n async close(): Promise<void> {}\n}\n\nfunction createEnv(): Env {\n return {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n logger: noopLogger,\n };\n}\n\n/** Standard mock environment, with the structural client for simulate. */\nexport const push: Env = Object.assign(createEnv(), { PubSub: MockPubSub });\n\n/**\n * The same environment without the client, for unit tests that substitute the\n * SDK module-wide with `jest.mock`.\n */\nexport const moduleMockEnv: Env = createEnv();\n\n/**\n * The subscription call binds the source to its subscription; messages then\n * arrive as events, not calls. Construction is not recorded: its options\n * carry credentials.\n */\nexport const simulation = ['call:PubSub.subscription'];\n","import type { Flow } from '@walkeros/core';\n\n/**\n * Pub/Sub pull step examples.\n *\n * Each example's `in` is a partial MessageLike (id, data Buffer, attributes,\n * publishTime). The trigger synthesizes the missing fields and invokes the\n * registered message handler. `out` is the array of recorded mock calls\n * produced by the handler. Recording shape is `[method, ...args]`.\n *\n * The `__triggerMessage` helper records each message's terminal state under\n * `message.ack` or `message.nack` so step examples can assert on that.\n */\n\nconst eventPayload = {\n name: 'page view',\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n};\n\nconst orderPayload = {\n name: 'order complete',\n data: { id: 'ORD-500', total: 199.99, currency: 'EUR' },\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A JSON-encoded page view event arrives on the subscription, decodes successfully, and is acked.',\n in: {\n id: 'msg-1',\n dataString: JSON.stringify(eventPayload),\n attributes: {},\n },\n out: [['message.ack', 'msg-1']],\n};\n\nexport const orderComplete: Flow.StepExample = {\n title: 'Order complete',\n description:\n 'A JSON-encoded order event arrives and is acked after successful collector forwarding.',\n in: {\n id: 'msg-2',\n dataString: JSON.stringify(orderPayload),\n attributes: { entity: 'order', action: 'complete' },\n },\n out: [['message.ack', 'msg-2']],\n};\n\nexport const decoderText: Flow.StepExample = {\n title: 'Text decoder',\n description:\n 'With decoder=text on the source settings, the message data is forwarded to the collector as a UTF-8 string and acked.',\n in: {\n id: 'msg-3',\n dataString: 'plain text payload',\n attributes: {},\n },\n out: [['message.ack', 'msg-3']],\n};\n\nexport const malformedJson: Flow.StepExample = {\n title: 'Malformed JSON nack',\n description:\n 'A non-JSON body with the default json decoder fails to decode; the message is nacked for redelivery.',\n in: {\n id: 'msg-4',\n dataString: 'not-json{',\n attributes: {},\n },\n out: [['message.nack', 'msg-4']],\n};\n\nexport const malformedJsonAck: Flow.StepExample = {\n title: 'Malformed JSON ack-and-drop',\n description:\n 'With onPushError=ack on the source settings, a malformed JSON message is acked-and-dropped instead of redelivered.',\n in: {\n id: 'msg-5',\n dataString: 'not-json{',\n attributes: {},\n },\n out: [['message.ack', 'msg-5']],\n};\n","import type { Collector, Trigger } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\nimport type { SyntheticMessage, SyntheticPushResult } from '../types';\n\n/**\n * Content shape for the pull-source trigger.\n *\n * The trigger synthesizes a message from this partial input and dispatches\n * it through the source's `push()` (the same pipeline the SDK subscriber\n * callback uses). `dataString` is the user-friendly way to provide the\n * message body; the trigger encodes it to a Buffer.\n */\nexport interface Content {\n id: string;\n dataString: string;\n attributes?: Record<string, string>;\n orderingKey?: string;\n}\n\n/**\n * Result shape for the pull-source trigger.\n *\n * Returns the recorded ack/nack as `[method, id]` entries, mirroring the\n * destination's `[method, ...args]` recording shape used elsewhere.\n */\nexport type Result = Array<[string, ...unknown[]]>;\n\ninterface PubSubPullSourceLike {\n type: string;\n push: (content?: SyntheticMessage) => Promise<SyntheticPushResult | void>;\n}\n\nfunction isPubSubPullSource(value: unknown): value is PubSubPullSourceLike {\n if (typeof value !== 'object' || value === null) return false;\n const candidate: { type?: unknown; push?: unknown } = value;\n return (\n candidate.type === 'pubsub-pull' && typeof candidate.push === 'function'\n );\n}\n\nfunction findSource(\n collector: Collector.Instance,\n): PubSubPullSourceLike | undefined {\n for (const source of Object.values(collector.sources ?? {})) {\n if (isPubSubPullSource(source)) return source;\n }\n return undefined;\n}\n\n/**\n * Pub/Sub pull source createTrigger.\n *\n * Boots the collector via startFlow, finds the registered pubsub-pull source,\n * and invokes its `push()` with a synthesized message. The source dispatches\n * the synthetic message through the same handler the SDK subscriber callback\n * uses, exercising the full decode / forward / ack-nack pipeline without\n * touching real Pub/Sub.\n *\n * Matches the convention used by other source triggers (express, lambda,\n * cloudfunction): find the source by type from the collector and call its\n * public `push()` interface.\n */\nexport const createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const source = findSource(flow.collector);\n if (!source)\n throw new Error(\n 'pubsub-pull source not registered in collector — ensure it is configured in sources',\n );\n\n const synthetic: SyntheticMessage = {\n id: content.id,\n data: Buffer.from(content.dataString, 'utf8'),\n attributes: content.attributes,\n orderingKey: content.orderingKey,\n };\n\n const result = await source.push(synthetic);\n const recorded: Result = [];\n if (result && typeof result === 'object') {\n if (result.acked) recorded.push(['message.ack', content.id]);\n if (result.nacked) recorded.push(['message.nack', content.id]);\n }\n return recorded;\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n","export * as env from './env';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\nexport type { Content, Result } from './trigger';\n","import type { Env } from '../types';\nimport type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment for the Pub/Sub push source.\n *\n * Provides a no-op env compatible with `Source.Env` plus an optional\n * verifyOidcToken stub for tests that exercise OIDC verification.\n */\n\nconst noopFn = () => {};\nconst noopLogger: Logger.Instance = {\n error: noopFn,\n warn: noopFn,\n info: noopFn,\n debug: noopFn,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noopFn,\n scope: () => noopLogger,\n};\n\nconst createMockElbFn = (): Elb.Fn => {\n const fn = (() => Promise.resolve({ ok: true })) as Elb.Fn;\n return fn;\n};\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 logger: noopLogger,\n};\n\nexport const simulation: string[] = [];\n","import type { Flow } from '@walkeros/core';\n\n/**\n * Pub/Sub push step examples.\n *\n * Each example's `in` is a partial Pub/Sub push envelope (with `message.data`\n * pre-encoded as base64). The trigger constructs an HTTP-like Request from\n * `in` and invokes the source handler. `out` is the recorded HTTP response\n * shape (statusCode + JSON body).\n */\n\nconst eventPayload = {\n name: 'page view',\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n};\n\nconst orderPayload = {\n name: 'order complete',\n data: { id: 'ORD-500', total: 199.99, currency: 'EUR' },\n};\n\nfunction encodeData(value: unknown): string {\n return Buffer.from(JSON.stringify(value), 'utf8').toString('base64');\n}\n\nexport const validEnvelope: Flow.StepExample = {\n title: 'Valid push envelope',\n description:\n 'A well-formed Pub/Sub push envelope decodes the base64 data, parses JSON, and forwards the event to the collector with a 200 response.',\n in: {\n message: {\n messageId: 'push-1',\n data: encodeData(eventPayload),\n attributes: { source: 'analytics' },\n },\n subscription: 'projects/test/subscriptions/events-sub',\n },\n out: [['response', 200, { success: true, id: 'push-1' }]],\n};\n\nexport const orderEnvelope: Flow.StepExample = {\n title: 'Order envelope',\n description:\n 'A push envelope carrying an order event is decoded and forwarded to the collector.',\n in: {\n message: {\n messageId: 'push-2',\n data: encodeData(orderPayload),\n attributes: {},\n },\n subscription: 'projects/test/subscriptions/events-sub',\n },\n out: [['response', 200, { success: true, id: 'push-2' }]],\n};\n\nexport const malformedEnvelope: Flow.StepExample = {\n title: 'Malformed envelope',\n description:\n 'A POST body lacking message.messageId returns 400 Bad Request without forwarding to the collector.',\n in: {\n not_a: 'pubsub envelope',\n },\n out: [\n [\n 'response',\n 400,\n {\n success: false,\n error: 'Malformed Pub/Sub envelope (missing message.messageId).',\n },\n ],\n ],\n};\n","import type { Collector, Trigger } from '@walkeros/core';\nimport type { Request, Response } from '../types';\nimport { startFlow } from '@walkeros/collector';\n\n/** Content for the push trigger: a Pub/Sub envelope or any POST body. */\nexport type Content = Record<string, unknown>;\n\n/** Result: the recorded HTTP response (`status` + `json` body). */\nexport type Result = Array<[string, ...unknown[]]>;\n\ninterface RecordedResponse {\n statusCode?: number;\n body?: unknown;\n}\n\nfunction buildResponse(state: RecordedResponse): Response {\n const res: Response = {\n status(code: number) {\n state.statusCode = code;\n return res;\n },\n json(body: unknown) {\n state.body = body;\n return res;\n },\n send(body?: unknown) {\n state.body = body;\n return res;\n },\n set() {\n return res;\n },\n };\n return res;\n}\n\nfunction buildRequest(\n content: Content,\n headers: Record<string, string>,\n): Request {\n return {\n method: 'POST',\n body: content,\n headers,\n get(name: string) {\n const value = headers[name.toLowerCase()] ?? headers[name];\n return value;\n },\n };\n}\n\ninterface TriggerOptions {\n headers?: Record<string, string>;\n}\n\ninterface PushCapableSource {\n type: string;\n push: (req: Request, res: Response) => Promise<void>;\n}\n\nfunction isPushCapableSource(value: unknown): value is PushCapableSource {\n if (typeof value !== 'object' || value === null) return false;\n const candidate: { type?: unknown; push?: unknown } = value;\n return (\n typeof candidate.type === 'string' &&\n candidate.type === 'pubsub-push' &&\n typeof candidate.push === 'function'\n );\n}\n\nfunction findPushSource(\n collector: Collector.Instance,\n): PushCapableSource | undefined {\n for (const source of Object.values(collector.sources ?? {})) {\n if (isPushCapableSource(source)) return source;\n }\n return undefined;\n}\n\n/**\n * Pub/Sub push source createTrigger.\n *\n * Boots the collector via startFlow, builds a fake Request/Response pair\n * from the trigger Content, and invokes the source's HTTP handler. Returns\n * the recorded response as a Result entry.\n */\nexport const createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n (_type, options) =>\n async (content: Content): Promise<Result> => {\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const triggerOptions: TriggerOptions =\n typeof options === 'object' && options !== null\n ? (options as TriggerOptions)\n : {};\n const headers = triggerOptions.headers ?? {};\n\n const source = findPushSource(flow.collector);\n if (!source) throw new Error('pubsub-push source not registered');\n\n const state: RecordedResponse = {};\n const req = buildRequest(content, headers);\n const res = buildResponse(state);\n\n await source.push(req, res);\n\n const recorded: Result = [\n ['response', state.statusCode ?? 0, state.body ?? null],\n ];\n return recorded;\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\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 maxBatchSize: z\n .number()\n .int()\n .min(1)\n .describe('Maximum number of events accepted in a single batch request')\n .default(100),\n\n enablePixelTracking: z\n .boolean()\n .describe('Serve a tracking pixel for GET requests')\n .default(true),\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","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { SetupSchema } from './setup';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { SetupSchema, type Setup } from './setup';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const setup = zodToSchema(SetupSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub pull source settings schema.\n *\n * Required: projectId, subscription. All other fields optional with sensible\n * defaults applied at runtime by `getConfig`.\n */\nexport const SettingsSchema = z.object({\n client: z\n .any()\n .describe(\n 'Pre-configured Google Cloud Pub/Sub client (like new PubSub({ projectId })). Bypasses credentials resolution when supplied.',\n )\n .optional(),\n projectId: z\n .string()\n .min(1)\n .describe('Google Cloud Project ID (like my-gcp-project).'),\n subscription: z\n .string()\n .min(1)\n .describe(\n 'Pub/Sub subscription short name (like events-sub). The full resource name projects/<projectId>/subscriptions/<subscription> is built by the SDK.',\n ),\n topic: z\n .string()\n .describe(\n 'Pub/Sub topic short name. Required when setup.createTopic is true; otherwise informational.',\n )\n .optional(),\n credentials: z\n .any()\n .describe(\n 'Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)',\n )\n .optional(),\n apiEndpoint: z\n .string()\n .describe(\n 'Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).',\n )\n .optional(),\n decoder: z\n .enum(['json', 'text', 'raw'])\n .describe(\n 'Decoder for the message data field. json (default) parses JSON, text decodes UTF-8, raw forwards the Buffer.',\n )\n .optional(),\n flowControl: z\n .object({\n maxMessages: z\n .number()\n .describe('Maximum in-flight messages. Default: 100.')\n .optional(),\n maxBytes: z\n .number()\n .describe('Maximum in-flight bytes. Default: 10485760 (10 MB).')\n .optional(),\n })\n .describe('Subscriber flow control. Tightens the SDK defaults.')\n .optional(),\n ackDeadline: z\n .number()\n .describe('Subscriber ack deadline in seconds. Default: 60.')\n .optional(),\n shutdownTimeoutMs: z\n .number()\n .describe(\n 'Graceful shutdown timeout in milliseconds. Default: 30000. After this window, destroy() force-closes the subscriber.',\n )\n .optional(),\n onPushError: z\n .enum(['nack', 'ack'])\n .describe(\n 'Behavior when forwarding to the collector throws. nack (default) redelivers the message; ack drops it.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub pull source setup schema.\n *\n * Provisioning options for `walkeros setup source.<id>`. Idempotent\n * subscription creation, plus optional topic and dead-letter topic\n * auto-create. Triggered only by the explicit CLI command.\n */\nexport const SetupSchema = z.object({\n createTopic: z\n .boolean()\n .describe(\n 'Create the topic if it does not exist. Requires settings.topic. Default: false (require pre-existing topic).',\n )\n .optional(),\n ackDeadlineSeconds: z\n .number()\n .describe('Subscription ack deadline in seconds. Default: 60.')\n .optional(),\n messageRetentionDuration: z\n .object({\n seconds: z\n .number()\n .describe('Retention window in seconds. Default: project default.'),\n })\n .describe('Subscription-level retention configuration.')\n .optional(),\n filter: z\n .string()\n .describe(\n 'Subscription filter expression. Only messages matching this filter are delivered.',\n )\n .optional(),\n deadLetterPolicy: z\n .object({\n deadLetterTopic: z.string().describe('Dead-letter topic short name.'),\n maxDeliveryAttempts: z\n .number()\n .describe(\n 'Maximum delivery attempts before forwarding to the dead-letter topic.',\n ),\n createDeadLetterTopic: z\n .boolean()\n .describe(\n 'Auto-create the dead-letter topic if it does not exist. Default: false.',\n )\n .optional(),\n })\n .describe('Dead-letter policy. Strongly recommended for production.')\n .optional(),\n retryPolicy: z\n .object({\n minimumBackoff: z.object({\n seconds: z.number().describe('Minimum backoff in seconds.'),\n }),\n maximumBackoff: z.object({\n seconds: z.number().describe('Maximum backoff in seconds.'),\n }),\n })\n .describe('Subscription retry policy.')\n .optional(),\n enableMessageOrdering: z\n .boolean()\n .describe('Enable message ordering on the subscription. Default: false.')\n .optional(),\n labels: z\n .record(z.string(), z.string())\n .describe('Subscription labels for organization and billing.')\n .optional(),\n expirationPolicy: z\n .object({\n ttl: z\n .object({\n seconds: z\n .number()\n .describe('TTL in seconds. null means never expire.'),\n })\n .nullable()\n .optional(),\n })\n .describe('Subscription expiration policy.')\n .optional(),\n});\n\nexport type Setup = z.infer<typeof SetupSchema>;\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\n\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub push source settings schema.\n *\n * No required fields. The push source is a request-handler; configuration\n * tunables live here, but operators wire `source.push` into their own\n * express/lambda runtime.\n */\nexport const SettingsSchema = z.object({\n projectId: z\n .string()\n .describe(\n 'Google Cloud Project ID (informational, surfaced in error messages).',\n )\n .optional(),\n decoder: z\n .enum(['json', 'text', 'raw'])\n .describe(\n 'Decoder for the message data field. json (default) parses JSON, text decodes UTF-8, raw forwards the Buffer.',\n )\n .optional(),\n verifyOidc: z\n .boolean()\n .describe(\n 'Verify the OIDC bearer token Pub/Sub attaches to push requests. Default: false.',\n )\n .optional(),\n audience: z\n .string()\n .describe(\n 'OIDC audience (your endpoint URL or a custom audience). Required when verifyOidc is true.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import * as cloudFunctionExamplesNs from './cloudfunction/examples';\nimport * as pubsubPullExamplesNs from './pubsub/pull/examples';\nimport * as pubsubPushExamplesNs from './pubsub/push/examples';\nimport * as cloudFunctionSchemasNs from './cloudfunction/schemas';\nimport * as pubsubPullSchemasNs from './pubsub/pull/schemas';\nimport * as pubsubPushSchemasNs from './pubsub/push/schemas';\n\nexport * as schemas from './cloudfunction/schemas';\nexport * as examples from './cloudfunction/examples';\nexport * as pubsubPullSchemas from './pubsub/pull/schemas';\nexport * as pubsubPullExamples from './pubsub/pull/examples';\nexport * as pubsubPushSchemas from './pubsub/push/schemas';\nexport * as pubsubPushExamples from './pubsub/push/examples';\n\n/** Dev examples per export, keyed by the export names in package.json. */\nexport const exportExamples = {\n sourceCloudFunction: cloudFunctionExamplesNs,\n sourcePubSubPull: pubsubPullExamplesNs,\n sourcePubSubPush: pubsubPushExamplesNs,\n};\n\n/** Schemas per export, keyed by the export names in package.json. */\nexport const exportSchemas = {\n sourceCloudFunction: { settings: cloudFunctionSchemasNs.settings },\n sourcePubSubPull: {\n settings: pubsubPullSchemasNs.settings,\n setup: pubsubPullSchemasNs.setup,\n },\n sourcePubSubPush: { settings: pubsubPushSchemasNs.settings },\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAWA,IAAM,kBAAkB,MAAc;AACpC,QAAM,MAAM,MACV,QAAQ,QAAQ;AAAA,IACd,IAAI;AAAA,EACN,CAAC;AACH,SAAO;AAC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ACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;AD7BM,IAAME,YAAWC,aAAYC,eAAc;;;AEU3C,IAAM,iBAAiB;AAAA,EAC5B,qBAAqB;AAAA,EACrB,kBAAkBC;AAAA,EAClB,kBAAkBA;AACpB;AAGO,IAAM,gBAAgB;AAAA,EAC3B,qBAAqB,EAAE,SAA0C;AAAA,EACjE,kBAAkB;AAAA,IAChB,UAA8BC;AAAA,IAC9B;AAAA,EACF;AAAA,EACA,kBAAkB,EAAE,UAA8BA,UAAS;AAC7D;","names":["examples_exports","createTrigger","env_exports","step_exports","env_exports","push","noopFn","noopLogger","createMockElbFn","step_exports","startFlow","createTrigger","result","examples_exports","createTrigger","env_exports","step_exports","env_exports","push","simulation","noopFn","noopLogger","createMockElbFn","step_exports","eventPayload","orderPayload","startFlow","createTrigger","z","z","schemas_exports","SettingsSchema","settings","zodToSchema","z","SettingsSchema","z","settings","zodToSchema","SettingsSchema","schemas_exports","SettingsSchema","settings","zodToSchema","z","SettingsSchema","settings","zodToSchema","SettingsSchema","examples_exports","settings"]}