payment-kit 1.27.2 → 1.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__blocklet__.js +37 -0
- package/api/ocap-1.30-subpath-shims.d.ts +35 -0
- package/api/src/crons/index.ts +32 -0
- package/api/src/crons/metering-subscription-detection.ts +12 -14
- package/api/src/crons/overdue-detection.ts +51 -74
- package/api/src/crons/retry-pending-events.ts +58 -0
- package/api/src/integrations/app-store/apple-root-certs.ts +26 -0
- package/api/src/integrations/app-store/client.ts +369 -0
- package/api/src/integrations/app-store/handlers/index.ts +46 -0
- package/api/src/integrations/app-store/handlers/subscription.ts +635 -0
- package/api/src/integrations/app-store/node-apple-receipt-verify.d.ts +17 -0
- package/api/src/integrations/app-store/notification-routing.ts +18 -0
- package/api/src/integrations/app-store/signed-data-verifier.ts +150 -0
- package/api/src/integrations/arcblock/nft.ts +6 -2
- package/api/src/integrations/arcblock/stake.ts +3 -2
- package/api/src/integrations/arcblock/token.ts +4 -4
- package/api/src/integrations/blocklet/notification.ts +1 -1
- package/api/src/integrations/ethereum/tx.ts +29 -0
- package/api/src/integrations/google-play/client.ts +276 -0
- package/api/src/integrations/google-play/handlers/index.ts +69 -0
- package/api/src/integrations/google-play/handlers/subscription.ts +565 -0
- package/api/src/integrations/google-play/handlers/voided.ts +106 -0
- package/api/src/integrations/google-play/setup.ts +43 -0
- package/api/src/integrations/google-play/verify.ts +251 -0
- package/api/src/integrations/iap-reconcile.ts +415 -0
- package/api/src/integrations/stripe/handlers/invoice.ts +70 -53
- package/api/src/integrations/stripe/handlers/payment-intent.ts +8 -1
- package/api/src/integrations/stripe/resource.ts +8 -0
- package/api/src/libs/audit.ts +70 -24
- package/api/src/libs/auth.ts +49 -2
- package/api/src/libs/chain-error.ts +31 -0
- package/api/src/libs/entitlement.ts +399 -0
- package/api/src/libs/env.ts +2 -0
- package/api/src/libs/error.ts +15 -0
- package/api/src/libs/event.ts +42 -1
- package/api/src/libs/invoice.ts +69 -34
- package/api/src/libs/notification/template/customer-auto-recharge-daily-limit-exceeded.ts +1 -3
- package/api/src/libs/notification/template/customer-auto-recharge-failed.ts +1 -3
- package/api/src/libs/notification/template/customer-credit-grant-granted.ts +1 -3
- package/api/src/libs/notification/template/customer-credit-insufficient.ts +1 -3
- package/api/src/libs/notification/template/customer-credit-low-balance.ts +1 -3
- package/api/src/libs/notification/template/customer-revenue-succeeded.ts +1 -3
- package/api/src/libs/notification/template/customer-reward-succeeded.ts +1 -3
- package/api/src/libs/notification/template/one-time-payment-refund-succeeded.ts +1 -3
- package/api/src/libs/notification/template/one-time-payment-succeeded.ts +1 -3
- package/api/src/libs/notification/template/subscription-renew-failed.ts +1 -3
- package/api/src/libs/notification/template/subscription-slippage-exceeded.ts +1 -3
- package/api/src/libs/notification/template/subscription-slippage-warning.ts +1 -3
- package/api/src/libs/notification/template/subscription-succeeded.ts +1 -1
- package/api/src/libs/pagination.ts +14 -9
- package/api/src/libs/payment.ts +25 -10
- package/api/src/libs/security.ts +51 -0
- package/api/src/libs/session.ts +1 -1
- package/api/src/libs/subscription.ts +13 -1
- package/api/src/libs/timing.ts +35 -0
- package/api/src/libs/util.ts +29 -15
- package/api/src/libs/wallet-migration.ts +72 -53
- package/api/src/queues/auto-recharge.ts +1 -1
- package/api/src/queues/credit-consume.ts +94 -12
- package/api/src/queues/credit-grant.ts +4 -0
- package/api/src/queues/event.ts +39 -21
- package/api/src/queues/invoice.ts +1 -0
- package/api/src/queues/payment.ts +83 -15
- package/api/src/queues/refund.ts +84 -71
- package/api/src/queues/subscription.ts +1 -0
- package/api/src/queues/webhook.ts +12 -2
- package/api/src/routes/checkout-sessions.ts +82 -43
- package/api/src/routes/connect/change-payment.ts +2 -0
- package/api/src/routes/connect/change-plan.ts +2 -0
- package/api/src/routes/connect/pay.ts +12 -3
- package/api/src/routes/connect/setup.ts +3 -1
- package/api/src/routes/connect/shared.ts +52 -39
- package/api/src/routes/connect/subscribe.ts +4 -1
- package/api/src/routes/credit-grants.ts +25 -17
- package/api/src/routes/donations.ts +2 -2
- package/api/src/routes/entitlements.ts +105 -0
- package/api/src/routes/events.ts +2 -2
- package/api/src/routes/index.ts +12 -2
- package/api/src/routes/integrations/app-store.ts +267 -0
- package/api/src/routes/integrations/google-play.ts +324 -0
- package/api/src/routes/meter-events.ts +16 -6
- package/api/src/routes/payment-links.ts +1 -1
- package/api/src/routes/payment-methods.ts +131 -1
- package/api/src/routes/settings.ts +1 -1
- package/api/src/routes/tax-rates.ts +1 -1
- package/api/src/store/migrations/20260526-iap-foundation.ts +105 -0
- package/api/src/store/models/customer.ts +37 -1
- package/api/src/store/models/entitlement-grant.ts +118 -0
- package/api/src/store/models/entitlement-product.ts +48 -0
- package/api/src/store/models/entitlement.ts +86 -0
- package/api/src/store/models/index.ts +9 -0
- package/api/src/store/models/invoice.ts +20 -0
- package/api/src/store/models/payment-method.ts +66 -1
- package/api/src/store/models/price.ts +23 -14
- package/api/src/store/models/refund.ts +10 -0
- package/api/src/store/models/subscription.ts +14 -0
- package/api/src/store/models/types.ts +32 -0
- package/api/tests/integrations/app-store/client.spec.ts +335 -0
- package/api/tests/integrations/app-store/handlers.spec.ts +480 -0
- package/api/tests/integrations/app-store/notifications.spec.ts +381 -0
- package/api/tests/integrations/app-store/signed-data-verifier.spec.ts +72 -0
- package/api/tests/integrations/app-store/webhook-routing.spec.ts +27 -0
- package/api/tests/integrations/google-play/handlers.spec.ts +341 -0
- package/api/tests/integrations/google-play/verify.spec.ts +215 -0
- package/api/tests/integrations/iap-reconcile.spec.ts +237 -0
- package/api/tests/libs/entitlement.spec.ts +347 -0
- package/api/tests/libs/wallet-migration.spec.ts +4 -4
- package/api/tests/queues/credit-consume-batch.spec.ts +5 -2
- package/api/tests/queues/credit-consume.spec.ts +8 -4
- package/api/tests/routes/credit-grants.spec.ts +1 -0
- package/blocklet.yml +1 -1
- package/cloudflare/MIGRATION-CHALLENGES.md +676 -0
- package/cloudflare/MIGRATION-RUNBOOK.md +777 -0
- package/cloudflare/README.md +499 -0
- package/cloudflare/STAGING-MIGRATION-GUIDE.md +602 -0
- package/cloudflare/build.ts +151 -0
- package/cloudflare/did-connect-auth.ts +527 -0
- package/cloudflare/docs/2026-04-22-sdk-1.30.9-upgrade-retro.md +324 -0
- package/cloudflare/docs/2026-04-24-queue-ops-followup.md +218 -0
- package/cloudflare/docs/cf-queues-ops-alert-analysis.md +663 -0
- package/cloudflare/docs/cf-workers-local-dev-and-fixes.md +284 -0
- package/cloudflare/docs/cleanup-tasks-2026-05.md +62 -0
- package/cloudflare/docs/payment-kit-platform-analysis-2026-04-20.md +354 -0
- package/cloudflare/frontend-shims/buffer-polyfill.ts +9 -0
- package/cloudflare/frontend-shims/js-sdk.ts +43 -0
- package/cloudflare/frontend-shims/mime-types.ts +46 -0
- package/cloudflare/frontend-shims/session.ts +24 -0
- package/cloudflare/frontend-shims/vite-plugin-noop.ts +6 -0
- package/cloudflare/index.html +40 -0
- package/cloudflare/migrate-to-d1.js +252 -0
- package/cloudflare/migrations/0001_initial_schema.sql +82 -0
- package/cloudflare/migrations/0002_indexes.sql +75 -0
- package/cloudflare/migrations/0003_locks_and_constraints.sql +18 -0
- package/cloudflare/migrations/0004_iap_foundation.sql +72 -0
- package/cloudflare/migrations/0005_iap_tenant_backfill.sql +112 -0
- package/cloudflare/run-build.js +391 -0
- package/cloudflare/scripts/test-decrypt.js +102 -0
- package/cloudflare/shims/arcblock-ws.ts +20 -0
- package/cloudflare/shims/axios-http-adapter.ts +4 -0
- package/cloudflare/shims/axios-lite.ts +117 -0
- package/cloudflare/shims/blocklet-sdk/auth-service.ts +33 -0
- package/cloudflare/shims/blocklet-sdk/cdn.ts +3 -0
- package/cloudflare/shims/blocklet-sdk/component-api.ts +35 -0
- package/cloudflare/shims/blocklet-sdk/component.ts +18 -0
- package/cloudflare/shims/blocklet-sdk/config.ts +8 -0
- package/cloudflare/shims/blocklet-sdk/did.ts +14 -0
- package/cloudflare/shims/blocklet-sdk/env.ts +12 -0
- package/cloudflare/shims/blocklet-sdk/eventbus.ts +3 -0
- package/cloudflare/shims/blocklet-sdk/fallback.ts +3 -0
- package/cloudflare/shims/blocklet-sdk/index.ts +11 -0
- package/cloudflare/shims/blocklet-sdk/logger.ts +11 -0
- package/cloudflare/shims/blocklet-sdk/middlewares.ts +15 -0
- package/cloudflare/shims/blocklet-sdk/notification.ts +11 -0
- package/cloudflare/shims/blocklet-sdk/security.ts +53 -0
- package/cloudflare/shims/blocklet-sdk/session.ts +8 -0
- package/cloudflare/shims/blocklet-sdk/verify-session.ts +44 -0
- package/cloudflare/shims/blocklet-sdk/verify-sign.ts +38 -0
- package/cloudflare/shims/blocklet-sdk/wallet-authenticator.ts +3 -0
- package/cloudflare/shims/blocklet-sdk/wallet-handler.ts +6 -0
- package/cloudflare/shims/blocklet-sdk/wallet.ts +103 -0
- package/cloudflare/shims/cookie-parser.ts +3 -0
- package/cloudflare/shims/cors.ts +21 -0
- package/cloudflare/shims/cron.ts +189 -0
- package/cloudflare/shims/crypto-js-warn.ts +7 -0
- package/cloudflare/shims/did-space-js.ts +17 -0
- package/cloudflare/shims/did-space.ts +11 -0
- package/cloudflare/shims/error.ts +18 -0
- package/cloudflare/shims/express-compat/index.ts +80 -0
- package/cloudflare/shims/express-compat/types.ts +41 -0
- package/cloudflare/shims/fastq.ts +105 -0
- package/cloudflare/shims/lock.ts +115 -0
- package/cloudflare/shims/mime-types.ts +56 -0
- package/cloudflare/shims/nedb-storage.ts +9 -0
- package/cloudflare/shims/node-child-process.ts +9 -0
- package/cloudflare/shims/node-fs.ts +20 -0
- package/cloudflare/shims/node-http.ts +13 -0
- package/cloudflare/shims/node-https.ts +4 -0
- package/cloudflare/shims/node-misc.ts +15 -0
- package/cloudflare/shims/node-net.ts +8 -0
- package/cloudflare/shims/node-os.ts +14 -0
- package/cloudflare/shims/node-tty.ts +8 -0
- package/cloudflare/shims/node-zlib.ts +17 -0
- package/cloudflare/shims/noop.ts +26 -0
- package/cloudflare/shims/payment-vendor.ts +14 -0
- package/cloudflare/shims/querystring.ts +12 -0
- package/cloudflare/shims/queue.ts +611 -0
- package/cloudflare/shims/rolldown-runtime.ts +43 -0
- package/cloudflare/shims/sequelize-d1/datatypes.ts +24 -0
- package/cloudflare/shims/sequelize-d1/helpers.ts +46 -0
- package/cloudflare/shims/sequelize-d1/index.ts +34 -0
- package/cloudflare/shims/sequelize-d1/model.ts +1176 -0
- package/cloudflare/shims/sequelize-d1/operators.ts +306 -0
- package/cloudflare/shims/sequelize-d1/retry.ts +85 -0
- package/cloudflare/shims/sequelize-d1/sequelize-class.ts +119 -0
- package/cloudflare/shims/sequelize-d1/timing.ts +81 -0
- package/cloudflare/shims/sequelize-d1/types.ts +35 -0
- package/cloudflare/shims/stripe-cf.ts +29 -0
- package/cloudflare/shims/ws-lite.ts +103 -0
- package/cloudflare/shims/xss.ts +3 -0
- package/cloudflare/tests/shims/cron.spec.ts +210 -0
- package/cloudflare/tests/shims/queue-delayed-persist.spec.ts +87 -0
- package/cloudflare/tests/shims/queue-scheduled.spec.ts +186 -0
- package/cloudflare/vite.config.ts +162 -0
- package/cloudflare/worker.ts +1608 -0
- package/cloudflare/wrangler.json +63 -0
- package/cloudflare/wrangler.jsonc +75 -0
- package/cloudflare/wrangler.staging.json +67 -0
- package/cloudflare/wrangler.toml +28 -0
- package/jest.config.js +4 -12
- package/package.json +30 -22
- package/scripts/seed-google-play.ts +79 -0
- package/src/app.tsx +62 -4
- package/src/components/customer/link.tsx +9 -13
- package/src/components/customer/notification-preference.tsx +3 -2
- package/src/components/filter-toolbar.tsx +4 -0
- package/src/components/invoice/list.tsx +9 -1
- package/src/components/invoice-pdf/utils.ts +2 -1
- package/src/components/layout/admin.tsx +39 -5
- package/src/components/layout/user-cf.tsx +77 -0
- package/src/components/payment-intent/actions.tsx +23 -3
- package/src/components/payment-method/app-store.tsx +103 -0
- package/src/components/payment-method/form.tsx +7 -1
- package/src/components/payment-method/google-play.tsx +85 -0
- package/src/components/safe-did-address.tsx +75 -0
- package/src/components/subscription/list.tsx +20 -0
- package/src/libs/patch-user-card.ts +25 -0
- package/src/libs/util.ts +5 -7
- package/src/locales/en.tsx +63 -0
- package/src/locales/zh.tsx +63 -0
- package/src/pages/admin/billing/meter-events/index.tsx +4 -0
- package/src/pages/admin/billing/subscriptions/detail.tsx +80 -0
- package/src/pages/admin/customers/customers/detail.tsx +8 -2
- package/src/pages/admin/customers/customers/index.tsx +2 -2
- package/src/pages/admin/overview.tsx +3 -1
- package/src/pages/admin/settings/payment-methods/create.tsx +12 -0
- package/src/pages/admin/settings/payment-methods/index.tsx +1 -1
- package/src/pages/customer/subscription/detail.tsx +4 -4
- package/tsconfig.api.json +1 -6
- package/tsconfig.json +3 -4
- package/tsconfig.types.json +2 -1
- package/vite.config.ts +6 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// node:fs shim — CF Workers have no filesystem
|
|
2
|
+
export function readFileSync() { return ''; }
|
|
3
|
+
export function writeFileSync() {}
|
|
4
|
+
export function existsSync() { return false; }
|
|
5
|
+
export function mkdirSync() {}
|
|
6
|
+
export function readdirSync() { return []; }
|
|
7
|
+
export function statSync() { return { isFile: () => false, isDirectory: () => false }; }
|
|
8
|
+
export function unlinkSync() {}
|
|
9
|
+
export const promises = {
|
|
10
|
+
readFile: async () => '',
|
|
11
|
+
writeFile: async () => {},
|
|
12
|
+
mkdir: async () => {},
|
|
13
|
+
readdir: async () => [],
|
|
14
|
+
stat: async () => ({ isFile: () => false, isDirectory: () => false }),
|
|
15
|
+
unlink: async () => {},
|
|
16
|
+
access: async () => { throw new Error('ENOENT'); },
|
|
17
|
+
};
|
|
18
|
+
export function createReadStream() { throw new Error('fs not available in CF Workers'); }
|
|
19
|
+
export function createWriteStream() { throw new Error('fs not available in CF Workers'); }
|
|
20
|
+
export default { readFileSync, writeFileSync, existsSync, mkdirSync, readdirSync, statSync, unlinkSync, promises, createReadStream, createWriteStream };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// node:http shim — Stripe SDK and axios have conditional http/https usage
|
|
2
|
+
// In CF Workers they use fetch instead, so these are never actually called
|
|
3
|
+
export class IncomingMessage {}
|
|
4
|
+
export class ServerResponse {}
|
|
5
|
+
export class Server { listen() {} close() {} }
|
|
6
|
+
export function createServer() { return new Server(); }
|
|
7
|
+
export function request() { throw new Error('node:http not available in CF Workers'); }
|
|
8
|
+
export function get() { throw new Error('node:http not available in CF Workers'); }
|
|
9
|
+
export const METHODS = ['GET','POST','PUT','DELETE','PATCH','HEAD','OPTIONS'];
|
|
10
|
+
export const STATUS_CODES = { 200: 'OK', 404: 'Not Found', 500: 'Internal Server Error' };
|
|
11
|
+
export const Agent = class {};
|
|
12
|
+
export const globalAgent = new Agent();
|
|
13
|
+
export default { IncomingMessage, ServerResponse, Server, createServer, request, get, METHODS, STATUS_CODES, Agent, globalAgent };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Catch-all shim for node modules that CF Workers doesn't support
|
|
2
|
+
// tls, cluster, zlib, bufferutil
|
|
3
|
+
|
|
4
|
+
// tls
|
|
5
|
+
export const TLSSocket = class { on() { return this; } };
|
|
6
|
+
export const connect = () => new TLSSocket();
|
|
7
|
+
export const createServer = () => ({ listen() {}, close() {} });
|
|
8
|
+
|
|
9
|
+
// cluster
|
|
10
|
+
export const isMaster = true;
|
|
11
|
+
export const isPrimary = true;
|
|
12
|
+
export const isWorker = false;
|
|
13
|
+
export const workers = {};
|
|
14
|
+
|
|
15
|
+
export default {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// node:net shim
|
|
2
|
+
export class Socket { on() { return this; } write() {} end() {} destroy() {} connect() { return this; } }
|
|
3
|
+
export class Server { listen() {} close() {} address() { return null; } }
|
|
4
|
+
export function createServer() { return new Server(); }
|
|
5
|
+
export function createConnection() { return new Socket(); }
|
|
6
|
+
export function connect() { return new Socket(); }
|
|
7
|
+
export function isIP() { return 0; }
|
|
8
|
+
export default { Socket, Server, createServer, createConnection, connect, isIP };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// node:os shim for CF Workers
|
|
2
|
+
export function homedir() { return '/tmp'; }
|
|
3
|
+
export function hostname() { return 'cf-worker'; }
|
|
4
|
+
export function platform() { return 'linux'; }
|
|
5
|
+
export function arch() { return 'x64'; }
|
|
6
|
+
export function tmpdir() { return '/tmp'; }
|
|
7
|
+
export function type() { return 'Linux'; }
|
|
8
|
+
export function release() { return '0.0.0'; }
|
|
9
|
+
export function cpus() { return []; }
|
|
10
|
+
export function totalmem() { return 0; }
|
|
11
|
+
export function freemem() { return 0; }
|
|
12
|
+
export function networkInterfaces() { return {}; }
|
|
13
|
+
export const EOL = '\n';
|
|
14
|
+
export default { homedir, hostname, platform, arch, tmpdir, type, release, cpus, totalmem, freemem, networkInterfaces, EOL };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// node:zlib shim — constants needed by axios
|
|
2
|
+
export const Z_SYNC_FLUSH = 2;
|
|
3
|
+
export const Z_NO_FLUSH = 0;
|
|
4
|
+
export const Z_PARTIAL_FLUSH = 1;
|
|
5
|
+
export const Z_FULL_FLUSH = 3;
|
|
6
|
+
export const Z_FINISH = 4;
|
|
7
|
+
export const Z_DEFAULT_COMPRESSION = -1;
|
|
8
|
+
export const constants = { Z_SYNC_FLUSH, Z_NO_FLUSH, Z_PARTIAL_FLUSH, Z_FULL_FLUSH, Z_FINISH, Z_DEFAULT_COMPRESSION };
|
|
9
|
+
export function createGzip() { throw new Error('zlib not available in CF Workers'); }
|
|
10
|
+
export function createGunzip() { throw new Error('zlib not available in CF Workers'); }
|
|
11
|
+
export function createUnzip() { throw new Error('zlib not available in CF Workers'); }
|
|
12
|
+
export function createBrotliDecompress() { throw new Error('zlib not available in CF Workers'); }
|
|
13
|
+
export function gzipSync() { throw new Error('zlib not available in CF Workers'); }
|
|
14
|
+
export function gunzipSync() { throw new Error('zlib not available in CF Workers'); }
|
|
15
|
+
export function deflateSync() { throw new Error('zlib not available in CF Workers'); }
|
|
16
|
+
export function inflateSync() { throw new Error('zlib not available in CF Workers'); }
|
|
17
|
+
export default { Z_SYNC_FLUSH, Z_NO_FLUSH, Z_PARTIAL_FLUSH, Z_FULL_FLUSH, Z_FINISH, Z_DEFAULT_COMPRESSION, constants, createGzip, createGunzip, createUnzip, createBrotliDecompress, gzipSync, gunzipSync, deflateSync, inflateSync };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// noop shim — replaces modules not needed in CF Workers
|
|
2
|
+
export const createNamespace = (_name?: any) => ({
|
|
3
|
+
bind: (fn: any) => fn,
|
|
4
|
+
run: (fn: any) => fn(),
|
|
5
|
+
get: () => undefined,
|
|
6
|
+
set: () => {},
|
|
7
|
+
createContext: () => ({}),
|
|
8
|
+
enter: () => {},
|
|
9
|
+
exit: () => {},
|
|
10
|
+
active: null,
|
|
11
|
+
});
|
|
12
|
+
export const getNamespace = () => null;
|
|
13
|
+
export const destroyNamespace = () => {};
|
|
14
|
+
export class Client {
|
|
15
|
+
constructor(..._args: any[]) {}
|
|
16
|
+
connect() {
|
|
17
|
+
return Promise.resolve();
|
|
18
|
+
}
|
|
19
|
+
query() {
|
|
20
|
+
return Promise.resolve({ rows: [] });
|
|
21
|
+
}
|
|
22
|
+
end() {
|
|
23
|
+
return Promise.resolve();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export default { createNamespace, getNamespace, destroyNamespace, Client };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @blocklet/payment-vendor shim
|
|
2
|
+
export class Auth {
|
|
3
|
+
constructor(_opts?: any) {}
|
|
4
|
+
verify(_req: any) { return true; }
|
|
5
|
+
}
|
|
6
|
+
export const VendorAuth = Auth;
|
|
7
|
+
|
|
8
|
+
const noopMiddleware = (_req: any, _res: any, next: any) => next();
|
|
9
|
+
|
|
10
|
+
export const middleware = {
|
|
11
|
+
ensureVendorAuth: (_verifyFn?: any) => noopMiddleware,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default { Auth, VendorAuth, middleware };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Minimal querystring shim for CF Workers
|
|
2
|
+
// Only implements stringify() which is what @arcblock/did-connect-js uses
|
|
3
|
+
|
|
4
|
+
export function stringify(obj: Record<string, any>): string {
|
|
5
|
+
return new URLSearchParams(obj).toString();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function parse(str: string): Record<string, string> {
|
|
9
|
+
return Object.fromEntries(new URLSearchParams(str).entries());
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default { stringify, parse };
|