@walkeros/server-transformer-file 3.4.2 → 4.0.0-next-1777463920154

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 CHANGED
@@ -1 +1 @@
1
- "use strict";var e,r=Object.defineProperty,t=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,a=(e,t)=>{for(var i in t)r(e,i,{get:t[i],enumerable:!0})},s={};a(s,{examples:()=>g,schemas:()=>n}),module.exports=(e=s,((e,a,s,n)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let p of i(a))o.call(e,p)||p===s||r(e,p,{get:()=>a[p],enumerable:!(n=t(a,p))||n.enumerable});return e})(r({},"__esModule",{value:!0}),e));var n={};a(n,{SettingsSchema:()=>l,settings:()=>d});var p=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),l=c.z.object({prefix:c.z.string().optional().describe('URL prefix to strip before store lookup. E.g., "/static" → /static/walker.js looks up "walker.js"'),headers:c.z.record(c.z.string(),c.z.string()).optional().describe("Default response headers (e.g., Cache-Control, X-Frame-Options)"),mimeTypes:c.z.record(c.z.string(),c.z.string()).optional().describe('Extension → Content-Type overrides. Keys include dot: { ".wasm": "application/wasm" }')}).describe("File transformer: serves static files via pluggable Store backend"),d=(0,p.zodToSchema)(l),g={};a(g,{env:()=>m,step:()=>u});var u={};a(u,{serveStaticFile:()=>v});var v={title:"Serve static file",description:'Serve a static JavaScript file from store. Config: prefix: "/static", headers: { "Cache-Control": "public, max-age=3600" }',in:{name:"page view",data:{path:"/static/walker.js"},id:"1700000600-gr0up-1",trigger:"load",entity:"page",action:"view",timestamp:1700000600,group:"gr0up",count:1,version:{tagging:1},source:{type:"server",id:"",previous_id:""}},out:[["respond",{status:200,headers:{"Content-Type":"application/javascript","Cache-Control":"public, max-age=3600"}}]]},m={};a(m,{init:()=>f,push:()=>b,simulation:()=>h});var f=void 0,b={store:void 0,respond:void 0},h=["call:respond"];//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i=(e,r)=>{for(var a in r)t(e,a,{get:r[a],enumerable:!0})},s={};i(s,{examples:()=>v,schemas:()=>n}),module.exports=(e=s,((e,i,s,n)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let p of a(i))o.call(e,p)||p===s||t(e,p,{get:()=>i[p],enumerable:!(n=r(i,p))||n.enumerable});return e})(t({},"__esModule",{value:!0}),e));var n={};i(n,{SettingsSchema:()=>l,settings:()=>d});var p=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),l=c.z.object({prefix:c.z.string().optional().describe('URL prefix to strip before store lookup. E.g., "/static" → /static/walker.js looks up "walker.js"'),headers:c.z.record(c.z.string(),c.z.string()).optional().describe("Default response headers (e.g., Cache-Control, X-Frame-Options)"),mimeTypes:c.z.record(c.z.string(),c.z.string()).optional().describe('Extension → Content-Type overrides. Keys include dot: { ".wasm": "application/wasm" }')}).describe("File transformer: serves static files via pluggable Store backend"),d=(0,p.zodToSchema)(l),v={};i(v,{env:()=>g,step:()=>m});var m={};i(m,{serveStaticFile:()=>u});var u={title:"Serve static file",description:'Serve a static JavaScript file from store. Config: prefix: "/static", headers: { "Cache-Control": "public, max-age=3600" }',in:{name:"page view",data:{path:"/static/walker.js"},id:"ev-1700000600",trigger:"load",entity:"page",action:"view",timestamp:1700000600,source:{type:"express",platform:"server"}},out:[["respond",{status:200,headers:{"Content-Type":"application/javascript","Cache-Control":"public, max-age=3600"}}]]},g={};i(g,{init:()=>f,push:()=>b,simulation:()=>h});var f=void 0,b={store:void 0,respond:void 0},h=["call:respond"];//# sourceMappingURL=dev.js.map
package/dist/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/step.ts","../src/examples/env.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * File transformer settings schema.\n *\n * Mirrors: types.ts FileSettings\n */\nexport const SettingsSchema = z\n .object({\n prefix: z\n .string()\n .optional()\n .describe(\n 'URL prefix to strip before store lookup. E.g., \"/static\" → /static/walker.js looks up \"walker.js\"',\n ),\n headers: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Default response headers (e.g., Cache-Control, X-Frame-Options)',\n ),\n mimeTypes: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Extension → Content-Type overrides. Keys include dot: { \".wasm\": \"application/wasm\" }',\n ),\n })\n .describe(\n 'File transformer: serves static files via pluggable Store backend',\n );\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as step from './step';\nexport * as env from './env';\n","import type { Flow } from '@walkeros/core';\n\nexport const serveStaticFile: Flow.StepExample = {\n title: 'Serve static file',\n description:\n 'Serve a static JavaScript file from store. ' +\n 'Config: prefix: \"/static\", headers: { \"Cache-Control\": \"public, max-age=3600\" }',\n in: {\n name: 'page view',\n data: { path: '/static/walker.js' },\n id: '1700000600-gr0up-1',\n trigger: 'load',\n entity: 'page',\n action: 'view',\n timestamp: 1700000600,\n group: 'gr0up',\n count: 1,\n version: { tagging: 1 },\n source: { type: 'server', id: '', previous_id: '' },\n },\n out: [\n [\n 'respond',\n {\n status: 200,\n headers: {\n 'Content-Type': 'application/javascript',\n 'Cache-Control': 'public, max-age=3600',\n },\n },\n ],\n ],\n};\n","import type { FileEnv } from '../types';\n\nexport const init: FileEnv | undefined = undefined;\n\nexport const push: FileEnv = {\n store: undefined,\n respond: undefined,\n};\n\nexport const simulation = ['call:respond'];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;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as/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/step.ts","../src/examples/env.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * File transformer settings schema.\n *\n * Mirrors: types.ts FileSettings\n */\nexport const SettingsSchema = z\n .object({\n prefix: z\n .string()\n .optional()\n .describe(\n 'URL prefix to strip before store lookup. E.g., \"/static\" → /static/walker.js looks up \"walker.js\"',\n ),\n headers: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Default response headers (e.g., Cache-Control, X-Frame-Options)',\n ),\n mimeTypes: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Extension → Content-Type overrides. Keys include dot: { \".wasm\": \"application/wasm\" }',\n ),\n })\n .describe(\n 'File transformer: serves static files via pluggable Store backend',\n );\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as step from './step';\nexport * as env from './env';\n","import type { Flow } from '@walkeros/core';\n\nexport const serveStaticFile: Flow.StepExample = {\n title: 'Serve static file',\n description:\n 'Serve a static JavaScript file from store. ' +\n 'Config: prefix: \"/static\", headers: { \"Cache-Control\": \"public, max-age=3600\" }',\n in: {\n name: 'page view',\n data: { path: '/static/walker.js' },\n id: 'ev-1700000600',\n trigger: 'load',\n entity: 'page',\n action: 'view',\n timestamp: 1700000600,\n source: { type: 'express', platform: 'server' },\n },\n out: [\n [\n 'respond',\n {\n status: 200,\n headers: {\n 'Content-Type': 'application/javascript',\n 'Cache-Control': 'public, max-age=3600',\n },\n },\n ],\n ],\n};\n","import type { FileEnv } from '../types';\n\nexport const init: FileEnv | undefined = undefined;\n\nexport const push: FileEnv = {\n store: undefined,\n respond: undefined,\n};\n\nexport const simulation = ['call:respond'];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AA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[i],enumerable:!0})},t={};r(t,{SettingsSchema:()=>s,settings:()=>o});import{zodToSchema as i}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var s=a.object({prefix:a.string().optional().describe('URL prefix to strip before store lookup. E.g., "/static" → /static/walker.js looks up "walker.js"'),headers:a.record(a.string(),a.string()).optional().describe("Default response headers (e.g., Cache-Control, X-Frame-Options)"),mimeTypes:a.record(a.string(),a.string()).optional().describe('Extension → Content-Type overrides. Keys include dot: { ".wasm": "application/wasm" }')}).describe("File transformer: serves static files via pluggable Store backend"),o=i(s),n={};r(n,{env:()=>l,step:()=>p});var p={};r(p,{serveStaticFile:()=>c});var c={title:"Serve static file",description:'Serve a static JavaScript file from store. Config: prefix: "/static", headers: { "Cache-Control": "public, max-age=3600" }',in:{name:"page view",data:{path:"/static/walker.js"},id:"1700000600-gr0up-1",trigger:"load",entity:"page",action:"view",timestamp:1700000600,group:"gr0up",count:1,version:{tagging:1},source:{type:"server",id:"",previous_id:""}},out:[["respond",{status:200,headers:{"Content-Type":"application/javascript","Cache-Control":"public, max-age=3600"}}]]},l={};r(l,{init:()=>d,push:()=>g,simulation:()=>v});var d=void 0,g={store:void 0,respond:void 0},v=["call:respond"];export{n as examples,t as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,r=(r,t)=>{for(var a in t)e(r,a,{get:t[a],enumerable:!0})},t={};r(t,{SettingsSchema:()=>s,settings:()=>o});import{zodToSchema as a}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var s=i.object({prefix:i.string().optional().describe('URL prefix to strip before store lookup. E.g., "/static" → /static/walker.js looks up "walker.js"'),headers:i.record(i.string(),i.string()).optional().describe("Default response headers (e.g., Cache-Control, X-Frame-Options)"),mimeTypes:i.record(i.string(),i.string()).optional().describe('Extension → Content-Type overrides. Keys include dot: { ".wasm": "application/wasm" }')}).describe("File transformer: serves static files via pluggable Store backend"),o=a(s),n={};r(n,{env:()=>l,step:()=>p});var p={};r(p,{serveStaticFile:()=>c});var c={title:"Serve static file",description:'Serve a static JavaScript file from store. Config: prefix: "/static", headers: { "Cache-Control": "public, max-age=3600" }',in:{name:"page view",data:{path:"/static/walker.js"},id:"ev-1700000600",trigger:"load",entity:"page",action:"view",timestamp:1700000600,source:{type:"express",platform:"server"}},out:[["respond",{status:200,headers:{"Content-Type":"application/javascript","Cache-Control":"public, max-age=3600"}}]]},l={};r(l,{init:()=>d,push:()=>v,simulation:()=>m});var d=void 0,v={store:void 0,respond:void 0},m=["call:respond"];export{n as examples,t as schemas};//# sourceMappingURL=dev.mjs.map
package/dist/dev.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/step.ts","../src/examples/env.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * File transformer settings schema.\n *\n * Mirrors: types.ts FileSettings\n */\nexport const SettingsSchema = z\n .object({\n prefix: z\n .string()\n .optional()\n .describe(\n 'URL prefix to strip before store lookup. E.g., \"/static\" → /static/walker.js looks up \"walker.js\"',\n ),\n headers: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Default response headers (e.g., Cache-Control, X-Frame-Options)',\n ),\n mimeTypes: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Extension → Content-Type overrides. Keys include dot: { \".wasm\": \"application/wasm\" }',\n ),\n })\n .describe(\n 'File transformer: serves static files via pluggable Store backend',\n );\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as step from './step';\nexport * as env from './env';\n","import type { Flow } from '@walkeros/core';\n\nexport const serveStaticFile: Flow.StepExample = {\n title: 'Serve static file',\n description:\n 'Serve a static JavaScript file from store. ' +\n 'Config: prefix: \"/static\", headers: { \"Cache-Control\": \"public, max-age=3600\" }',\n in: {\n name: 'page view',\n data: { path: '/static/walker.js' },\n id: '1700000600-gr0up-1',\n trigger: 'load',\n entity: 'page',\n action: 'view',\n timestamp: 1700000600,\n group: 'gr0up',\n count: 1,\n version: { tagging: 1 },\n source: { type: 'server', id: '', previous_id: '' },\n },\n out: [\n [\n 'respond',\n {\n status: 200,\n headers: {\n 'Content-Type': 'application/javascript',\n 'Cache-Control': 'public, max-age=3600',\n },\n },\n ],\n ],\n};\n","import type { FileEnv } from '../types';\n\nexport const init: FileEnv | undefined = undefined;\n\nexport const push: FileEnv = {\n store: undefined,\n respond: undefined,\n};\n\nexport const simulation = ['call:respond'];\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAOX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,QAAQ,EACL,OAAO,EACP,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,SAAS,EACN,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,WAAW,EACR,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B,SAAS,EACT;AAAA,IACC;AAAA,EACF;AACJ,CAAC,EACA;AAAA,EACC;AACF;;;AD1BK,IAAM,WAAW,YAAY,cAAc;;;AEJlD;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAEO,IAAM,kBAAoC;AAAA,EAC/C,OAAO;AAAA,EACP,aACE;AAAA,EAEF,IAAI;AAAA,IACF,MAAM;AAAA,IACN,MAAM,EAAE,MAAM,oBAAoB;AAAA,IAClC,IAAI;AAAA,IACJ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,OAAO;AAAA,IACP,OAAO;AAAA,IACP,SAAS,EAAE,SAAS,EAAE;AAAA,IACtB,QAAQ,EAAE,MAAM,UAAU,IAAI,IAAI,aAAa,GAAG;AAAA,EACpD;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,SAAS;AAAA,UACP,gBAAgB;AAAA,UAChB,iBAAiB;AAAA,QACnB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AChCA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,OAA4B;AAElC,IAAM,OAAgB;AAAA,EAC3B,OAAO;AAAA,EACP,SAAS;AACX;AAEO,IAAM,aAAa,CAAC,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/step.ts","../src/examples/env.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * File transformer settings schema.\n *\n * Mirrors: types.ts FileSettings\n */\nexport const SettingsSchema = z\n .object({\n prefix: z\n .string()\n .optional()\n .describe(\n 'URL prefix to strip before store lookup. E.g., \"/static\" → /static/walker.js looks up \"walker.js\"',\n ),\n headers: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Default response headers (e.g., Cache-Control, X-Frame-Options)',\n ),\n mimeTypes: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Extension → Content-Type overrides. Keys include dot: { \".wasm\": \"application/wasm\" }',\n ),\n })\n .describe(\n 'File transformer: serves static files via pluggable Store backend',\n );\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as step from './step';\nexport * as env from './env';\n","import type { Flow } from '@walkeros/core';\n\nexport const serveStaticFile: Flow.StepExample = {\n title: 'Serve static file',\n description:\n 'Serve a static JavaScript file from store. ' +\n 'Config: prefix: \"/static\", headers: { \"Cache-Control\": \"public, max-age=3600\" }',\n in: {\n name: 'page view',\n data: { path: '/static/walker.js' },\n id: 'ev-1700000600',\n trigger: 'load',\n entity: 'page',\n action: 'view',\n timestamp: 1700000600,\n source: { type: 'express', platform: 'server' },\n },\n out: [\n [\n 'respond',\n {\n status: 200,\n headers: {\n 'Content-Type': 'application/javascript',\n 'Cache-Control': 'public, max-age=3600',\n },\n },\n ],\n ],\n};\n","import type { FileEnv } from '../types';\n\nexport const init: FileEnv | undefined = undefined;\n\nexport const push: FileEnv = {\n store: undefined,\n respond: undefined,\n};\n\nexport const simulation = ['call:respond'];\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAOX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,QAAQ,EACL,OAAO,EACP,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,SAAS,EACN,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,WAAW,EACR,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B,SAAS,EACT;AAAA,IACC;AAAA,EACF;AACJ,CAAC,EACA;AAAA,EACC;AACF;;;AD1BK,IAAM,WAAW,YAAY,cAAc;;;AEJlD;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAEO,IAAM,kBAAoC;AAAA,EAC/C,OAAO;AAAA,EACP,aACE;AAAA,EAEF,IAAI;AAAA,IACF,MAAM;AAAA,IACN,MAAM,EAAE,MAAM,oBAAoB;AAAA,IAClC,IAAI;AAAA,IACJ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,QAAQ,EAAE,MAAM,WAAW,UAAU,SAAS;AAAA,EAChD;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,SAAS;AAAA,UACP,gBAAgB;AAAA,UAChB,iBAAiB;AAAA,QACnB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AC7BA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,OAA4B;AAElC,IAAM,OAAgB;AAAA,EAC3B,OAAO;AAAA,EACP,SAAS;AACX;AAEO,IAAM,aAAa,CAAC,cAAc;","names":[]}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o={};((e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})})(o,{default:()=>p,getMimeType:()=>s,transformerFile:()=>p}),module.exports=(e=o,((e,o,a,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let p of i(o))r.call(e,p)||p===a||t(e,p,{get:()=>o[p],enumerable:!(s=n(o,p))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".html":"text/html",".htm":"text/html",".json":"application/json",".wasm":"application/wasm",".map":"application/json",".txt":"text/plain",".xml":"application/xml",".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".ico":"image/x-icon",".webp":"image/webp",".woff":"font/woff",".woff2":"font/woff2"};function s(e,t){const n=e.lastIndexOf(".");if(-1===n)return"application/octet-stream";const i=e.slice(n).toLowerCase();return(null==t?void 0:t[i])||a[i]||"application/octet-stream"}var p=e=>{const{config:t}=e,n=t.settings||{},i=n.prefix,r=n.headers,o=n.mimeTypes,a=e.env.store;return{type:"file",config:t,async push(e,t){const{logger:n}=t,p=t.ingest||{},f=t.env.respond,l=p.path;if(!l)return;if(!a)return void n.warn("No store provided to file transformer");let c=l;if(i){if(!c.startsWith(i))return;c=c.slice(i.length)}if(c.startsWith("/")&&(c=c.slice(1)),!c)return;const g=await a.get(c);if(null==g)return;const m=s(c,o),u=g instanceof Buffer?g.length:"string"==typeof g?Buffer.byteLength(g):void 0,j={"Content-Type":m,...r};return void 0!==u&&(j["Content-Length"]=String(u)),null==f||f({body:g,status:200,headers:j}),!1}}};//# sourceMappingURL=index.js.map
1
+ "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,o={};((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(o,{default:()=>p,getMimeType:()=>s,transformerFile:()=>p}),module.exports=(e=o,((e,o,a,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let p of r(o))i.call(e,p)||p===a||t(e,p,{get:()=>o[p],enumerable:!(s=n(o,p))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".html":"text/html",".htm":"text/html",".json":"application/json",".wasm":"application/wasm",".map":"application/json",".txt":"text/plain",".xml":"application/xml",".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".ico":"image/x-icon",".webp":"image/webp",".woff":"font/woff",".woff2":"font/woff2"};function s(e,t){const n=e.lastIndexOf(".");if(-1===n)return"application/octet-stream";const r=e.slice(n).toLowerCase();return t?.[r]||a[r]||"application/octet-stream"}var p=e=>{const{config:t}=e,n=t.settings||{},r=n.prefix,i=n.headers,o=n.mimeTypes,a=e.env.store;return{type:"file",config:t,async push(e,t){const{logger:n}=t,p=t.ingest||{},f=t.env.respond,c=p.path;if(!c)return;if(!a)return void n.warn("No store provided to file transformer");let l=c;if(r){if(!l.startsWith(r))return;l=l.slice(r.length)}if(l.startsWith("/")&&(l=l.slice(1)),!l)return;const g=await a.get(l);if(null==g)return;const m=s(l,o),u=g instanceof Buffer?g.length:"string"==typeof g?Buffer.byteLength(g):void 0,j={"Content-Type":m,...i};return void 0!==u&&(j["Content-Length"]=String(u)),f?.({body:g,status:200,headers:j}),!1}}};//# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/mime.ts","../src/transformer.ts"],"sourcesContent":["export { transformerFile } from './transformer';\nexport { getMimeType } from './mime';\nexport type { FileSettings, FileEnv, Types } from './types';\nexport { transformerFile as default } from './transformer';\n","const DEFAULT_MIME_TYPES: Record<string, string> = {\n '.js': 'application/javascript',\n '.mjs': 'application/javascript',\n '.css': 'text/css',\n '.html': 'text/html',\n '.htm': 'text/html',\n '.json': 'application/json',\n '.wasm': 'application/wasm',\n '.map': 'application/json',\n '.txt': 'text/plain',\n '.xml': 'application/xml',\n '.svg': 'image/svg+xml',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.ico': 'image/x-icon',\n '.webp': 'image/webp',\n '.woff': 'font/woff',\n '.woff2': 'font/woff2',\n};\n\nexport function getMimeType(\n filePath: string,\n overrides?: Record<string, string>,\n): string {\n const lastDot = filePath.lastIndexOf('.');\n if (lastDot === -1) return 'application/octet-stream';\n const ext = filePath.slice(lastDot).toLowerCase();\n return (\n overrides?.[ext] || DEFAULT_MIME_TYPES[ext] || 'application/octet-stream'\n );\n}\n","import type { Transformer } from '@walkeros/core';\nimport type { RespondFn } from '@walkeros/core';\nimport { getMimeType } from './mime';\nimport type { FileSettings, FileEnv, Types } from './types';\n\nexport const transformerFile: Transformer.Init<Types> = (context) => {\n const { config } = context;\n const settings = (config.settings || {}) as Partial<FileSettings>;\n const prefix = settings.prefix;\n const defaultHeaders = settings.headers;\n const mimeOverrides = settings.mimeTypes;\n\n const store = (context.env as FileEnv).store;\n\n return {\n type: 'file',\n config: config as Transformer.Config<Types>,\n\n async push(event, context) {\n const { logger } = context;\n const ingest = (context.ingest || {}) as Record<string, unknown>;\n const envRespond = context.env.respond as RespondFn | undefined;\n\n const rawPath = ingest.path as string | undefined;\n if (!rawPath) return;\n\n if (!store) {\n logger.warn('No store provided to file transformer');\n return;\n }\n\n // Apply prefix stripping\n let filePath = rawPath;\n if (prefix) {\n if (!filePath.startsWith(prefix)) return; // Not our path\n filePath = filePath.slice(prefix.length);\n }\n\n // Strip leading slash for store key\n if (filePath.startsWith('/')) filePath = filePath.slice(1);\n if (!filePath) return;\n\n // Fetch from store\n const content = await store.get(filePath);\n if (content == null) return;\n\n // Derive Content-Type\n const contentType = getMimeType(filePath, mimeOverrides);\n const contentLength =\n content instanceof Buffer\n ? content.length\n : typeof content === 'string'\n ? Buffer.byteLength(content)\n : undefined;\n\n const headers: Record<string, string> = {\n 'Content-Type': contentType,\n ...defaultHeaders,\n };\n if (contentLength !== undefined) {\n headers['Content-Length'] = String(contentLength);\n }\n\n envRespond?.({\n body: content,\n status: 200,\n headers,\n });\n\n return false;\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAM,qBAA6C;AAAA,EACjD,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU;AACZ;AAEO,SAAS,YACd,UACA,WACQ;AACR,QAAM,UAAU,SAAS,YAAY,GAAG;AACxC,MAAI,YAAY,GAAI,QAAO;AAC3B,QAAM,MAAM,SAAS,MAAM,OAAO,EAAE,YAAY;AAChD,UACE,uCAAY,SAAQ,mBAAmB,GAAG,KAAK;AAEnD;;;AC3BO,IAAM,kBAA2C,CAAC,YAAY;AACnE,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,WAAY,OAAO,YAAY,CAAC;AACtC,QAAM,SAAS,SAAS;AACxB,QAAM,iBAAiB,SAAS;AAChC,QAAM,gBAAgB,SAAS;AAE/B,QAAM,QAAS,QAAQ,IAAgB;AAEvC,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IAEA,MAAM,KAAK,OAAOA,UAAS;AACzB,YAAM,EAAE,OAAO,IAAIA;AACnB,YAAM,SAAUA,SAAQ,UAAU,CAAC;AACnC,YAAM,aAAaA,SAAQ,IAAI;AAE/B,YAAM,UAAU,OAAO;AACvB,UAAI,CAAC,QAAS;AAEd,UAAI,CAAC,OAAO;AACV,eAAO,KAAK,uCAAuC;AACnD;AAAA,MACF;AAGA,UAAI,WAAW;AACf,UAAI,QAAQ;AACV,YAAI,CAAC,SAAS,WAAW,MAAM,EAAG;AAClC,mBAAW,SAAS,MAAM,OAAO,MAAM;AAAA,MACzC;AAGA,UAAI,SAAS,WAAW,GAAG,EAAG,YAAW,SAAS,MAAM,CAAC;AACzD,UAAI,CAAC,SAAU;AAGf,YAAM,UAAU,MAAM,MAAM,IAAI,QAAQ;AACxC,UAAI,WAAW,KAAM;AAGrB,YAAM,cAAc,YAAY,UAAU,aAAa;AACvD,YAAM,gBACJ,mBAAmB,SACf,QAAQ,SACR,OAAO,YAAY,WACjB,OAAO,WAAW,OAAO,IACzB;AAER,YAAM,UAAkC;AAAA,QACtC,gBAAgB;AAAA,QAChB,GAAG;AAAA,MACL;AACA,UAAI,kBAAkB,QAAW;AAC/B,gBAAQ,gBAAgB,IAAI,OAAO,aAAa;AAAA,MAClD;AAEA,+CAAa;AAAA,QACX,MAAM;AAAA,QACN,QAAQ;AAAA,QACR;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["context"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/mime.ts","../src/transformer.ts"],"sourcesContent":["export { transformerFile } from './transformer';\nexport { getMimeType } from './mime';\nexport type { FileSettings, FileEnv, Types } from './types';\nexport { transformerFile as default } from './transformer';\n","const DEFAULT_MIME_TYPES: Record<string, string> = {\n '.js': 'application/javascript',\n '.mjs': 'application/javascript',\n '.css': 'text/css',\n '.html': 'text/html',\n '.htm': 'text/html',\n '.json': 'application/json',\n '.wasm': 'application/wasm',\n '.map': 'application/json',\n '.txt': 'text/plain',\n '.xml': 'application/xml',\n '.svg': 'image/svg+xml',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.ico': 'image/x-icon',\n '.webp': 'image/webp',\n '.woff': 'font/woff',\n '.woff2': 'font/woff2',\n};\n\nexport function getMimeType(\n filePath: string,\n overrides?: Record<string, string>,\n): string {\n const lastDot = filePath.lastIndexOf('.');\n if (lastDot === -1) return 'application/octet-stream';\n const ext = filePath.slice(lastDot).toLowerCase();\n return (\n overrides?.[ext] || DEFAULT_MIME_TYPES[ext] || 'application/octet-stream'\n );\n}\n","import type { Transformer } from '@walkeros/core';\nimport type { RespondFn } from '@walkeros/core';\nimport { getMimeType } from './mime';\nimport type { FileSettings, FileEnv, Types } from './types';\n\nexport const transformerFile: Transformer.Init<Types> = (context) => {\n const { config } = context;\n const settings = (config.settings || {}) as Partial<FileSettings>;\n const prefix = settings.prefix;\n const defaultHeaders = settings.headers;\n const mimeOverrides = settings.mimeTypes;\n\n const store = (context.env as FileEnv).store;\n\n return {\n type: 'file',\n config: config as Transformer.Config<Types>,\n\n async push(event, context) {\n const { logger } = context;\n const ingest = (context.ingest || {}) as Record<string, unknown>;\n const envRespond = context.env.respond as RespondFn | undefined;\n\n const rawPath = ingest.path as string | undefined;\n if (!rawPath) return;\n\n if (!store) {\n logger.warn('No store provided to file transformer');\n return;\n }\n\n // Apply prefix stripping\n let filePath = rawPath;\n if (prefix) {\n if (!filePath.startsWith(prefix)) return; // Not our path\n filePath = filePath.slice(prefix.length);\n }\n\n // Strip leading slash for store key\n if (filePath.startsWith('/')) filePath = filePath.slice(1);\n if (!filePath) return;\n\n // Fetch from store\n const content = await store.get(filePath);\n if (content == null) return;\n\n // Derive Content-Type\n const contentType = getMimeType(filePath, mimeOverrides);\n const contentLength =\n content instanceof Buffer\n ? content.length\n : typeof content === 'string'\n ? Buffer.byteLength(content)\n : undefined;\n\n const headers: Record<string, string> = {\n 'Content-Type': contentType,\n ...defaultHeaders,\n };\n if (contentLength !== undefined) {\n headers['Content-Length'] = String(contentLength);\n }\n\n envRespond?.({\n body: content,\n status: 200,\n headers,\n });\n\n return false;\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAM,qBAA6C;AAAA,EACjD,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU;AACZ;AAEO,SAAS,YACd,UACA,WACQ;AACR,QAAM,UAAU,SAAS,YAAY,GAAG;AACxC,MAAI,YAAY,GAAI,QAAO;AAC3B,QAAM,MAAM,SAAS,MAAM,OAAO,EAAE,YAAY;AAChD,SACE,YAAY,GAAG,KAAK,mBAAmB,GAAG,KAAK;AAEnD;;;AC3BO,IAAM,kBAA2C,CAAC,YAAY;AACnE,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,WAAY,OAAO,YAAY,CAAC;AACtC,QAAM,SAAS,SAAS;AACxB,QAAM,iBAAiB,SAAS;AAChC,QAAM,gBAAgB,SAAS;AAE/B,QAAM,QAAS,QAAQ,IAAgB;AAEvC,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IAEA,MAAM,KAAK,OAAOA,UAAS;AACzB,YAAM,EAAE,OAAO,IAAIA;AACnB,YAAM,SAAUA,SAAQ,UAAU,CAAC;AACnC,YAAM,aAAaA,SAAQ,IAAI;AAE/B,YAAM,UAAU,OAAO;AACvB,UAAI,CAAC,QAAS;AAEd,UAAI,CAAC,OAAO;AACV,eAAO,KAAK,uCAAuC;AACnD;AAAA,MACF;AAGA,UAAI,WAAW;AACf,UAAI,QAAQ;AACV,YAAI,CAAC,SAAS,WAAW,MAAM,EAAG;AAClC,mBAAW,SAAS,MAAM,OAAO,MAAM;AAAA,MACzC;AAGA,UAAI,SAAS,WAAW,GAAG,EAAG,YAAW,SAAS,MAAM,CAAC;AACzD,UAAI,CAAC,SAAU;AAGf,YAAM,UAAU,MAAM,MAAM,IAAI,QAAQ;AACxC,UAAI,WAAW,KAAM;AAGrB,YAAM,cAAc,YAAY,UAAU,aAAa;AACvD,YAAM,gBACJ,mBAAmB,SACf,QAAQ,SACR,OAAO,YAAY,WACjB,OAAO,WAAW,OAAO,IACzB;AAER,YAAM,UAAkC;AAAA,QACtC,gBAAgB;AAAA,QAChB,GAAG;AAAA,MACL;AACA,UAAI,kBAAkB,QAAW;AAC/B,gBAAQ,gBAAgB,IAAI,OAAO,aAAa;AAAA,MAClD;AAEA,mBAAa;AAAA,QACX,MAAM;AAAA,QACN,QAAQ;AAAA,QACR;AAAA,MACF,CAAC;AAED,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["context"]}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var t={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".html":"text/html",".htm":"text/html",".json":"application/json",".wasm":"application/wasm",".map":"application/json",".txt":"text/plain",".xml":"application/xml",".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".ico":"image/x-icon",".webp":"image/webp",".woff":"font/woff",".woff2":"font/woff2"};function e(e,i){const n=e.lastIndexOf(".");if(-1===n)return"application/octet-stream";const a=e.slice(n).toLowerCase();return(null==i?void 0:i[a])||t[a]||"application/octet-stream"}var i=t=>{const{config:i}=t,n=i.settings||{},a=n.prefix,o=n.headers,s=n.mimeTypes,r=t.env.store;return{type:"file",config:i,async push(t,i){const{logger:n}=i,p=i.ingest||{},f=i.env.respond,l=p.path;if(!l)return;if(!r)return void n.warn("No store provided to file transformer");let c=l;if(a){if(!c.startsWith(a))return;c=c.slice(a.length)}if(c.startsWith("/")&&(c=c.slice(1)),!c)return;const g=await r.get(c);if(null==g)return;const m=e(c,s),u=g instanceof Buffer?g.length:"string"==typeof g?Buffer.byteLength(g):void 0,h={"Content-Type":m,...o};return void 0!==u&&(h["Content-Length"]=String(u)),null==f||f({body:g,status:200,headers:h}),!1}}};export{i as default,e as getMimeType,i as transformerFile};//# sourceMappingURL=index.mjs.map
1
+ var t={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".html":"text/html",".htm":"text/html",".json":"application/json",".wasm":"application/wasm",".map":"application/json",".txt":"text/plain",".xml":"application/xml",".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".ico":"image/x-icon",".webp":"image/webp",".woff":"font/woff",".woff2":"font/woff2"};function e(e,i){const n=e.lastIndexOf(".");if(-1===n)return"application/octet-stream";const a=e.slice(n).toLowerCase();return i?.[a]||t[a]||"application/octet-stream"}var i=t=>{const{config:i}=t,n=i.settings||{},a=n.prefix,o=n.headers,s=n.mimeTypes,r=t.env.store;return{type:"file",config:i,async push(t,i){const{logger:n}=i,p=i.ingest||{},f=i.env.respond,c=p.path;if(!c)return;if(!r)return void n.warn("No store provided to file transformer");let g=c;if(a){if(!g.startsWith(a))return;g=g.slice(a.length)}if(g.startsWith("/")&&(g=g.slice(1)),!g)return;const l=await r.get(g);if(null==l)return;const m=e(g,s),u=l instanceof Buffer?l.length:"string"==typeof l?Buffer.byteLength(l):void 0,h={"Content-Type":m,...o};return void 0!==u&&(h["Content-Length"]=String(u)),f?.({body:l,status:200,headers:h}),!1}}};export{i as default,e as getMimeType,i as transformerFile};//# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/mime.ts","../src/transformer.ts"],"sourcesContent":["const DEFAULT_MIME_TYPES: Record<string, string> = {\n '.js': 'application/javascript',\n '.mjs': 'application/javascript',\n '.css': 'text/css',\n '.html': 'text/html',\n '.htm': 'text/html',\n '.json': 'application/json',\n '.wasm': 'application/wasm',\n '.map': 'application/json',\n '.txt': 'text/plain',\n '.xml': 'application/xml',\n '.svg': 'image/svg+xml',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.ico': 'image/x-icon',\n '.webp': 'image/webp',\n '.woff': 'font/woff',\n '.woff2': 'font/woff2',\n};\n\nexport function getMimeType(\n filePath: string,\n overrides?: Record<string, string>,\n): string {\n const lastDot = filePath.lastIndexOf('.');\n if (lastDot === -1) return 'application/octet-stream';\n const ext = filePath.slice(lastDot).toLowerCase();\n return (\n overrides?.[ext] || DEFAULT_MIME_TYPES[ext] || 'application/octet-stream'\n );\n}\n","import type { Transformer } from '@walkeros/core';\nimport type { RespondFn } from '@walkeros/core';\nimport { getMimeType } from './mime';\nimport type { FileSettings, FileEnv, Types } from './types';\n\nexport const transformerFile: Transformer.Init<Types> = (context) => {\n const { config } = context;\n const settings = (config.settings || {}) as Partial<FileSettings>;\n const prefix = settings.prefix;\n const defaultHeaders = settings.headers;\n const mimeOverrides = settings.mimeTypes;\n\n const store = (context.env as FileEnv).store;\n\n return {\n type: 'file',\n config: config as Transformer.Config<Types>,\n\n async push(event, context) {\n const { logger } = context;\n const ingest = (context.ingest || {}) as Record<string, unknown>;\n const envRespond = context.env.respond as RespondFn | undefined;\n\n const rawPath = ingest.path as string | undefined;\n if (!rawPath) return;\n\n if (!store) {\n logger.warn('No store provided to file transformer');\n return;\n }\n\n // Apply prefix stripping\n let filePath = rawPath;\n if (prefix) {\n if (!filePath.startsWith(prefix)) return; // Not our path\n filePath = filePath.slice(prefix.length);\n }\n\n // Strip leading slash for store key\n if (filePath.startsWith('/')) filePath = filePath.slice(1);\n if (!filePath) return;\n\n // Fetch from store\n const content = await store.get(filePath);\n if (content == null) return;\n\n // Derive Content-Type\n const contentType = getMimeType(filePath, mimeOverrides);\n const contentLength =\n content instanceof Buffer\n ? content.length\n : typeof content === 'string'\n ? Buffer.byteLength(content)\n : undefined;\n\n const headers: Record<string, string> = {\n 'Content-Type': contentType,\n ...defaultHeaders,\n };\n if (contentLength !== undefined) {\n headers['Content-Length'] = String(contentLength);\n }\n\n envRespond?.({\n body: content,\n status: 200,\n headers,\n });\n\n return false;\n },\n };\n};\n"],"mappings":";AAAA,IAAM,qBAA6C;AAAA,EACjD,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU;AACZ;AAEO,SAAS,YACd,UACA,WACQ;AACR,QAAM,UAAU,SAAS,YAAY,GAAG;AACxC,MAAI,YAAY,GAAI,QAAO;AAC3B,QAAM,MAAM,SAAS,MAAM,OAAO,EAAE,YAAY;AAChD,UACE,uCAAY,SAAQ,mBAAmB,GAAG,KAAK;AAEnD;;;AC3BO,IAAM,kBAA2C,CAAC,YAAY;AACnE,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,WAAY,OAAO,YAAY,CAAC;AACtC,QAAM,SAAS,SAAS;AACxB,QAAM,iBAAiB,SAAS;AAChC,QAAM,gBAAgB,SAAS;AAE/B,QAAM,QAAS,QAAQ,IAAgB;AAEvC,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IAEA,MAAM,KAAK,OAAOA,UAAS;AACzB,YAAM,EAAE,OAAO,IAAIA;AACnB,YAAM,SAAUA,SAAQ,UAAU,CAAC;AACnC,YAAM,aAAaA,SAAQ,IAAI;AAE/B,YAAM,UAAU,OAAO;AACvB,UAAI,CAAC,QAAS;AAEd,UAAI,CAAC,OAAO;AACV,eAAO,KAAK,uCAAuC;AACnD;AAAA,MACF;AAGA,UAAI,WAAW;AACf,UAAI,QAAQ;AACV,YAAI,CAAC,SAAS,WAAW,MAAM,EAAG;AAClC,mBAAW,SAAS,MAAM,OAAO,MAAM;AAAA,MACzC;AAGA,UAAI,SAAS,WAAW,GAAG,EAAG,YAAW,SAAS,MAAM,CAAC;AACzD,UAAI,CAAC,SAAU;AAGf,YAAM,UAAU,MAAM,MAAM,IAAI,QAAQ;AACxC,UAAI,WAAW,KAAM;AAGrB,YAAM,cAAc,YAAY,UAAU,aAAa;AACvD,YAAM,gBACJ,mBAAmB,SACf,QAAQ,SACR,OAAO,YAAY,WACjB,OAAO,WAAW,OAAO,IACzB;AAER,YAAM,UAAkC;AAAA,QACtC,gBAAgB;AAAA,QAChB,GAAG;AAAA,MACL;AACA,UAAI,kBAAkB,QAAW;AAC/B,gBAAQ,gBAAgB,IAAI,OAAO,aAAa;AAAA,MAClD;AAEA,+CAAa;AAAA,QACX,MAAM;AAAA,QACN,QAAQ;AAAA,QACR;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["context"]}
1
+ {"version":3,"sources":["../src/mime.ts","../src/transformer.ts"],"sourcesContent":["const DEFAULT_MIME_TYPES: Record<string, string> = {\n '.js': 'application/javascript',\n '.mjs': 'application/javascript',\n '.css': 'text/css',\n '.html': 'text/html',\n '.htm': 'text/html',\n '.json': 'application/json',\n '.wasm': 'application/wasm',\n '.map': 'application/json',\n '.txt': 'text/plain',\n '.xml': 'application/xml',\n '.svg': 'image/svg+xml',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.ico': 'image/x-icon',\n '.webp': 'image/webp',\n '.woff': 'font/woff',\n '.woff2': 'font/woff2',\n};\n\nexport function getMimeType(\n filePath: string,\n overrides?: Record<string, string>,\n): string {\n const lastDot = filePath.lastIndexOf('.');\n if (lastDot === -1) return 'application/octet-stream';\n const ext = filePath.slice(lastDot).toLowerCase();\n return (\n overrides?.[ext] || DEFAULT_MIME_TYPES[ext] || 'application/octet-stream'\n );\n}\n","import type { Transformer } from '@walkeros/core';\nimport type { RespondFn } from '@walkeros/core';\nimport { getMimeType } from './mime';\nimport type { FileSettings, FileEnv, Types } from './types';\n\nexport const transformerFile: Transformer.Init<Types> = (context) => {\n const { config } = context;\n const settings = (config.settings || {}) as Partial<FileSettings>;\n const prefix = settings.prefix;\n const defaultHeaders = settings.headers;\n const mimeOverrides = settings.mimeTypes;\n\n const store = (context.env as FileEnv).store;\n\n return {\n type: 'file',\n config: config as Transformer.Config<Types>,\n\n async push(event, context) {\n const { logger } = context;\n const ingest = (context.ingest || {}) as Record<string, unknown>;\n const envRespond = context.env.respond as RespondFn | undefined;\n\n const rawPath = ingest.path as string | undefined;\n if (!rawPath) return;\n\n if (!store) {\n logger.warn('No store provided to file transformer');\n return;\n }\n\n // Apply prefix stripping\n let filePath = rawPath;\n if (prefix) {\n if (!filePath.startsWith(prefix)) return; // Not our path\n filePath = filePath.slice(prefix.length);\n }\n\n // Strip leading slash for store key\n if (filePath.startsWith('/')) filePath = filePath.slice(1);\n if (!filePath) return;\n\n // Fetch from store\n const content = await store.get(filePath);\n if (content == null) return;\n\n // Derive Content-Type\n const contentType = getMimeType(filePath, mimeOverrides);\n const contentLength =\n content instanceof Buffer\n ? content.length\n : typeof content === 'string'\n ? Buffer.byteLength(content)\n : undefined;\n\n const headers: Record<string, string> = {\n 'Content-Type': contentType,\n ...defaultHeaders,\n };\n if (contentLength !== undefined) {\n headers['Content-Length'] = String(contentLength);\n }\n\n envRespond?.({\n body: content,\n status: 200,\n headers,\n });\n\n return false;\n },\n };\n};\n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G,EAAG,YAAW,SAAS,MAAM,CAAC;AACzD,UAAI,CAAC,SAAU;AAGf,YAAM,UAAU,MAAM,MAAM,IAAI,QAAQ;AACxC,UAAI,WAAW,KAAM;AAGrB,YAAM,cAAc,YAAY,UAAU,aAAa;AACvD,YAAM,gBACJ,mBAAmB,SACf,QAAQ,SACR,OAAO,YAAY,WACjB,OAAO,WAAW,OAAO,IACzB;AAER,YAAM,UAAkC;AAAA,QACtC,gBAAgB;AAAA,QAChB,GAAG;AAAA,MACL;AACA,UAAI,kBAAkB,QAAW;AAC/B,gBAAQ,gBAAgB,IAAI,OAAO,aAAa;AAAA,MAClD;AAEA,mBAAa;AAAA,QACX,MAAM;AAAA,QACN,QAAQ;AAAA,QACR;AAAA,MACF,CAAC;AAED,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["context"]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/server-transformer-file",
4
- "version": "3.4.2",
4
+ "version": "4.0.0-next-1777463920154",
5
5
  "type": "transformer",
6
6
  "platform": [
7
7
  "server"
@@ -59,20 +59,14 @@
59
59
  "data": {
60
60
  "path": "/static/walker.js"
61
61
  },
62
- "id": "1700000600-gr0up-1",
62
+ "id": "ev-1700000600",
63
63
  "trigger": "load",
64
64
  "entity": "page",
65
65
  "action": "view",
66
66
  "timestamp": 1700000600,
67
- "group": "gr0up",
68
- "count": 1,
69
- "version": {
70
- "tagging": 1
71
- },
72
67
  "source": {
73
- "type": "server",
74
- "id": "",
75
- "previous_id": ""
68
+ "type": "express",
69
+ "platform": "server"
76
70
  }
77
71
  },
78
72
  "out": [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/server-transformer-file",
3
3
  "description": "File serving transformer for walkerOS - serves static files via pluggable Store backend",
4
- "version": "3.4.2",
4
+ "version": "4.0.0-next-1777463920154",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -27,11 +27,11 @@
27
27
  "update": "npx npm-check-updates -u && npm update"
28
28
  },
29
29
  "dependencies": {
30
- "@walkeros/core": "3.4.2"
30
+ "@walkeros/core": "4.0.0-next-1777463920154"
31
31
  },
32
32
  "devDependencies": {
33
- "@walkeros/core": "3.4.2",
34
- "@walkeros/store-memory": "3.4.2"
33
+ "@walkeros/core": "4.0.0-next-1777463920154",
34
+ "@walkeros/store-memory": "4.0.0-next-1777463920154"
35
35
  },
36
36
  "repository": {
37
37
  "url": "git+https://github.com/elbwalker/walkerOS.git",