@repost/client 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-Cvtcy1sj.cjs → index-D8savdEr.cjs} +56 -5
- package/dist/cjs/index-D8savdEr.cjs.map +1 -0
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/{node-BAeIn5bM.cjs → node-CmUdEVdy.cjs} +3 -3
- package/dist/cjs/{node-BAeIn5bM.cjs.map → node-CmUdEVdy.cjs.map} +1 -1
- package/dist/cjs/otel/index.cjs +1 -1
- package/dist/cjs/types/operation-policy.d.ts +18 -0
- package/dist/cjs/types/version.d.ts +1 -1
- package/dist/cjs/{version-w8LvCO5u.cjs → version-D2hJn-Q1.cjs} +2 -2
- package/dist/cjs/version-D2hJn-Q1.cjs.map +1 -0
- package/dist/esm/{index-DynTUrJB.mjs → index-BNHg4tet.mjs} +56 -5
- package/dist/esm/index-BNHg4tet.mjs.map +1 -0
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/{node-CRS6HR8L.mjs → node-BTw-mmk1.mjs} +3 -3
- package/dist/esm/{node-CRS6HR8L.mjs.map → node-BTw-mmk1.mjs.map} +1 -1
- package/dist/esm/otel/index.mjs +1 -1
- package/dist/esm/{version-DhStVOHR.mjs → version-BzVgnkVm.mjs} +2 -2
- package/dist/esm/version-BzVgnkVm.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/cjs/index-Cvtcy1sj.cjs.map +0 -1
- package/dist/cjs/version-w8LvCO5u.cjs.map +0 -1
- package/dist/esm/index-DynTUrJB.mjs.map +0 -1
- package/dist/esm/version-DhStVOHR.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version = require('./version-
|
|
3
|
+
var version = require('./version-D2hJn-Q1.cjs');
|
|
4
4
|
var observer = require('./observer-dykSFHYi.cjs');
|
|
5
5
|
|
|
6
6
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -1401,7 +1401,7 @@ function resolveDefaultTransport(options = {}) {
|
|
|
1401
1401
|
function createNodeTransport(options = {}) {
|
|
1402
1402
|
rejectRuntimeOptions(options);
|
|
1403
1403
|
let loaded;
|
|
1404
|
-
const load = () => loaded ?? (loaded = Promise.resolve().then(function () { return require('./node-
|
|
1404
|
+
const load = () => loaded ?? (loaded = Promise.resolve().then(function () { return require('./node-CmUdEVdy.cjs'); }).then((module) => module.createNodeTransport(options)));
|
|
1405
1405
|
return {
|
|
1406
1406
|
async send(request) {
|
|
1407
1407
|
return (await load()).send(request);
|
|
@@ -2124,6 +2124,55 @@ function validateAcceptedResponse(outcome, envelope, customerId) {
|
|
|
2124
2124
|
return null;
|
|
2125
2125
|
}
|
|
2126
2126
|
}
|
|
2127
|
+
const RFC3339 = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:[Zz]|([+-])(\d{2}):(\d{2}))$/;
|
|
2128
|
+
/** RFC 3339 `date-time`: shape, field ranges, and a real calendar date. */
|
|
2129
|
+
function isRfc3339(value) {
|
|
2130
|
+
const match = RFC3339.exec(value);
|
|
2131
|
+
if (!match)
|
|
2132
|
+
return false;
|
|
2133
|
+
const [, year, month, day, hour, minute, second, , offsetHour, offsetMinute] = match;
|
|
2134
|
+
const y = Number(year), m = Number(month), d = Number(day);
|
|
2135
|
+
if (m < 1 || m > 12 || d < 1 || Number(hour) > 23 || Number(minute) > 59 || Number(second) > 60)
|
|
2136
|
+
return false;
|
|
2137
|
+
if (offsetHour !== undefined && (Number(offsetHour) > 23 || Number(offsetMinute) > 59))
|
|
2138
|
+
return false;
|
|
2139
|
+
const date = new Date(Date.UTC(y, m - 1, d));
|
|
2140
|
+
return date.getUTCFullYear() === y && date.getUTCMonth() === m - 1 && date.getUTCDate() === d;
|
|
2141
|
+
}
|
|
2142
|
+
/**
|
|
2143
|
+
* The Send log shape answers a duplicate idempotency key with 409 and the
|
|
2144
|
+
* original message id (spec 2026-09-16 §9): an accepted replay, read with
|
|
2145
|
+
* the same limits and strictness as a 2xx body, requiring only `id`; type
|
|
2146
|
+
* and customer are the sent envelope's. The timestamp is the body's own when
|
|
2147
|
+
* it carries one that is valid RFC 3339 (the accepted message's original
|
|
2148
|
+
* timestamp), else the envelope's; a stray value is ignored rather than
|
|
2149
|
+
* demoting the replay to a conflict. `null` means the 409 is not that answer
|
|
2150
|
+
* and keeps today's conflict handling.
|
|
2151
|
+
*/
|
|
2152
|
+
function validateDuplicateResponse(outcome, envelope, customerId) {
|
|
2153
|
+
if (outcome.bodyBytes.length > RESPONSE_LIMIT_BYTES
|
|
2154
|
+
|| (!outcome.transportLimitsApplied && outcome.compressedBytes > RESPONSE_LIMIT_BYTES)
|
|
2155
|
+
|| (!outcome.transportLimitsApplied && outcome.decompressedBytes > RESPONSE_LIMIT_BYTES))
|
|
2156
|
+
return "LIMIT_EXCEEDED";
|
|
2157
|
+
const contentTypes = headerValues(outcome.headers, "content-type");
|
|
2158
|
+
if (contentTypes.length !== 1
|
|
2159
|
+
|| !/^[\t ]*application\/json[\t ]*(?:;[\t ]*charset[\t ]*=[\t ]*(?:utf-8|"utf-8")[\t ]*)?$/i.test(contentTypes[0] ?? ""))
|
|
2160
|
+
return null;
|
|
2161
|
+
try {
|
|
2162
|
+
const value = parseStrictJson(outcome.bodyBytes);
|
|
2163
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
2164
|
+
return null;
|
|
2165
|
+
if (typeof value.id !== "string" || !/^msg_[A-Za-z0-9_-]{1,124}$/.test(value.id))
|
|
2166
|
+
return null;
|
|
2167
|
+
const timestamp = typeof value.timestamp === "string" && isRfc3339(value.timestamp) ? value.timestamp : envelope.timestamp;
|
|
2168
|
+
return Object.freeze({ id: value.id, type: envelope.type, customerId, timestamp });
|
|
2169
|
+
}
|
|
2170
|
+
catch (error) {
|
|
2171
|
+
if (error instanceof StrictJsonLimitError)
|
|
2172
|
+
return "LIMIT_EXCEEDED";
|
|
2173
|
+
return null;
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2127
2176
|
function headerValues(headers, name) {
|
|
2128
2177
|
const entry = Object.entries(headers).find(([key]) => key.toLowerCase() === name);
|
|
2129
2178
|
return entry?.[1] ?? [];
|
|
@@ -2520,8 +2569,10 @@ async function send(config, schema, state, transport, observers, telemetry, even
|
|
|
2520
2569
|
throw error;
|
|
2521
2570
|
}
|
|
2522
2571
|
let classifiedOutcome = outcome;
|
|
2523
|
-
if (outcome.kind === "response" && outcome.status >= 200 && outcome.status <= 299) {
|
|
2524
|
-
const result =
|
|
2572
|
+
if (outcome.kind === "response" && ((outcome.status >= 200 && outcome.status <= 299) || outcome.status === 409)) {
|
|
2573
|
+
const result = outcome.status === 409
|
|
2574
|
+
? validateDuplicateResponse(outcome, envelope, input.customerId)
|
|
2575
|
+
: validateAcceptedResponse(outcome, envelope, input.customerId);
|
|
2525
2576
|
if (result === "LIMIT_EXCEEDED") {
|
|
2526
2577
|
classifiedOutcome = { ...outcome, limitExceeded: true };
|
|
2527
2578
|
}
|
|
@@ -2985,4 +3036,4 @@ exports.errorCode = errorCode;
|
|
|
2985
3036
|
exports.httpTransport = httpTransport;
|
|
2986
3037
|
exports.serializeModel = serializeModel;
|
|
2987
3038
|
exports.stubTransport = stubTransport;
|
|
2988
|
-
//# sourceMappingURL=index-
|
|
3039
|
+
//# sourceMappingURL=index-D8savdEr.cjs.map
|