@beechcms/client 0.8.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -0
- package/dist/browser/client.d.ts +5 -0
- package/dist/browser/client.d.ts.map +1 -0
- package/dist/browser/client.js +24 -0
- package/dist/browser/index.d.ts +3 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +3 -0
- package/dist/client.d.ts +26 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +20 -0
- package/dist/http.d.ts +8 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +74 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/query-builder.d.ts +4 -0
- package/dist/query-builder.d.ts.map +1 -0
- package/dist/query-builder.js +47 -0
- package/dist/richtext/escape.d.ts +15 -0
- package/dist/richtext/escape.d.ts.map +1 -0
- package/dist/richtext/escape.js +47 -0
- package/dist/richtext/index.d.ts +8 -0
- package/dist/richtext/index.d.ts.map +1 -0
- package/dist/richtext/index.js +9 -0
- package/dist/richtext/plain-text.d.ts +7 -0
- package/dist/richtext/plain-text.d.ts.map +1 -0
- package/dist/richtext/plain-text.js +78 -0
- package/dist/richtext/render.d.ts +12 -0
- package/dist/richtext/render.d.ts.map +1 -0
- package/dist/richtext/render.js +194 -0
- package/dist/richtext/types.d.ts +24 -0
- package/dist/richtext/types.d.ts.map +1 -0
- package/dist/richtext/types.js +3 -0
- package/dist/server/client.d.ts +5 -0
- package/dist/server/client.d.ts.map +1 -0
- package/dist/server/client.js +66 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +3 -0
- package/dist/types.d.ts +99 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/webhooks/index.d.ts +27 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/index.js +87 -0
- package/package.json +49 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.float16.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/@types/react/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/react/index.d.ts","../../../node_modules/@types/react/jsx-runtime.d.ts","../src/types.ts","../src/http.ts","../src/query-builder.ts","../src/webhooks/index.ts","../src/index.ts","../src/browser/client.ts","../src/browser/index.ts","../src/richtext/escape.ts","../src/richtext/types.ts","../src/richtext/render.ts","../src/richtext/plain-text.ts","../src/richtext/index.ts","../src/server/client.ts","../src/server/index.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/compatibility/iterators.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.typedarray.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/buffer.buffer.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/globals.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/web-globals/abortcontroller.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/web-globals/crypto.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/web-globals/domexception.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/web-globals/events.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/utility.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/header.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/readable.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/fetch.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/formdata.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/connector.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/client-stats.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/client.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/errors.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/global-origin.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/pool-stats.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/pool.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/handlers.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/round-robin-pool.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/h2c-client.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/agent.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/mock-call-history.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/mock-agent.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/mock-client.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/mock-pool.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/snapshot-agent.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/mock-errors.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/retry-handler.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/retry-agent.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/api.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/cache-interceptor.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/interceptors.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/util.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/cookies.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/patch.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/websocket.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/eventsource.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/content-type.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/cache.d.ts","../../../node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/index.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/web-globals/fetch.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/web-globals/navigator.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/web-globals/storage.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/web-globals/streams.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/assert.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/assert/strict.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/async_hooks.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/buffer.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/child_process.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/cluster.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/console.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/constants.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/crypto.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/dgram.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/dns.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/dns/promises.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/domain.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/events.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/fs.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/fs/promises.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/http.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/http2.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/https.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/inspector.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/inspector.generated.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/module.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/net.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/os.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/path.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/process.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/punycode.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/querystring.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/readline.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/readline/promises.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/repl.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/sea.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/sqlite.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/stream.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/stream/promises.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/stream/web.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/string_decoder.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/test.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/timers.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/timers/promises.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/tls.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/trace_events.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/tty.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/url.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/util.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/v8.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/vm.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/wasi.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/worker_threads.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/zlib.d.ts","../../../node_modules/.pnpm/@types+node@24.13.2/node_modules/@types/node/index.d.ts"],"fileIdsList":[[81,133,134,136,153,154],[81,135,136,153,154],[136,153,154],[81,136,141,153,154,171],[81,136,137,142,147,153,154,156,168,179],[81,136,137,138,147,153,154,156],[81,136,153,154],[81,136,139,153,154,180],[81,136,140,141,148,153,154,157],[81,136,141,153,154,168,176],[81,136,142,144,147,153,154,156],[81,135,136,143,153,154],[81,136,144,145,153,154],[81,136,146,147,153,154],[81,135,136,147,153,154],[81,136,147,148,149,153,154,168,179],[81,136,147,148,149,153,154,163,168,171],[81,128,136,144,147,150,153,154,156,168,179],[81,136,147,148,150,151,153,154,156,168,176,179],[81,136,150,152,153,154,168,176,179],[79,80,81,82,83,84,85,86,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185],[81,136,147,153,154],[81,136,153,154,155,179],[81,136,144,147,153,154,156,168],[81,136,153,154,157],[81,136,153,154,158],[81,135,136,153,154,159],[81,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185],[81,136,153,154,161],[81,136,153,154,162],[81,136,147,153,154,163,164],[81,136,153,154,163,165,180,182],[81,136,148,153,154],[81,136,147,153,154,168,169,171],[81,136,153,154,170,171],[81,136,153,154,168,169],[81,136,153,154,171],[81,136,153,154,172],[81,133,136,153,154,168,173,179],[81,136,147,153,154,174,175],[81,136,153,154,174,175],[81,136,141,153,154,156,168,176],[81,136,153,154,177],[81,136,153,154,156,178],[81,136,150,153,154,162,179],[81,136,141,153,154,180],[81,136,153,154,168,181],[81,136,153,154,155,182],[81,136,153,154,183],[81,136,141,153,154],[81,128,136,153,154],[81,136,153,154,184],[81,128,136,147,149,153,154,159,168,171,179,181,182,184],[81,136,153,154,168,185],[81,93,96,99,100,136,153,154,179],[81,96,136,153,154,168,179],[81,96,100,136,153,154,179],[81,136,153,154,168],[81,90,136,153,154],[81,94,136,153,154],[81,92,93,96,136,153,154,179],[81,136,153,154,156,176],[81,136,153,154,186],[81,90,136,153,154,186],[81,92,96,136,153,154,156,179],[81,87,88,89,91,95,136,147,153,154,168,179],[81,96,105,113,136,153,154],[81,88,94,136,153,154],[81,96,122,123,136,153,154],[81,88,91,96,136,153,154,171,179,186],[81,96,136,153,154],[81,92,96,136,153,154,179],[81,87,136,153,154],[81,90,91,92,94,95,96,97,98,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,123,124,125,126,127,136,153,154],[81,96,115,118,136,144,153,154],[81,96,105,106,107,136,153,154],[81,94,96,106,108,136,153,154],[81,95,136,153,154],[81,88,90,96,136,153,154],[81,96,100,106,108,136,153,154],[81,100,136,153,154],[81,94,96,99,136,153,154,179],[81,88,92,96,105,136,153,154],[81,96,115,136,153,154],[81,108,136,153,154],[81,90,96,122,136,153,154,171,184,186],[61,62,81,136,153,154],[63,81,136,153,154],[64,65,66,67,81,136,153,154],[64,65,70,81,136,153,154],[64,65,81,136,153,154],[64,65,67,68,81,136,153,154],[64,81,136,153,154],[64,72,73,74,75,81,136,153,154],[64,73,74,81,136,153,154],[64,72,73,81,136,153,154],[64,65,77,81,136,153,154]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"196cb558a13d4533a5163286f30b0509ce0210e4b316c56c38d4c0fd2fb38405","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"7e29f41b158de217f94cb9676bf9cbd0cd9b5a46e1985141ed36e075c52bf6ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac51dd7d31333793807a6abaa5ae168512b6131bd41d9c5b98477fc3b7800f9f","impliedFormat":1},{"version":"dc0a7f107690ee5cd8afc8dbf05c4df78085471ce16bdd9881642ec738bc81fe","impliedFormat":1},{"version":"42c169fb8c2d42f4f668c624a9a11e719d5d07dacbebb63cbcf7ef365b0a75b3","impliedFormat":1},{"version":"97a9c752cd4049041057ed8024199a230262155106431256799778b118ceb260","signature":"b5f6bd1f4adbb04a9e83b71ec8b95c75918ceb2c1ea3665fc8047f57a81cd3f2","impliedFormat":99},{"version":"8afa86b37669c61fd1dea743134b0cc7e2b586d1a9d32d4d5a4b20798a3e7c1f","signature":"29973504172d2c779063bdee14e67fbb5f305327a0713c8c4c4acd8c2b538610","impliedFormat":99},{"version":"5c11d1ed97308404d69a05bc0e574da6cd174cf8f3f227770156e07422abf1c1","signature":"afdffd445a1c1b1e8962e3e454790c19c9d8538b6d5690204b062418e5e836c0","impliedFormat":99},{"version":"d13e21e5bdbbc3c874ef97ef470bfc5c814a94dc9b8af35010930313560d3b19","signature":"da2b86cd3b858db2eed6080ef0702406acdbce77d87db599f0bac9895bf39e4e","impliedFormat":99},{"version":"414c6eea8e9be172d9c2f05113d0c8d1dfad19063dc61a927b8349ce730c3a17","signature":"b5ac9eb0691b3ca93bfc4a4ce5aa368cbcde0cc53f50ccb4bc460f0bc4562e1f","impliedFormat":99},{"version":"dd7b14b5a093e23828a6aa9a1b62fc7bb70ab06cd5855a2adc2e22a5484a26a2","signature":"1d66aeca0e238f693479d6f05a6246eef7c68d56dabe984d49f59a4484461411","impliedFormat":99},{"version":"9748a15446970f68706e41b3398caf012b04d68297b60844607f8e83d58009a4","signature":"8203ca642a9fae1443613a3211fd2d093b579498a5487fd4636156255af881eb","impliedFormat":99},{"version":"c81215cb461b6baf722ab2b95b6115b226d478e0c887764ba6147984e552455e","signature":"30ce12bdb5685f2f51bf99f0378d27ba6a63c0542912e14675fb6c47aabe3e78","impliedFormat":99},{"version":"45f18ebdd37171250c5c071b2bf70584fcc8566c89159fe97722e10d0fb10f16","signature":"e58383679e063e6168c53ea7926b64afc4729a93462359fe85eea329dd89bada","impliedFormat":99},{"version":"ef59f9fbfa87ab40495cb6b788db775ff529e6ea73aea9e72f70fee00748f810","signature":"437af1ee4d474b3e69b9c076d995ec89d6729941d04a6a3e7a97b42f63916f10","impliedFormat":99},{"version":"5ea354c28ee54722bd0ac492c4228708b43a776edad600e669ee493e5f4599ac","signature":"7f41ba4babb4946976eba7dd0f74940e8add152c8a14858583270a7d383b7d0e","impliedFormat":99},{"version":"2ccb9f51885a1b275559f059c4e9e1f6c87931300e77e786bd1f519fe072f10c","signature":"b4e08301bfb10facf1203836440c8cc57e032a4631d3a1a48adc7208cc162a07","impliedFormat":99},{"version":"48c28eb300c4a8e7e7c2f9f4b72fee1f353ef1f93b2271ffdda5f5e4159b923d","signature":"439d35b3d53f68dbb7f1da9b713d1d29bec3c2dbb068ce4f07d81fe2a140bf1c","impliedFormat":99},{"version":"884944512d4124cce92d9589e4f7e7a36ceb3669d1e394aeb4032cb79ca25206","signature":"fc0117ad1211b41c9b4f3482f7993e9719472f5f67df4c8a592eb4659780a2c9","impliedFormat":99},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"378281aa35786c27d5811af7e6bcaa492eebd0c7013d48137c35bbc69a2b9751","affectsGlobalScope":true,"impliedFormat":1},{"version":"3af97acf03cc97de58a3a4bc91f8f616408099bc4233f6d0852e72a8ffb91ac9","affectsGlobalScope":true,"impliedFormat":1},{"version":"1b2dd1cbeb0cc6ae20795958ba5950395ebb2849b7c8326853dd15530c77ab0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1db0b7dca579049ca4193d034d835f6bfe73096c73663e5ef9a0b5779939f3d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"387a023d363f755eb63450a66c28b14cdd7bc30a104565e2dbf0a8988bb4a56c","affectsGlobalScope":true,"impliedFormat":1},{"version":"9798340ffb0d067d69b1ae5b32faa17ab31b82466a3fc00d8f2f2df0c8554aaa","affectsGlobalScope":true,"impliedFormat":1},{"version":"f26b11d8d8e4b8028f1c7d618b22274c892e4b0ef5b3678a8ccbad85419aef43","affectsGlobalScope":true,"impliedFormat":1},{"version":"cdcf9ea426ad970f96ac930cd176d5c69c6c24eebd9fc580e1572d6c6a88f62c","impliedFormat":1},{"version":"23cd712e2ce083d68afe69224587438e5914b457b8acf87073c22494d706a3d0","impliedFormat":1},{"version":"156a859e21ef3244d13afeeba4e49760a6afa035c149dda52f0c45ea8903b338","impliedFormat":1},{"version":"10ec5e82144dfac6f04fa5d1d6c11763b3e4dbbac6d99101427219ab3e2ae887","impliedFormat":1},{"version":"615754924717c0b1e293e083b83503c0a872717ad5aa60ed7f1a699eb1b4ea5c","impliedFormat":1},{"version":"074de5b2fdead0165a2757e3aaef20f27a6347b1c36adea27d51456795b37682","impliedFormat":1},{"version":"68834d631c8838c715f225509cfc3927913b9cc7a4870460b5b60c8dbdb99baf","impliedFormat":1},{"version":"24371e69a38fc33e268d4a8716dbcda430d6c2c414a99ff9669239c4b8f40dea","impliedFormat":1},{"version":"ccab02f3920fc75c01174c47fcf67882a11daf16baf9e81701d0a94636e94556","impliedFormat":1},{"version":"3e11fce78ad8c0e1d1db4ba5f0652285509be3acdd519529bc8fcef85f7dafd9","impliedFormat":1},{"version":"ea6bc8de8b59f90a7a3960005fd01988f98fd0784e14bc6922dde2e93305ec7d","impliedFormat":1},{"version":"36107995674b29284a115e21a0618c4c2751b32a8766dd4cb3ba740308b16d59","impliedFormat":1},{"version":"914a0ae30d96d71915fc519ccb4efbf2b62c0ddfb3a3fc6129151076bc01dc60","impliedFormat":1},{"version":"9c32412007b5662fd34a8eb04292fb5314ec370d7016d1c2fb8aa193c807fe22","impliedFormat":1},{"version":"7fd1b31fd35876b0aa650811c25ec2c97a3c6387e5473eb18004bed86cdd76b6","impliedFormat":1},{"version":"4d327f7d72ad0918275cea3eee49a6a8dc8114ae1d5b7f3f5d0774de75f7439a","impliedFormat":1},{"version":"6ebe8ebb8659aaa9d1acbf3710d7dae3e923e97610238b9511c25dc39023a166","impliedFormat":1},{"version":"e85d7f8068f6a26710bff0cc8c0fc5e47f71089c3780fbede05857331d2ddec9","impliedFormat":1},{"version":"7befaf0e76b5671be1d47b77fcc65f2b0aad91cc26529df1904f4a7c46d216e9","impliedFormat":1},{"version":"0a60a292b89ca7218b8616f78e5bbd1c96b87e048849469cccb4355e98af959a","impliedFormat":1},{"version":"0b6e25234b4eec6ed96ab138d96eb70b135690d7dd01f3dd8a8ab291c35a683a","impliedFormat":1},{"version":"9666f2f84b985b62400d2e5ab0adae9ff44de9b2a34803c2c5bd3c8325b17dc0","impliedFormat":1},{"version":"40cd35c95e9cf22cfa5bd84e96408b6fcbca55295f4ff822390abb11afbc3dca","impliedFormat":1},{"version":"b1616b8959bf557feb16369c6124a97a0e74ed6f49d1df73bb4b9ddf68acf3f3","impliedFormat":1},{"version":"5b03a034c72146b61573aab280f295b015b9168470f2df05f6080a2122f9b4df","impliedFormat":1},{"version":"40b463c6766ca1b689bfcc46d26b5e295954f32ad43e37ee6953c0a677e4ae2b","impliedFormat":1},{"version":"249b9cab7f5d628b71308c7d9bb0a808b50b091e640ba3ed6e2d0516f4a8d91d","impliedFormat":1},{"version":"80aae6afc67faa5ac0b32b5b8bc8cc9f7fa299cff15cf09cc2e11fd28c6ae29e","impliedFormat":1},{"version":"f473cd2288991ff3221165dcf73cd5d24da30391f87e85b3dd4d0450c787a391","impliedFormat":1},{"version":"499e5b055a5aba1e1998f7311a6c441a369831c70905cc565ceac93c28083d53","impliedFormat":1},{"version":"8aee8b6d4f9f62cf3776cda1305fb18763e2aade7e13cea5bbe699112df85214","impliedFormat":1},{"version":"c63b9ada8c72f95aac5db92aea07e5e87ec810353cdf63b2d78f49a58662cf6c","impliedFormat":1},{"version":"1cc2a09e1a61a5222d4174ab358a9f9de5e906afe79dbf7363d871a7edda3955","impliedFormat":1},{"version":"5d0375ca7310efb77e3ef18d068d53784faf62705e0ad04569597ae0e755c401","impliedFormat":1},{"version":"59af37caec41ecf7b2e76059c9672a49e682c1a2aa6f9d7dc78878f53aa284d6","impliedFormat":1},{"version":"addf417b9eb3f938fddf8d81e96393a165e4be0d4a8b6402292f9c634b1cb00d","impliedFormat":1},{"version":"b64d4d1c5f877f9c666e98e833f0205edb9384acc46e98a1fef344f64d6aba44","impliedFormat":1},{"version":"adf27937dba6af9f08a68c5b1d3fce0ca7d4b960c57e6d6c844e7d1a8e53adae","impliedFormat":1},{"version":"12950411eeab8563b349cb7959543d92d8d02c289ed893d78499a19becb5a8cc","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"c9381908473a1c92cb8c516b184e75f4d226dad95c3a85a5af35f670064d9a2f","impliedFormat":1},{"version":"f724236417941ea77ec8d38c6b7021f5fb7f8521c7f8c1538e87661f2c6a0774","affectsGlobalScope":true,"impliedFormat":1},{"version":"1cf059eaf468efcc649f8cf6075d3cb98e9a35a0fe9c44419ec3d2f5428d7123","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7721c4f69f93c91360c26a0a84ee885997d748237ef78ef665b153e622b36c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d97fb21da858fb18b8ae72c314e9743fd52f73ebe2764e12af1db32fc03f853f","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ea15fd99b2e34cb25fe8346c955000bb70c8b423ae4377a972ef46bfb37f595","impliedFormat":1},{"version":"7cf69dd5502c41644c9e5106210b5da7144800670cbe861f66726fa209e231c4","impliedFormat":1},{"version":"72c1f5e0a28e473026074817561d1bc9647909cf253c8d56c41d1df8d95b85f7","impliedFormat":1},{"version":"f9b4137a0d285bd77dba2e6e895530112264310ae47e07bf311feae428fb8b61","affectsGlobalScope":true,"impliedFormat":1},{"version":"c06b2652ffeb89afd0f1c52c165ced77032f9cd09bc481153fbd6b5504c69494","impliedFormat":1},{"version":"51aecd2df90a3cffea1eb4696b33b2d78594ea2aa2138e6b9471ec4841c6c2ee","impliedFormat":1},{"version":"9d8f9e63e29a3396285620908e7f14d874d066caea747dc4b2c378f0599166b4","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"612422d5ba6b4a5c4537f423e9199645468ad80a689801da63ab7edb43f7b835","impliedFormat":1},{"version":"db9ada976f9e52e13f7ae8b9a320f4b67b87685938c5879187d8864b2fbe97f3","impliedFormat":1},{"version":"9f39e70a354d0fba29ac3cdf6eca00b7f9e96f64b2b2780c432e8ea27f133743","impliedFormat":1},{"version":"0dace96cc0f7bc6d0ee2044921bdf19fe42d16284dbcc8ae200800d1c9579335","impliedFormat":1},{"version":"a2e2bbde231b65c53c764c12313897ffdfb6c49183dd31823ee2405f2f7b5378","impliedFormat":1},{"version":"1cbdcdef62bf42688e5d825898c3a59458466c48ad8a4ef3f88d8a1cd04310d6","impliedFormat":1},{"version":"c64e1888baaa3253ca4405b455e4bf44f76357868a1bd0a52998ade9a092ad78","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc8c6f5322961b56d9906601b20798725df60baeab45ec014fba9f795d5596fd","impliedFormat":1},{"version":"0904660ae854e6d41f6ff25356db1d654436c6305b0f0aa89d1532df0253486e","impliedFormat":1},{"version":"060d305fe4494d8cb2b99d620928d369d1ee55c1645f5e729a2aca07d0f108cb","impliedFormat":1},{"version":"5b22bf96be06fca1e134e3a85351ffe7aa2edf0c9a5bd175b7239ee48186dbf5","impliedFormat":1},{"version":"0c50296ee73dae94efc3f0da4936b1146ca6ce2217acfabb44c19c9a33fa30e5","impliedFormat":1},{"version":"bbf42f98a5819f4f06e18c8b669a994afe9a17fe520ae3454a195e6eabf7700d","impliedFormat":1},{"version":"5b48cc670da1dfe926036deaf349085caf822def460a6d50de23f1cc12a5f8cd","impliedFormat":1},{"version":"418f34087d52d001e2688a6282a5de9bf583ff771ed5546af0ae36e4f60a458b","affectsGlobalScope":true,"impliedFormat":1},{"version":"036c9a03b01281f99f8251fdc7088e894566be44b3f139a9d48501a978b611df","impliedFormat":1},{"version":"ff65b8a8bd380c6d129becc35de02f7c29ad7ce03300331ca91311fb4044d1a9","impliedFormat":1},{"version":"04bf1aa481d1adfb16d93d76e44ce71c51c8ef68039d849926551199489637f6","impliedFormat":1},{"version":"2c9adcc85574b002c9a6311ff2141055769e0071856ec979d92ff989042b1f1b","affectsGlobalScope":true,"impliedFormat":1},{"version":"1569ad5969ae0de6ad0bdfaaab0dabcd8878bc3147ab096206eed2019bb84e7f","affectsGlobalScope":true,"impliedFormat":1},{"version":"a58a15da4c5ba3df60c910a043281256fa52d36a0fcdef9b9100c646282e88dd","impliedFormat":1},{"version":"b36beffbf8acdc3ebc58c8bb4b75574b31a2169869c70fc03f82895b93950a12","impliedFormat":1},{"version":"42a350ce4f6f291198dc89833afcc4fd078248b4e1fdc9d05c846c66a670f710","impliedFormat":1},{"version":"77fbe5eecb6fac4b6242bbf6eebfc43e98ce5ccba8fa44e0ef6a95c945ff4d98","impliedFormat":1},{"version":"8c81fd4a110490c43d7c578e8c6f69b3af01717189196899a6a44f93daa57a3a","impliedFormat":1},{"version":"5fb39858b2459864b139950a09adae4f38dad87c25bf572ce414f10e4bd7baab","impliedFormat":1},{"version":"b03754211d839cdc48979996525a32eb62130682c2f9801dfc2f25533ce7238d","impliedFormat":1},{"version":"3910dab597c40e173bf0e0d419d3ce9682c54ebf6ae84849f9b829b1451a17ec","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"45650f47bfb376c8a8ed39d4bcda5902ab899a3150029684ee4c10676d9fbaee","impliedFormat":1},{"version":"486c074a5c0f2254345c0d1c9540380f5463999e42d7e1a159305ea823d3c4b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"c119835edf36415081dfd9ed15fc0cd37aaa28d232be029ad073f15f3d88c323","impliedFormat":1},{"version":"f4d99ac08c4097a3cc202bec2c7198c19dcdd80d4ec6c62d1356b10d03b119d5","impliedFormat":1},{"version":"9705cd157ffbb91c5cab48bdd2de5a437a372e63f870f8a8472e72ff634d47c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"ae86f30d5d10e4f75ce8dcb6e1bd3a12ecec3d071a21e8f462c5c85c678efb41","impliedFormat":1},{"version":"ca77e83162eccec633513723d178d4203bdd5465297267696be08013bab0aa1d","impliedFormat":1},{"version":"e03460fe72b259f6d25ad029f085e4bedc3f90477da4401d8fbc1efa9793230e","impliedFormat":1},{"version":"4286a3a6619514fca656089aee160bb6f2e77f4dd53dc5a96b26a0b4fc778055","impliedFormat":1},{"version":"f61c153d5abbe4381a1fba0d41be0babdd5de51c626ee7ff14cede14dedc33f1","affectsGlobalScope":true,"impliedFormat":1},{"version":"7803171d745ab18e77f16bf82e742268ff72b7f7382ab191e4277527580c2d89","affectsGlobalScope":true,"impliedFormat":1},{"version":"0e9ba65cd3d6d194bdda7343f9f2917f7144ead96a924ca58d1a14919992dc20","impliedFormat":1},{"version":"255d948f87f24ffd57bcb2fdf95792fd418a2e1f712a98cf2cce88744d75085c","impliedFormat":1},{"version":"0d5b085f36e6dc55bc6332ecb9c733be3a534958c238fb8d8d18d4a2b6f2a15a","impliedFormat":1},{"version":"0b0dfb2d3e8420ead06f6a11acfb02ddcec42257e6ce391993e895ba0af86de4","affectsGlobalScope":true,"impliedFormat":1},{"version":"bfd3b3c21a56104693183942e221c1896ee23bcb8f8d91ab0b941f7b32985411","impliedFormat":1},{"version":"d7e9ab1b0996639047c61c1e62f85c620e4382206b3abb430d9a21fb7bc23c77","impliedFormat":1}],"root":[[65,78]],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationMap":true,"esModuleInterop":true,"jsx":4,"module":199,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":true,"target":99,"tsBuildInfoFile":"./.tsbuildinfo"},"referencedMap":[[133,1],[134,1],[135,2],[81,3],[136,4],[137,5],[138,6],[79,7],[139,8],[140,9],[141,10],[142,11],[143,12],[144,13],[145,13],[146,14],[147,15],[148,16],[149,17],[82,7],[80,7],[150,18],[151,19],[152,20],[186,21],[153,22],[154,7],[155,23],[156,24],[157,25],[158,26],[159,27],[160,28],[161,29],[162,30],[163,31],[164,31],[165,32],[166,7],[167,33],[168,34],[170,35],[169,36],[171,37],[172,38],[173,39],[174,40],[175,41],[176,42],[177,43],[178,44],[179,45],[180,46],[181,47],[182,48],[183,49],[83,7],[84,50],[85,7],[86,7],[129,51],[130,52],[131,7],[132,37],[184,53],[185,54],[59,7],[60,7],[10,7],[12,7],[11,7],[2,7],[13,7],[14,7],[15,7],[16,7],[17,7],[18,7],[19,7],[20,7],[3,7],[21,7],[22,7],[4,7],[23,7],[27,7],[24,7],[25,7],[26,7],[28,7],[29,7],[30,7],[5,7],[31,7],[32,7],[33,7],[34,7],[6,7],[38,7],[35,7],[36,7],[37,7],[39,7],[7,7],[40,7],[45,7],[46,7],[41,7],[42,7],[43,7],[44,7],[8,7],[50,7],[47,7],[48,7],[49,7],[51,7],[9,7],[52,7],[53,7],[54,7],[56,7],[55,7],[1,7],[57,7],[58,7],[105,55],[117,56],[102,57],[118,58],[127,59],[93,60],[94,61],[92,62],[126,63],[121,64],[125,65],[96,66],[114,67],[95,68],[124,69],[90,70],[91,64],[97,71],[98,7],[104,72],[101,71],[88,73],[128,74],[119,75],[108,76],[107,71],[109,77],[112,78],[106,79],[110,80],[122,63],[99,81],[100,82],[113,83],[89,58],[116,84],[115,71],[103,82],[111,85],[120,7],[87,7],[123,86],[61,7],[63,87],[64,88],[62,7],[70,89],[71,90],[66,91],[69,92],[67,91],[72,93],[76,94],[75,95],[74,96],[73,93],[77,89],[78,97],[65,93],[68,93]],"latestChangedDtsFile":"./types.d.ts","version":"5.9.3"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BeechBrowserClient, BeechClientConfig } from '../types.js';
|
|
2
|
+
export declare function createBeechBrowserClient<TRegistry = Record<string, unknown>>(config: BeechClientConfig): BeechBrowserClient<TRegistry>;
|
|
3
|
+
/** Alias for createBeechBrowserClient */
|
|
4
|
+
export declare const createBeechClient: typeof createBeechBrowserClient;
|
|
5
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/browser/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAA+B,MAAM,aAAa,CAAA;AAIrG,wBAAgB,wBAAwB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1E,MAAM,EAAE,iBAAiB,GACxB,kBAAkB,CAAC,SAAS,CAAC,CAoB/B;AAED,yCAAyC;AACzC,eAAO,MAAM,iBAAiB,iCAA2B,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
import { buildSearchParams } from '../query-builder.js';
|
|
4
|
+
import { request, validateClientConfig } from '../http.js';
|
|
5
|
+
export function createBeechBrowserClient(config) {
|
|
6
|
+
validateClientConfig(config);
|
|
7
|
+
return {
|
|
8
|
+
content(seed) {
|
|
9
|
+
const enc = encodeURIComponent(seed);
|
|
10
|
+
return {
|
|
11
|
+
list: (q, options) => request(config, 'GET', `/${enc}`, {
|
|
12
|
+
params: buildSearchParams(q),
|
|
13
|
+
options,
|
|
14
|
+
}),
|
|
15
|
+
get: (sel, options) => {
|
|
16
|
+
const p = new URLSearchParams('id' in sel ? { id: sel.id } : { slug: sel.slug });
|
|
17
|
+
return request(config, 'GET', `/${enc}`, { params: p, options });
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** Alias for createBeechBrowserClient */
|
|
24
|
+
export const createBeechClient = createBeechBrowserClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACzE,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BeechClientConfig, BeechResult, ListQuery, ListMeta } from './types.js';
|
|
2
|
+
export type Listable<TRow> = {
|
|
3
|
+
data: TRow[];
|
|
4
|
+
meta: ListMeta;
|
|
5
|
+
};
|
|
6
|
+
export type Single<TRow> = {
|
|
7
|
+
data: TRow;
|
|
8
|
+
meta: {
|
|
9
|
+
seed: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export interface ContentResource<TRow> {
|
|
13
|
+
list(query?: ListQuery<TRow>): Promise<BeechResult<Listable<TRow>>>;
|
|
14
|
+
get(selector: {
|
|
15
|
+
id: string;
|
|
16
|
+
} | {
|
|
17
|
+
slug: string;
|
|
18
|
+
}): Promise<BeechResult<Single<TRow>>>;
|
|
19
|
+
create(input: Partial<TRow>): Promise<BeechResult<Single<TRow>>>;
|
|
20
|
+
update(id: string, input: Partial<TRow>): Promise<BeechResult<Single<TRow>>>;
|
|
21
|
+
}
|
|
22
|
+
export interface BeechClient<TRegistry> {
|
|
23
|
+
content<K extends keyof TRegistry & string>(seed: K): ContentResource<TRegistry[K]>;
|
|
24
|
+
}
|
|
25
|
+
export declare function createBeechClient<TRegistry = Record<string, unknown>>(config: BeechClientConfig): BeechClient<TRegistry>;
|
|
26
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAIrF,MAAM,MAAM,QAAQ,CAAC,IAAI,IAAI;IAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAA;AAC7D,MAAM,MAAM,MAAM,CAAC,IAAI,IAAM;IAAE,IAAI,EAAE,IAAI,CAAC;IAAG,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAA;AAErE,MAAM,WAAW,eAAe,CAAC,IAAI;IACnC,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnE,GAAG,CAAC,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACpF,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAChE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;CAC7E;AAED,MAAM,WAAW,WAAW,CAAC,SAAS;IACpC,OAAO,CAAC,CAAC,SAAS,MAAM,SAAS,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;CACpF;AAED,wBAAgB,iBAAiB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnE,MAAM,EAAE,iBAAiB,GACxB,WAAW,CAAC,SAAS,CAAC,CAkBxB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
import { buildSearchParams } from './query-builder.js';
|
|
4
|
+
import { request } from './http.js';
|
|
5
|
+
export function createBeechClient(config) {
|
|
6
|
+
return {
|
|
7
|
+
content(seed) {
|
|
8
|
+
const enc = encodeURIComponent(seed);
|
|
9
|
+
return {
|
|
10
|
+
list: (q) => request(config, 'GET', `/${enc}`, { params: buildSearchParams(q) }),
|
|
11
|
+
get: (sel) => {
|
|
12
|
+
const p = new URLSearchParams('id' in sel ? { id: sel.id } : { slug: sel.slug });
|
|
13
|
+
return request(config, 'GET', `/${enc}`, { params: p });
|
|
14
|
+
},
|
|
15
|
+
create: (input) => request(config, 'POST', `/${enc}/add`, { body: input }),
|
|
16
|
+
update: (id, input) => request(config, 'PUT', `/${enc}/edit/${encodeURIComponent(id)}`, { body: input }),
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BeechClientConfig, BeechResult, RequestOptions } from './types.js';
|
|
2
|
+
export declare function validateClientConfig(config: BeechClientConfig): void;
|
|
3
|
+
export declare function request<T>(cfg: BeechClientConfig, method: string, path: string, opts?: {
|
|
4
|
+
params?: URLSearchParams;
|
|
5
|
+
body?: unknown;
|
|
6
|
+
options?: RequestOptions;
|
|
7
|
+
}): Promise<BeechResult<T>>;
|
|
8
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAgB,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE9F,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAUpE;AAED,wBAAsB,OAAO,CAAC,CAAC,EAC7B,GAAG,EAAE,iBAAiB,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,eAAe,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAO,GAChF,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAwCzB"}
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
export function validateClientConfig(config) {
|
|
4
|
+
if (!config || typeof config !== 'object') {
|
|
5
|
+
throw new TypeError('Configuration object is required');
|
|
6
|
+
}
|
|
7
|
+
if (!config.baseUrl || typeof config.baseUrl !== 'string' || !config.baseUrl.trim()) {
|
|
8
|
+
throw new Error('baseUrl is required and must be a non-empty string');
|
|
9
|
+
}
|
|
10
|
+
if (!config.apiKey || typeof config.apiKey !== 'string' || !config.apiKey.trim()) {
|
|
11
|
+
throw new Error('apiKey is required and must be a non-empty string');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export async function request(cfg, method, path, opts = {}) {
|
|
15
|
+
const doFetch = cfg.fetch ?? fetch;
|
|
16
|
+
const base = cfg.baseUrl.replace(/\/+$/, '');
|
|
17
|
+
const qs = opts.params && opts.params.size ? `?${opts.params}` : '';
|
|
18
|
+
const url = `${base}/api/v1/public${path}${qs}`;
|
|
19
|
+
const headers = new Headers(cfg.headers);
|
|
20
|
+
headers.set('X-API-Key', cfg.apiKey);
|
|
21
|
+
if (opts.body !== undefined) {
|
|
22
|
+
headers.set('Content-Type', 'application/json');
|
|
23
|
+
}
|
|
24
|
+
if (opts.options?.headers) {
|
|
25
|
+
const extraHeaders = new Headers(opts.options.headers);
|
|
26
|
+
extraHeaders.forEach((val, key) => headers.set(key, val));
|
|
27
|
+
}
|
|
28
|
+
const { headers: _, ...forwardOptions } = opts.options ?? {};
|
|
29
|
+
let res;
|
|
30
|
+
try {
|
|
31
|
+
res = await doFetch(url, {
|
|
32
|
+
...forwardOptions,
|
|
33
|
+
method,
|
|
34
|
+
headers,
|
|
35
|
+
body: opts.body !== undefined ? JSON.stringify(opts.body) : undefined,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
return { data: null, error: networkProblem(e) };
|
|
40
|
+
}
|
|
41
|
+
const ct = res.headers.get('Content-Type') ?? '';
|
|
42
|
+
const payload = ct.includes('json') ? await res.json().catch(() => null) : null;
|
|
43
|
+
if (!res.ok) {
|
|
44
|
+
return { data: null, error: normalizeProblem(res.status, payload, res.statusText) };
|
|
45
|
+
}
|
|
46
|
+
return { data: payload, error: null };
|
|
47
|
+
}
|
|
48
|
+
function networkProblem(e) {
|
|
49
|
+
return {
|
|
50
|
+
type: 'about:blank',
|
|
51
|
+
title: 'Network Error',
|
|
52
|
+
status: 0,
|
|
53
|
+
detail: e instanceof Error ? e.message : 'fetch failed',
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function normalizeProblem(status, payload, statusText) {
|
|
57
|
+
if (payload && typeof payload === 'object') {
|
|
58
|
+
const p = payload;
|
|
59
|
+
return {
|
|
60
|
+
type: typeof p.type === 'string' ? p.type : 'about:blank',
|
|
61
|
+
title: typeof p.title === 'string' ? p.title : (statusText || 'HTTP Error'),
|
|
62
|
+
status: typeof p.status === 'number' ? p.status : status,
|
|
63
|
+
detail: typeof p.detail === 'string' ? p.detail : `Request failed with status ${status}`,
|
|
64
|
+
...(typeof p.instance === 'string' ? { instance: p.instance } : {}),
|
|
65
|
+
...(Array.isArray(p.errors) ? { errors: p.errors } : {}),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
type: 'about:blank',
|
|
70
|
+
title: statusText || 'HTTP Error',
|
|
71
|
+
status,
|
|
72
|
+
detail: typeof payload === 'string' && payload.trim() ? payload : `Request failed with status ${status}`,
|
|
73
|
+
};
|
|
74
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { buildSearchParams } from './query-builder.js';
|
|
2
|
+
export type { BeechClientConfig, RequestOptions, BeechResult, BeechProblem, BeechFilterOperator, FieldFilter, ListQuery, ListMeta, Listable, Single, BrowserContentResource, BeechBrowserClient, ServerContentResource, BeechServerClient, } from './types.js';
|
|
3
|
+
export { BEECH_SIGNATURE_HEADER, WebhookVerificationError, verifyBeechWebhookSignature, constructWebhookEvent, } from './webhooks/index.js';
|
|
4
|
+
export type { VerifyWebhookSignatureOptions, ConstructWebhookEventOptions, } from './webhooks/index.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EACV,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,qBAAqB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
export { buildSearchParams } from './query-builder.js';
|
|
4
|
+
export { BEECH_SIGNATURE_HEADER, WebhookVerificationError, verifyBeechWebhookSignature, constructWebhookEvent, } from './webhooks/index.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ListQuery } from './types.js';
|
|
2
|
+
/** { status:'published', price:{ gt:10 } } → { where:[{field,op,value}], logic } */
|
|
3
|
+
export declare function buildSearchParams(query?: ListQuery<Record<string, unknown>>): URLSearchParams;
|
|
4
|
+
//# sourceMappingURL=query-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-builder.d.ts","sourceRoot":"","sources":["../src/query-builder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAuB,SAAS,EAAE,MAAM,YAAY,CAAA;AAOhE,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,KAAK,GAAE,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GAAG,eAAe,CAiCjG"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
const OPERATORS = new Set([
|
|
4
|
+
'eq', 'neq', 'gt', 'gte', 'lt', 'lte', 'contains', 'not_contains', 'starts_with',
|
|
5
|
+
'ends_with', 'is_empty', 'is_not_empty', 'in', 'not_in', 'has_tag', 'has_any_tag', 'has_all_tags',
|
|
6
|
+
]);
|
|
7
|
+
/** { status:'published', price:{ gt:10 } } → { where:[{field,op,value}], logic } */
|
|
8
|
+
export function buildSearchParams(query = {}) {
|
|
9
|
+
const params = new URLSearchParams();
|
|
10
|
+
if (query.filter) {
|
|
11
|
+
const where = [];
|
|
12
|
+
for (const [field, raw] of Object.entries(query.filter)) {
|
|
13
|
+
if (raw !== null && typeof raw === 'object' && !Array.isArray(raw)) {
|
|
14
|
+
for (const [op, value] of Object.entries(raw)) {
|
|
15
|
+
if (!OPERATORS.has(op)) {
|
|
16
|
+
throw new TypeError(`Invalid filter operator '${op}' on field '${field}'`);
|
|
17
|
+
}
|
|
18
|
+
where.push({ field, op: op, value });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
where.push({ field, op: 'eq', value: raw });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (where.length) {
|
|
26
|
+
params.set('filter', JSON.stringify({ logic: query.logic ?? 'AND', where }));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (query.sort) {
|
|
30
|
+
const [col, dir] = Object.entries(query.sort)[0] ?? [];
|
|
31
|
+
if (col) {
|
|
32
|
+
params.set('orderBy', col);
|
|
33
|
+
params.set('orderDir', dir ?? 'desc');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (query.search)
|
|
37
|
+
params.set('search', query.search);
|
|
38
|
+
if (query.fields?.length)
|
|
39
|
+
params.set('fields', query.fields.join(','));
|
|
40
|
+
if (typeof query.latest === 'number')
|
|
41
|
+
params.set('latest', String(query.latest));
|
|
42
|
+
if (typeof query.page === 'number')
|
|
43
|
+
params.set('page', String(query.page));
|
|
44
|
+
if (typeof query.limit === 'number')
|
|
45
|
+
params.set('limit', String(Math.min(query.limit, 100)));
|
|
46
|
+
return params;
|
|
47
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escapes special HTML characters in strings to prevent Cross-Site Scripting (XSS).
|
|
3
|
+
*/
|
|
4
|
+
export declare function escapeHtml(str: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Strips ASCII control characters (0x00-0x1F, 0x7F-0x9F except \t, \n, \r).
|
|
7
|
+
*/
|
|
8
|
+
export declare function stripControlChars(str: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Validates whether a URL is safe to render in href/src attributes.
|
|
11
|
+
* Allows safe protocols (http, https, mailto, tel) and relative paths.
|
|
12
|
+
* Blocks dangerous protocols (javascript:, data:, vbscript:) including obfuscated variants.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isSafeUrl(raw: unknown): boolean;
|
|
15
|
+
//# sourceMappingURL=escape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../src/richtext/escape.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIrD;AAID;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAW/C"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
const HTML_ESCAPE_LOOKUP = {
|
|
4
|
+
'&': '&',
|
|
5
|
+
'<': '<',
|
|
6
|
+
'>': '>',
|
|
7
|
+
'"': '"',
|
|
8
|
+
"'": ''',
|
|
9
|
+
};
|
|
10
|
+
const HTML_ESCAPE_REGEX = /[&<>"']/g;
|
|
11
|
+
/**
|
|
12
|
+
* Escapes special HTML characters in strings to prevent Cross-Site Scripting (XSS).
|
|
13
|
+
*/
|
|
14
|
+
export function escapeHtml(str) {
|
|
15
|
+
if (!str)
|
|
16
|
+
return '';
|
|
17
|
+
return str.replace(HTML_ESCAPE_REGEX, (char) => HTML_ESCAPE_LOOKUP[char] || char);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Strips ASCII control characters (0x00-0x1F, 0x7F-0x9F except \t, \n, \r).
|
|
21
|
+
*/
|
|
22
|
+
export function stripControlChars(str) {
|
|
23
|
+
if (!str)
|
|
24
|
+
return '';
|
|
25
|
+
// eslint-disable-next-line no-control-regex
|
|
26
|
+
return str.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g, '');
|
|
27
|
+
}
|
|
28
|
+
const ALLOWED_URL_PROTOCOLS = new Set(['http', 'https', 'mailto', 'tel']);
|
|
29
|
+
/**
|
|
30
|
+
* Validates whether a URL is safe to render in href/src attributes.
|
|
31
|
+
* Allows safe protocols (http, https, mailto, tel) and relative paths.
|
|
32
|
+
* Blocks dangerous protocols (javascript:, data:, vbscript:) including obfuscated variants.
|
|
33
|
+
*/
|
|
34
|
+
export function isSafeUrl(raw) {
|
|
35
|
+
if (typeof raw !== 'string')
|
|
36
|
+
return false;
|
|
37
|
+
const trimmed = raw.trim();
|
|
38
|
+
if (!trimmed)
|
|
39
|
+
return false;
|
|
40
|
+
const normalized = stripControlChars(trimmed).replace(/\s+/g, '').toLowerCase();
|
|
41
|
+
const schemeMatch = /^([a-z][a-z0-9+.-]*):/.exec(normalized);
|
|
42
|
+
if (!schemeMatch) {
|
|
43
|
+
// Relative URL, path, anchor, or query string
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return ALLOWED_URL_PROTOCOLS.has(schemeMatch[1]);
|
|
47
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { renderRichText, normalizeRichtextDocument } from './render.js';
|
|
2
|
+
export { richTextToPlainText } from './plain-text.js';
|
|
3
|
+
export { escapeHtml, stripControlChars, isSafeUrl } from './escape.js';
|
|
4
|
+
export { RICHTEXT_SCHEMA_VERSION } from './types.js';
|
|
5
|
+
export type { TipTapDoc, TipTapNode, TipTapMark, TipTapMarkType, RichtextEnvelopeV1, } from './types.js';
|
|
6
|
+
export { renderRichText as renderRichTextHtml } from './render.js';
|
|
7
|
+
export { richTextToPlainText as extractPlainText } from './plain-text.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/richtext/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AACpD,YAAY,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,GACnB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,mBAAmB,IAAI,gBAAgB,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
export { renderRichText, normalizeRichtextDocument } from './render.js';
|
|
4
|
+
export { richTextToPlainText } from './plain-text.js';
|
|
5
|
+
export { escapeHtml, stripControlChars, isSafeUrl } from './escape.js';
|
|
6
|
+
export { RICHTEXT_SCHEMA_VERSION } from './types.js';
|
|
7
|
+
// Aliases
|
|
8
|
+
export { renderRichText as renderRichTextHtml } from './render.js';
|
|
9
|
+
export { richTextToPlainText as extractPlainText } from './plain-text.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts clean, plain text from a BeechCMS TipTap RichText AST or envelope v1.
|
|
3
|
+
* Inserts whitespace separators between blocks, cleans excessive whitespace, and trims output.
|
|
4
|
+
* Returns `""` on invalid, malformed, or empty inputs.
|
|
5
|
+
*/
|
|
6
|
+
export declare function richTextToPlainText(value: unknown): string;
|
|
7
|
+
//# sourceMappingURL=plain-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plain-text.d.ts","sourceRoot":"","sources":["../../src/richtext/plain-text.ts"],"names":[],"mappings":"AAqEA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAa1D"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
import { normalizeRichtextDocument } from './render.js';
|
|
4
|
+
const BLOCK_NODE_TYPES = new Set([
|
|
5
|
+
'paragraph',
|
|
6
|
+
'heading',
|
|
7
|
+
'blockquote',
|
|
8
|
+
'codeBlock',
|
|
9
|
+
'bulletList',
|
|
10
|
+
'orderedList',
|
|
11
|
+
'listItem',
|
|
12
|
+
'table',
|
|
13
|
+
'tableRow',
|
|
14
|
+
'tableHeader',
|
|
15
|
+
'tableCell',
|
|
16
|
+
'horizontalRule',
|
|
17
|
+
]);
|
|
18
|
+
function collectText(node, chunks) {
|
|
19
|
+
if (!node || typeof node.type !== 'string')
|
|
20
|
+
return;
|
|
21
|
+
const type = node.type;
|
|
22
|
+
if (type === 'text') {
|
|
23
|
+
if (typeof node.text === 'string') {
|
|
24
|
+
chunks.push(node.text);
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (type === 'hardBreak') {
|
|
29
|
+
chunks.push('\n');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (type === 'horizontalRule') {
|
|
33
|
+
chunks.push('\n');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (type === 'inlineMath' || type === 'blockMath' || type === 'mathematics') {
|
|
37
|
+
const latex = typeof node.attrs?.latex === 'string' ? node.attrs.latex : (typeof node.text === 'string' ? node.text : '');
|
|
38
|
+
if (latex)
|
|
39
|
+
chunks.push(latex);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (type === 'image') {
|
|
43
|
+
const alt = typeof node.attrs?.alt === 'string' ? node.attrs.alt : '';
|
|
44
|
+
if (alt)
|
|
45
|
+
chunks.push(alt);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const isBlock = BLOCK_NODE_TYPES.has(type);
|
|
49
|
+
if (Array.isArray(node.content)) {
|
|
50
|
+
for (const child of node.content) {
|
|
51
|
+
collectText(child, chunks);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else if (type !== 'doc') {
|
|
55
|
+
console.warn(`[BeechCMS RichText] Unrecognized node type "${type}". Skipping node.`);
|
|
56
|
+
}
|
|
57
|
+
if (isBlock) {
|
|
58
|
+
chunks.push('\n');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Extracts clean, plain text from a BeechCMS TipTap RichText AST or envelope v1.
|
|
63
|
+
* Inserts whitespace separators between blocks, cleans excessive whitespace, and trims output.
|
|
64
|
+
* Returns `""` on invalid, malformed, or empty inputs.
|
|
65
|
+
*/
|
|
66
|
+
export function richTextToPlainText(value) {
|
|
67
|
+
const doc = normalizeRichtextDocument(value);
|
|
68
|
+
if (!doc)
|
|
69
|
+
return '';
|
|
70
|
+
const chunks = [];
|
|
71
|
+
collectText(doc, chunks);
|
|
72
|
+
return chunks
|
|
73
|
+
.join('')
|
|
74
|
+
.replace(/[ \t]+/g, ' ')
|
|
75
|
+
.replace(/\n+/g, '\n')
|
|
76
|
+
.replace(/^\s+|\s+$/g, '')
|
|
77
|
+
.trim();
|
|
78
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TipTapDoc } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes input value into a validated TipTap document object.
|
|
4
|
+
* Returns `null` for non-objects, invalid envelopes, or legacy HTML strings (drop-to-empty).
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeRichtextDocument(value: unknown): TipTapDoc | null;
|
|
7
|
+
/**
|
|
8
|
+
* Renders a BeechCMS TipTap RichText AST or envelope v1 into secure, semantic HTML.
|
|
9
|
+
* Pure, deterministic, zero external dependencies. Returns `""` on invalid/empty inputs.
|
|
10
|
+
*/
|
|
11
|
+
export declare function renderRichText(value: unknown): string;
|
|
12
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/richtext/render.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAA0B,MAAM,YAAY,CAAA;AAEnE;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAqB1E;AAqLD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIrD"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
import { escapeHtml, isSafeUrl } from './escape.js';
|
|
4
|
+
/**
|
|
5
|
+
* Normalizes input value into a validated TipTap document object.
|
|
6
|
+
* Returns `null` for non-objects, invalid envelopes, or legacy HTML strings (drop-to-empty).
|
|
7
|
+
*/
|
|
8
|
+
export function normalizeRichtextDocument(value) {
|
|
9
|
+
if (value == null || value === '' || typeof value !== 'object' || Array.isArray(value)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const obj = value;
|
|
13
|
+
// Envelope v1 unwrapping
|
|
14
|
+
if (obj.schemaVersion === 1 && typeof obj.doc === 'object' && obj.doc !== null && !Array.isArray(obj.doc)) {
|
|
15
|
+
const docObj = obj.doc;
|
|
16
|
+
if (docObj.type === 'doc') {
|
|
17
|
+
return docObj;
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
// Raw TipTap doc object
|
|
22
|
+
if (obj.type === 'doc') {
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
function renderMarks(text, marks) {
|
|
28
|
+
if (!marks || !marks.length)
|
|
29
|
+
return text;
|
|
30
|
+
let rendered = text;
|
|
31
|
+
for (const mark of marks) {
|
|
32
|
+
if (!mark || typeof mark.type !== 'string')
|
|
33
|
+
continue;
|
|
34
|
+
const type = mark.type.toLowerCase();
|
|
35
|
+
const attrs = mark.attrs || {};
|
|
36
|
+
switch (type) {
|
|
37
|
+
case 'bold':
|
|
38
|
+
case 'strong':
|
|
39
|
+
rendered = `<strong>${rendered}</strong>`;
|
|
40
|
+
break;
|
|
41
|
+
case 'italic':
|
|
42
|
+
case 'em':
|
|
43
|
+
rendered = `<em>${rendered}</em>`;
|
|
44
|
+
break;
|
|
45
|
+
case 'strike':
|
|
46
|
+
case 's':
|
|
47
|
+
rendered = `<s>${rendered}</s>`;
|
|
48
|
+
break;
|
|
49
|
+
case 'underline':
|
|
50
|
+
case 'u':
|
|
51
|
+
rendered = `<u>${rendered}</u>`;
|
|
52
|
+
break;
|
|
53
|
+
case 'code':
|
|
54
|
+
rendered = `<code>${rendered}</code>`;
|
|
55
|
+
break;
|
|
56
|
+
case 'highlight': {
|
|
57
|
+
const color = typeof attrs.color === 'string' ? attrs.color.trim() : '';
|
|
58
|
+
const style = color && !/[<>"'();]/.test(color) ? ` style="background-color: ${escapeHtml(color)};"` : '';
|
|
59
|
+
rendered = `<mark${style}>${rendered}</mark>`;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
case 'superscript':
|
|
63
|
+
rendered = `<sup>${rendered}</sup>`;
|
|
64
|
+
break;
|
|
65
|
+
case 'subscript':
|
|
66
|
+
rendered = `<sub>${rendered}</sub>`;
|
|
67
|
+
break;
|
|
68
|
+
case 'textstyle': {
|
|
69
|
+
const color = typeof attrs.color === 'string' ? attrs.color.trim() : '';
|
|
70
|
+
if (color && !/[<>"'();]/.test(color)) {
|
|
71
|
+
rendered = `<span style="color: ${escapeHtml(color)};">${rendered}</span>`;
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case 'link': {
|
|
76
|
+
const href = typeof attrs.href === 'string' ? attrs.href : '';
|
|
77
|
+
if (isSafeUrl(href)) {
|
|
78
|
+
const safeHref = escapeHtml(href);
|
|
79
|
+
const target = typeof attrs.target === 'string' && attrs.target ? ` target="${escapeHtml(attrs.target)}"` : '';
|
|
80
|
+
let rel = typeof attrs.rel === 'string' && attrs.rel ? ` rel="${escapeHtml(attrs.rel)}"` : '';
|
|
81
|
+
if (target.includes('_blank') && !rel) {
|
|
82
|
+
rel = ' rel="noopener noreferrer"';
|
|
83
|
+
}
|
|
84
|
+
rendered = `<a href="${safeHref}"${target}${rel}>${rendered}</a>`;
|
|
85
|
+
}
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
default:
|
|
89
|
+
// Ignore unrecognized mark
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return rendered;
|
|
94
|
+
}
|
|
95
|
+
function renderChildren(nodes) {
|
|
96
|
+
if (!nodes || !Array.isArray(nodes))
|
|
97
|
+
return '';
|
|
98
|
+
return nodes.map(renderNode).join('');
|
|
99
|
+
}
|
|
100
|
+
function renderNode(node) {
|
|
101
|
+
if (!node || typeof node.type !== 'string')
|
|
102
|
+
return '';
|
|
103
|
+
const type = node.type;
|
|
104
|
+
const attrs = node.attrs || {};
|
|
105
|
+
switch (type) {
|
|
106
|
+
case 'doc':
|
|
107
|
+
return renderChildren(node.content);
|
|
108
|
+
case 'paragraph': {
|
|
109
|
+
const align = typeof attrs.textAlign === 'string' ? attrs.textAlign.trim() : '';
|
|
110
|
+
const style = align && ['left', 'center', 'right', 'justify'].includes(align) ? ` style="text-align: ${align};"` : '';
|
|
111
|
+
return `<p${style}>${renderChildren(node.content)}</p>`;
|
|
112
|
+
}
|
|
113
|
+
case 'heading': {
|
|
114
|
+
const rawLevel = typeof attrs.level === 'number' ? attrs.level : 1;
|
|
115
|
+
const level = Math.min(Math.max(Math.floor(rawLevel), 1), 6);
|
|
116
|
+
const align = typeof attrs.textAlign === 'string' ? attrs.textAlign.trim() : '';
|
|
117
|
+
const style = align && ['left', 'center', 'right', 'justify'].includes(align) ? ` style="text-align: ${align};"` : '';
|
|
118
|
+
return `<h${level}${style}>${renderChildren(node.content)}</h${level}>`;
|
|
119
|
+
}
|
|
120
|
+
case 'blockquote':
|
|
121
|
+
return `<blockquote>${renderChildren(node.content)}</blockquote>`;
|
|
122
|
+
case 'codeBlock': {
|
|
123
|
+
const language = typeof attrs.language === 'string' ? attrs.language.trim() : '';
|
|
124
|
+
const langClass = language && !/[<>"']/.test(language) ? ` class="language-${escapeHtml(language)}"` : '';
|
|
125
|
+
return `<pre class="richtext-code-block"><code${langClass}>${renderChildren(node.content)}</code></pre>`;
|
|
126
|
+
}
|
|
127
|
+
case 'horizontalRule':
|
|
128
|
+
return '<hr />';
|
|
129
|
+
case 'bulletList':
|
|
130
|
+
return `<ul>${renderChildren(node.content)}</ul>`;
|
|
131
|
+
case 'taskList':
|
|
132
|
+
return `<ul class="task-list">${renderChildren(node.content)}</ul>`;
|
|
133
|
+
case 'taskItem': {
|
|
134
|
+
const checked = attrs.checked === true;
|
|
135
|
+
const checkInput = `<input type="checkbox" ${checked ? 'checked ' : ''}disabled /> `;
|
|
136
|
+
return `<li class="task-item">${checkInput}${renderChildren(node.content)}</li>`;
|
|
137
|
+
}
|
|
138
|
+
case 'orderedList': {
|
|
139
|
+
const start = typeof attrs.start === 'number' && attrs.start !== 1 ? ` start="${attrs.start}"` : '';
|
|
140
|
+
return `<ol${start}>${renderChildren(node.content)}</ol>`;
|
|
141
|
+
}
|
|
142
|
+
case 'listItem':
|
|
143
|
+
return `<li>${renderChildren(node.content)}</li>`;
|
|
144
|
+
case 'table':
|
|
145
|
+
return `<table><tbody>${renderChildren(node.content)}</tbody></table>`;
|
|
146
|
+
case 'tableRow':
|
|
147
|
+
return `<tr>${renderChildren(node.content)}</tr>`;
|
|
148
|
+
case 'tableHeader': {
|
|
149
|
+
const colspan = typeof attrs.colspan === 'number' && attrs.colspan > 1 ? ` colspan="${attrs.colspan}"` : '';
|
|
150
|
+
const rowspan = typeof attrs.rowspan === 'number' && attrs.rowspan > 1 ? ` rowspan="${attrs.rowspan}"` : '';
|
|
151
|
+
return `<th${colspan}${rowspan}>${renderChildren(node.content)}</th>`;
|
|
152
|
+
}
|
|
153
|
+
case 'tableCell': {
|
|
154
|
+
const colspan = typeof attrs.colspan === 'number' && attrs.colspan > 1 ? ` colspan="${attrs.colspan}"` : '';
|
|
155
|
+
const rowspan = typeof attrs.rowspan === 'number' && attrs.rowspan > 1 ? ` rowspan="${attrs.rowspan}"` : '';
|
|
156
|
+
return `<td${colspan}${rowspan}>${renderChildren(node.content)}</td>`;
|
|
157
|
+
}
|
|
158
|
+
case 'hardBreak':
|
|
159
|
+
return '<br />';
|
|
160
|
+
case 'text': {
|
|
161
|
+
const rawText = typeof node.text === 'string' ? node.text : '';
|
|
162
|
+
const escaped = escapeHtml(rawText);
|
|
163
|
+
return renderMarks(escaped, node.marks);
|
|
164
|
+
}
|
|
165
|
+
case 'image': {
|
|
166
|
+
const src = typeof attrs.src === 'string' ? attrs.src : '';
|
|
167
|
+
if (!isSafeUrl(src))
|
|
168
|
+
return '';
|
|
169
|
+
const safeSrc = escapeHtml(src);
|
|
170
|
+
const alt = typeof attrs.alt === 'string' && attrs.alt ? ` alt="${escapeHtml(attrs.alt)}"` : '';
|
|
171
|
+
const title = typeof attrs.title === 'string' && attrs.title ? ` title="${escapeHtml(attrs.title)}"` : '';
|
|
172
|
+
return `<img src="${safeSrc}"${alt}${title} />`;
|
|
173
|
+
}
|
|
174
|
+
case 'inlineMath':
|
|
175
|
+
case 'blockMath':
|
|
176
|
+
case 'mathematics': {
|
|
177
|
+
const latex = typeof attrs.latex === 'string' ? attrs.latex : (typeof node.text === 'string' ? node.text : '');
|
|
178
|
+
return `<span class="math-inline">${escapeHtml(latex)}</span>`;
|
|
179
|
+
}
|
|
180
|
+
default:
|
|
181
|
+
console.warn(`[BeechCMS RichText] Unrecognized node type "${type}". Skipping node.`);
|
|
182
|
+
return '';
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Renders a BeechCMS TipTap RichText AST or envelope v1 into secure, semantic HTML.
|
|
187
|
+
* Pure, deterministic, zero external dependencies. Returns `""` on invalid/empty inputs.
|
|
188
|
+
*/
|
|
189
|
+
export function renderRichText(value) {
|
|
190
|
+
const doc = normalizeRichtextDocument(value);
|
|
191
|
+
if (!doc)
|
|
192
|
+
return '';
|
|
193
|
+
return renderNode(doc);
|
|
194
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const RICHTEXT_SCHEMA_VERSION: 1;
|
|
2
|
+
export interface RichtextEnvelopeV1 {
|
|
3
|
+
schemaVersion: typeof RICHTEXT_SCHEMA_VERSION;
|
|
4
|
+
doc: Record<string, unknown>;
|
|
5
|
+
metadata?: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export type TipTapMarkType = 'bold' | 'strong' | 'italic' | 'em' | 'strike' | 's' | 'underline' | 'u' | 'code' | 'highlight' | 'superscript' | 'subscript' | 'textStyle' | 'link' | string;
|
|
8
|
+
export interface TipTapMark {
|
|
9
|
+
type: TipTapMarkType;
|
|
10
|
+
attrs?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export interface TipTapNode {
|
|
13
|
+
type: string;
|
|
14
|
+
attrs?: Record<string, unknown>;
|
|
15
|
+
content?: TipTapNode[];
|
|
16
|
+
marks?: TipTapMark[];
|
|
17
|
+
text?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface TipTapDoc {
|
|
20
|
+
type: 'doc';
|
|
21
|
+
content?: TipTapNode[];
|
|
22
|
+
attrs?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/richtext/types.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,uBAAuB,EAAG,CAAU,CAAA;AAEjD,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,OAAO,uBAAuB,CAAA;IAC7C,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,IAAI,GACJ,QAAQ,GACR,GAAG,GACH,WAAW,GACX,GAAG,GACH,MAAM,GACN,WAAW,GACX,aAAa,GACb,WAAW,GACX,WAAW,GACX,MAAM,GACN,MAAM,CAAA;AAEV,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,cAAc,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;IACtB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,KAAK,CAAA;IACX,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BeechClientConfig, BeechServerClient } from '../types.js';
|
|
2
|
+
export declare function createBeechServerClient<TRegistry = Record<string, unknown>>(config: BeechClientConfig): BeechServerClient<TRegistry>;
|
|
3
|
+
/** Alias for createBeechServerClient */
|
|
4
|
+
export declare const createBeechClient: typeof createBeechServerClient;
|
|
5
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/server/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAe,iBAAiB,EAA+B,MAAM,aAAa,CAAA;AAsCjH,wBAAgB,uBAAuB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzE,MAAM,EAAE,iBAAiB,GACxB,iBAAiB,CAAC,SAAS,CAAC,CA8B9B;AAED,wCAAwC;AACxC,eAAO,MAAM,iBAAiB,gCAA0B,CAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
import { buildSearchParams } from '../query-builder.js';
|
|
4
|
+
import { request, validateClientConfig } from '../http.js';
|
|
5
|
+
function normalizeInput(input) {
|
|
6
|
+
if (!input || typeof input !== 'object' || Array.isArray(input)) {
|
|
7
|
+
return input;
|
|
8
|
+
}
|
|
9
|
+
const obj = input;
|
|
10
|
+
if ('data' in obj && obj.data && typeof obj.data === 'object') {
|
|
11
|
+
return input;
|
|
12
|
+
}
|
|
13
|
+
const { slug, status, ...rest } = obj;
|
|
14
|
+
return {
|
|
15
|
+
data: rest,
|
|
16
|
+
...(typeof slug === 'string' ? { slug } : {}),
|
|
17
|
+
...(typeof status === 'string' ? { status } : {}),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function normalizeSingleResult(result, seed) {
|
|
21
|
+
if (result.error || !result.data) {
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
const raw = result.data;
|
|
25
|
+
if ('data' in raw && raw.data !== undefined) {
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
error: null,
|
|
30
|
+
data: {
|
|
31
|
+
data: raw,
|
|
32
|
+
meta: { seed },
|
|
33
|
+
...raw,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function createBeechServerClient(config) {
|
|
38
|
+
validateClientConfig(config);
|
|
39
|
+
return {
|
|
40
|
+
content(seed) {
|
|
41
|
+
const enc = encodeURIComponent(seed);
|
|
42
|
+
return {
|
|
43
|
+
list: (q, options) => request(config, 'GET', `/${enc}`, {
|
|
44
|
+
params: buildSearchParams(q),
|
|
45
|
+
options,
|
|
46
|
+
}),
|
|
47
|
+
get: (sel, options) => {
|
|
48
|
+
const p = new URLSearchParams('id' in sel ? { id: sel.id } : { slug: sel.slug });
|
|
49
|
+
return request(config, 'GET', `/${enc}`, { params: p, options });
|
|
50
|
+
},
|
|
51
|
+
create: async (input, options) => {
|
|
52
|
+
const body = normalizeInput(input);
|
|
53
|
+
const res = await request(config, 'POST', `/${enc}/add`, { body, options });
|
|
54
|
+
return normalizeSingleResult(res, seed);
|
|
55
|
+
},
|
|
56
|
+
update: async (id, input, options) => {
|
|
57
|
+
const body = normalizeInput(input);
|
|
58
|
+
const res = await request(config, 'PUT', `/${enc}/edit/${encodeURIComponent(id)}`, { body, options });
|
|
59
|
+
return normalizeSingleResult(res, seed);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** Alias for createBeechServerClient */
|
|
66
|
+
export const createBeechClient = createBeechServerClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACxE,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export type BeechFilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'not_contains' | 'starts_with' | 'ends_with' | 'is_empty' | 'is_not_empty' | 'in' | 'not_in' | 'has_tag' | 'has_any_tag' | 'has_all_tags';
|
|
2
|
+
export interface BeechClientConfig {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
fetch?: typeof fetch;
|
|
6
|
+
headers?: Record<string, string> | Headers;
|
|
7
|
+
}
|
|
8
|
+
export interface RequestOptions {
|
|
9
|
+
headers?: Record<string, string> | Headers;
|
|
10
|
+
signal?: AbortSignal | null;
|
|
11
|
+
cache?: RequestCache;
|
|
12
|
+
next?: {
|
|
13
|
+
revalidate?: number | false;
|
|
14
|
+
tags?: string[];
|
|
15
|
+
};
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** RFC 9457 Problem Details as returned by the Public API. */
|
|
19
|
+
export interface BeechProblem {
|
|
20
|
+
type: string;
|
|
21
|
+
title: string;
|
|
22
|
+
status: number;
|
|
23
|
+
detail: string;
|
|
24
|
+
instance?: string;
|
|
25
|
+
errors?: {
|
|
26
|
+
field: string;
|
|
27
|
+
expected: string;
|
|
28
|
+
received: string;
|
|
29
|
+
message: string;
|
|
30
|
+
}[];
|
|
31
|
+
}
|
|
32
|
+
/** Discriminated result — the client NEVER throws on HTTP/validation errors. */
|
|
33
|
+
export type BeechResult<T> = {
|
|
34
|
+
data: T;
|
|
35
|
+
error: null;
|
|
36
|
+
} | {
|
|
37
|
+
data: null;
|
|
38
|
+
error: BeechProblem;
|
|
39
|
+
};
|
|
40
|
+
export type Listable<TRow> = {
|
|
41
|
+
data: TRow[];
|
|
42
|
+
meta: ListMeta;
|
|
43
|
+
};
|
|
44
|
+
export type Single<TRow> = {
|
|
45
|
+
data: TRow;
|
|
46
|
+
meta: {
|
|
47
|
+
seed: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/** Ergonomic per-field comparator object → compiled to {field,op,value} server-side. */
|
|
51
|
+
export type FieldFilter = string | number | boolean | null | Partial<Record<BeechFilterOperator, unknown>>;
|
|
52
|
+
export interface ListQuery<TRow> {
|
|
53
|
+
filter?: {
|
|
54
|
+
[K in keyof TRow]?: FieldFilter;
|
|
55
|
+
} & Record<string, FieldFilter>;
|
|
56
|
+
logic?: 'AND' | 'OR';
|
|
57
|
+
sort?: Partial<Record<keyof TRow & string, 'asc' | 'desc'>>;
|
|
58
|
+
search?: string;
|
|
59
|
+
fields?: (keyof TRow & string)[];
|
|
60
|
+
page?: number;
|
|
61
|
+
limit?: number;
|
|
62
|
+
latest?: number;
|
|
63
|
+
}
|
|
64
|
+
export interface ListMeta {
|
|
65
|
+
total: number;
|
|
66
|
+
page?: number;
|
|
67
|
+
limit?: number;
|
|
68
|
+
returned: number;
|
|
69
|
+
seed: string;
|
|
70
|
+
}
|
|
71
|
+
/** Browser Client Content Resource: Strictly Read-Only (no create/update). */
|
|
72
|
+
export interface BrowserContentResource<TRow> {
|
|
73
|
+
list(query?: ListQuery<TRow>, options?: RequestOptions): Promise<BeechResult<Listable<TRow>>>;
|
|
74
|
+
get(selector: {
|
|
75
|
+
id: string;
|
|
76
|
+
} | {
|
|
77
|
+
slug: string;
|
|
78
|
+
}, options?: RequestOptions): Promise<BeechResult<Single<TRow>>>;
|
|
79
|
+
}
|
|
80
|
+
/** Browser Client Interface. */
|
|
81
|
+
export interface BeechBrowserClient<TRegistry = Record<string, unknown>> {
|
|
82
|
+
content<K extends keyof TRegistry & string>(seed: K): BrowserContentResource<TRegistry[K]>;
|
|
83
|
+
}
|
|
84
|
+
/** Server Client Content Resource: Content mutation and query operations (create, update, list, get). */
|
|
85
|
+
export interface ServerContentResource<TRow> {
|
|
86
|
+
list(query?: ListQuery<TRow>, options?: RequestOptions): Promise<BeechResult<Listable<TRow>>>;
|
|
87
|
+
get(selector: {
|
|
88
|
+
id: string;
|
|
89
|
+
} | {
|
|
90
|
+
slug: string;
|
|
91
|
+
}, options?: RequestOptions): Promise<BeechResult<Single<TRow>>>;
|
|
92
|
+
create(input: Partial<TRow>, options?: RequestOptions): Promise<BeechResult<Single<TRow>>>;
|
|
93
|
+
update(id: string, input: Partial<TRow>, options?: RequestOptions): Promise<BeechResult<Single<TRow>>>;
|
|
94
|
+
}
|
|
95
|
+
/** Server Client Interface. */
|
|
96
|
+
export interface BeechServerClient<TRegistry = Record<string, unknown>> {
|
|
97
|
+
content<K extends keyof TRegistry & string>(seed: K): ServerContentResource<TRegistry[K]>;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,mBAAmB,GAC3B,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAC1C,UAAU,GAAG,cAAc,GAAG,aAAa,GAAG,WAAW,GACzD,UAAU,GAAG,cAAc,GAAG,IAAI,GAAG,QAAQ,GAC7C,SAAS,GAAG,aAAa,GAAG,cAAc,CAAA;AAE9C,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAA;CAC3C;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAA;IAC1C,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,IAAI,CAAC,EAAE;QACL,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;QAC3B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;KAChB,CAAA;IACD,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAClF;AAED,gFAAgF;AAChF,MAAM,MAAM,WAAW,CAAC,CAAC,IACrB;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,CAAA;AAEvC,MAAM,MAAM,QAAQ,CAAC,IAAI,IAAI;IAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAA;AAC7D,MAAM,MAAM,MAAM,CAAC,IAAI,IAAM;IAAE,IAAI,EAAE,IAAI,CAAC;IAAG,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAA;AAErE,wFAAwF;AACxF,MAAM,MAAM,WAAW,GACnB,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAChC,OAAO,CAAC,MAAM,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAA;AAEjD,MAAM,WAAW,SAAS,CAAC,IAAI;IAC7B,MAAM,CAAC,EAAE;SAAG,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,WAAW;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IAC1E,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAA;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC,CAAC,CAAA;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,CAAA;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,8EAA8E;AAC9E,MAAM,WAAW,sBAAsB,CAAC,IAAI;IAC1C,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC7F,GAAG,CAAC,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;CAC/G;AAED,gCAAgC;AAChC,MAAM,WAAW,kBAAkB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrE,OAAO,CAAC,CAAC,SAAS,MAAM,SAAS,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;CAC3F;AAED,yGAAyG;AACzG,MAAM,WAAW,qBAAqB,CAAC,IAAI;IACzC,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC7F,GAAG,CAAC,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC9G,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC1F,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;CACvG;AAED,+BAA+B;AAC/B,MAAM,WAAW,iBAAiB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACpE,OAAO,CAAC,CAAC,SAAS,MAAM,SAAS,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;CAC1F"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const BEECH_SIGNATURE_HEADER = "x-beechcms-signature";
|
|
2
|
+
export declare class WebhookVerificationError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export interface VerifyWebhookSignatureOptions {
|
|
6
|
+
payload: string;
|
|
7
|
+
signature: string | null | undefined;
|
|
8
|
+
secret: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ConstructWebhookEventOptions {
|
|
11
|
+
payload: string;
|
|
12
|
+
signature: string | null | undefined;
|
|
13
|
+
secret: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Validates an inbound BeechCMS webhook signature against a shared secret in constant time.
|
|
17
|
+
* Returns `false` without throwing if the payload, signature, or secret is invalid or mismatching.
|
|
18
|
+
* Accepts both `sha256=<hex>` and raw `<hex>` formats.
|
|
19
|
+
*/
|
|
20
|
+
export declare function verifyBeechWebhookSignature(options: VerifyWebhookSignatureOptions): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Verifies the HMAC signature and deserializes the JSON payload into type `T`.
|
|
23
|
+
* Throws `WebhookVerificationError` on missing parameters or cryptographic signature failure.
|
|
24
|
+
* Lets `SyntaxError` surface naturally if JSON parsing fails on a valid payload.
|
|
25
|
+
*/
|
|
26
|
+
export declare function constructWebhookEvent<T = Record<string, unknown>>(options: ConstructWebhookEventOptions): Promise<T>;
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webhooks/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,sBAAsB,yBAAyB,CAAA;AAK5D,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAK5B;AAED,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACpC,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACpC,MAAM,EAAE,MAAM,CAAA;CACf;AA6BD;;;;GAIG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,OAAO,CAAC,CA2BlB;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrE,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,CAAC,CAAC,CAuBZ"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
export const BEECH_SIGNATURE_HEADER = 'x-beechcms-signature';
|
|
4
|
+
const SIG_PREFIX = 'sha256=';
|
|
5
|
+
const HEX_REGEX = /^[0-9a-fA-F]{64}$/;
|
|
6
|
+
export class WebhookVerificationError extends Error {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'WebhookVerificationError';
|
|
10
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function toHex(buf) {
|
|
14
|
+
return Array.from(new Uint8Array(buf))
|
|
15
|
+
.map((b) => b.toString(16).padStart(2, '0'))
|
|
16
|
+
.join('');
|
|
17
|
+
}
|
|
18
|
+
async function computeHmacSha256Hex(payload, secret) {
|
|
19
|
+
const key = await crypto.subtle.importKey('raw', new TextEncoder().encode(secret), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
|
|
20
|
+
const sig = await crypto.subtle.sign('HMAC', key, new TextEncoder().encode(payload));
|
|
21
|
+
return toHex(sig);
|
|
22
|
+
}
|
|
23
|
+
function timingSafeEqual(a, b) {
|
|
24
|
+
if (a.length !== b.length)
|
|
25
|
+
return false;
|
|
26
|
+
let mismatch = 0;
|
|
27
|
+
for (let i = 0; i < a.length; i++) {
|
|
28
|
+
mismatch |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
29
|
+
}
|
|
30
|
+
return mismatch === 0;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Validates an inbound BeechCMS webhook signature against a shared secret in constant time.
|
|
34
|
+
* Returns `false` without throwing if the payload, signature, or secret is invalid or mismatching.
|
|
35
|
+
* Accepts both `sha256=<hex>` and raw `<hex>` formats.
|
|
36
|
+
*/
|
|
37
|
+
export async function verifyBeechWebhookSignature(options) {
|
|
38
|
+
try {
|
|
39
|
+
if (!options || typeof options !== 'object') {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const { payload, signature, secret } = options;
|
|
43
|
+
if (typeof payload !== 'string' || typeof signature !== 'string' || typeof secret !== 'string') {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (!secret.trim() || !signature.trim()) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const cleanSig = signature.trim();
|
|
50
|
+
const rawProvided = cleanSig.startsWith(SIG_PREFIX)
|
|
51
|
+
? cleanSig.slice(SIG_PREFIX.length)
|
|
52
|
+
: cleanSig;
|
|
53
|
+
if (!HEX_REGEX.test(rawProvided)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
const expectedHex = await computeHmacSha256Hex(payload, secret);
|
|
57
|
+
return timingSafeEqual(expectedHex.toLowerCase(), rawProvided.toLowerCase());
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Verifies the HMAC signature and deserializes the JSON payload into type `T`.
|
|
65
|
+
* Throws `WebhookVerificationError` on missing parameters or cryptographic signature failure.
|
|
66
|
+
* Lets `SyntaxError` surface naturally if JSON parsing fails on a valid payload.
|
|
67
|
+
*/
|
|
68
|
+
export async function constructWebhookEvent(options) {
|
|
69
|
+
if (!options || typeof options !== 'object') {
|
|
70
|
+
throw new WebhookVerificationError('Options object must be provided');
|
|
71
|
+
}
|
|
72
|
+
const { payload, signature, secret } = options;
|
|
73
|
+
if (typeof payload !== 'string' || !payload) {
|
|
74
|
+
throw new WebhookVerificationError('Webhook payload must be a non-empty string');
|
|
75
|
+
}
|
|
76
|
+
if (typeof signature !== 'string' || !signature.trim()) {
|
|
77
|
+
throw new WebhookVerificationError('Webhook signature is missing or empty');
|
|
78
|
+
}
|
|
79
|
+
if (typeof secret !== 'string' || !secret.trim()) {
|
|
80
|
+
throw new WebhookVerificationError('Webhook secret is missing or empty');
|
|
81
|
+
}
|
|
82
|
+
const isValid = await verifyBeechWebhookSignature({ payload, signature, secret });
|
|
83
|
+
if (!isValid) {
|
|
84
|
+
throw new WebhookVerificationError('Webhook signature verification failed');
|
|
85
|
+
}
|
|
86
|
+
return JSON.parse(payload);
|
|
87
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@beechcms/client",
|
|
3
|
+
"version": "0.8.0-preview.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
},
|
|
16
|
+
"./browser": {
|
|
17
|
+
"import": "./dist/browser/index.js",
|
|
18
|
+
"types": "./dist/browser/index.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./server": {
|
|
21
|
+
"import": "./dist/server/index.js",
|
|
22
|
+
"types": "./dist/server/index.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./webhooks": {
|
|
25
|
+
"import": "./dist/webhooks/index.js",
|
|
26
|
+
"types": "./dist/webhooks/index.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"./richtext": {
|
|
29
|
+
"import": "./dist/richtext/index.js",
|
|
30
|
+
"types": "./dist/richtext/index.d.ts"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^24.10.1",
|
|
36
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
37
|
+
"typescript": "^5.9.3",
|
|
38
|
+
"vitest": "^4.1.0"
|
|
39
|
+
},
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc",
|
|
43
|
+
"dev": "tsc -w --preserveWatchOutput",
|
|
44
|
+
"lint": "eslint .",
|
|
45
|
+
"type-check": "tsc --noEmit",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"test:coverage": "vitest run --coverage"
|
|
48
|
+
}
|
|
49
|
+
}
|