@kehto/paja 0.9.0 → 0.11.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/README.md +36 -9
- package/dist/browser-host.js +642 -339
- package/dist/browser-host.js.map +1 -1
- package/dist/{chunk-OWVINAW7.js → chunk-EOCGC7A2.js} +30 -36
- package/dist/{chunk-OWVINAW7.js.map → chunk-EOCGC7A2.js.map} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +17 -19
- package/dist/index.js +1 -1
- package/package.json +11 -11
|
@@ -920,6 +920,7 @@ var PAJA_UPSTREAM_WEB_DOMAINS = [
|
|
|
920
920
|
"count",
|
|
921
921
|
"cvm",
|
|
922
922
|
"dm",
|
|
923
|
+
"fs",
|
|
923
924
|
"identity",
|
|
924
925
|
PAJA_LEGACY_COMPATIBILITY_DOMAIN,
|
|
925
926
|
"inc",
|
|
@@ -1048,10 +1049,10 @@ var InstalledNappletCatalog = class {
|
|
|
1048
1049
|
aggregateHash: resolved.aggregateHash,
|
|
1049
1050
|
pointer: copyPointer(resolved.pointer),
|
|
1050
1051
|
...resolved.manifest.title === void 0 ? {} : { title: resolved.manifest.title },
|
|
1052
|
+
requires: [...resolved.manifest.requires],
|
|
1051
1053
|
archetypes: resolved.manifest.archetypes.map((archetype) => ({
|
|
1052
1054
|
slug: archetype.slug,
|
|
1053
|
-
convention: archetype.convention
|
|
1054
|
-
...archetype.eventKinds === void 0 ? {} : { eventKinds: [...archetype.eventKinds] }
|
|
1055
|
+
convention: archetype.convention
|
|
1055
1056
|
}))
|
|
1056
1057
|
});
|
|
1057
1058
|
this.records.set(record.dTag, record);
|
|
@@ -1087,13 +1088,12 @@ var InstalledNappletCatalog = class {
|
|
|
1087
1088
|
}
|
|
1088
1089
|
/** Return exact handler candidates derived only from installed manifests. */
|
|
1089
1090
|
intentCatalog() {
|
|
1090
|
-
return this.installed().map((record) => manifestToIntentCatalogEntry({
|
|
1091
|
+
return this.installed().filter((record) => record.requires.includes("inc")).map((record) => manifestToIntentCatalogEntry({
|
|
1091
1092
|
dTag: record.dTag,
|
|
1092
1093
|
...record.title === void 0 ? {} : { title: record.title },
|
|
1093
1094
|
archetypes: record.archetypes.map((archetype) => ({
|
|
1094
1095
|
slug: archetype.slug,
|
|
1095
|
-
convention: archetype.convention
|
|
1096
|
-
...archetype.eventKinds === void 0 ? {} : { eventKinds: [...archetype.eventKinds] }
|
|
1096
|
+
convention: archetype.convention
|
|
1097
1097
|
}))
|
|
1098
1098
|
}));
|
|
1099
1099
|
}
|
|
@@ -1129,10 +1129,8 @@ function copyPointer(pointer) {
|
|
|
1129
1129
|
function freezeRecord(record) {
|
|
1130
1130
|
return Object.freeze({
|
|
1131
1131
|
...record,
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
...archetype.eventKinds === void 0 ? {} : { eventKinds: Object.freeze([...archetype.eventKinds]) }
|
|
1135
|
-
})))
|
|
1132
|
+
requires: Object.freeze([...record.requires]),
|
|
1133
|
+
archetypes: Object.freeze(record.archetypes.map((archetype) => Object.freeze({ ...archetype })))
|
|
1136
1134
|
});
|
|
1137
1135
|
}
|
|
1138
1136
|
|
|
@@ -1145,25 +1143,13 @@ var BrowserIntentController = class {
|
|
|
1145
1143
|
}
|
|
1146
1144
|
options;
|
|
1147
1145
|
maxAttempts;
|
|
1148
|
-
|
|
1149
|
-
const
|
|
1150
|
-
let started;
|
|
1151
|
-
let delivered = false;
|
|
1152
|
-
return {
|
|
1153
|
-
start: () => {
|
|
1154
|
-
started ??= this.start(retained, () => delivered, () => {
|
|
1155
|
-
delivered = true;
|
|
1156
|
-
});
|
|
1157
|
-
return started;
|
|
1158
|
-
}
|
|
1159
|
-
};
|
|
1160
|
-
}
|
|
1161
|
-
async start(params, isDelivered, markDelivered) {
|
|
1146
|
+
async dispatch(params) {
|
|
1147
|
+
const dispatch = freezeDispatch(params);
|
|
1162
1148
|
let reason = "no-current-target";
|
|
1163
1149
|
for (let attempt = 1; attempt <= this.maxAttempts; attempt += 1) {
|
|
1164
1150
|
let generation;
|
|
1165
1151
|
try {
|
|
1166
|
-
generation = await this.options.openOrReuse(
|
|
1152
|
+
generation = await this.options.openOrReuse(dispatch, attempt);
|
|
1167
1153
|
} catch {
|
|
1168
1154
|
reason = "open-failed";
|
|
1169
1155
|
continue;
|
|
@@ -1182,17 +1168,18 @@ var BrowserIntentController = class {
|
|
|
1182
1168
|
reason = "no-current-target";
|
|
1183
1169
|
continue;
|
|
1184
1170
|
}
|
|
1185
|
-
if (isDelivered()) return;
|
|
1186
|
-
markDelivered();
|
|
1187
1171
|
try {
|
|
1188
|
-
await this.options.send(generation,
|
|
1189
|
-
|
|
1172
|
+
await this.options.send(generation, dispatch);
|
|
1173
|
+
const windowId = this.options.getWindowId(generation);
|
|
1174
|
+
if (!windowId) throw new Error("intent target window is unavailable");
|
|
1175
|
+
return { windowId };
|
|
1190
1176
|
} catch {
|
|
1191
|
-
this.options.onTerminal?.(
|
|
1192
|
-
|
|
1177
|
+
this.options.onTerminal?.(dispatch, "send-failed");
|
|
1178
|
+
throw new Error("intent target send failed");
|
|
1193
1179
|
}
|
|
1194
1180
|
}
|
|
1195
|
-
this.options.onTerminal?.(
|
|
1181
|
+
this.options.onTerminal?.(dispatch, reason);
|
|
1182
|
+
throw new Error(`intent target ${reason}`);
|
|
1196
1183
|
}
|
|
1197
1184
|
};
|
|
1198
1185
|
function normalizeAttempts(value) {
|
|
@@ -1200,15 +1187,22 @@ function normalizeAttempts(value) {
|
|
|
1200
1187
|
if (!Number.isFinite(value)) throw new TypeError("maxAttempts must be finite");
|
|
1201
1188
|
return Math.min(MAX_INTENT_DELIVERY_ATTEMPTS, Math.max(1, Math.floor(value)));
|
|
1202
1189
|
}
|
|
1203
|
-
function
|
|
1190
|
+
function freezeDispatch(params) {
|
|
1204
1191
|
if (!params || typeof params.handler !== "string" || params.handler.length === 0) {
|
|
1205
|
-
throw new TypeError("Intent
|
|
1192
|
+
throw new TypeError("Intent dispatch requires a handler");
|
|
1193
|
+
}
|
|
1194
|
+
if (typeof params.sender !== "string" || params.sender.length === 0 || typeof params.archetype !== "string" || params.archetype.length === 0 || typeof params.action !== "string" || params.action.length === 0 || typeof params.convention !== "string" || params.convention.length === 0) {
|
|
1195
|
+
throw new TypeError("Intent dispatch requires canonical routing fields");
|
|
1206
1196
|
}
|
|
1207
|
-
const
|
|
1197
|
+
const payload = freezeValue(params.payload);
|
|
1208
1198
|
const behavior = params.behavior === void 0 ? void 0 : freezeValue({ ...params.behavior });
|
|
1209
1199
|
return Object.freeze({
|
|
1210
1200
|
handler: params.handler,
|
|
1211
|
-
|
|
1201
|
+
sender: params.sender,
|
|
1202
|
+
archetype: params.archetype,
|
|
1203
|
+
action: params.action,
|
|
1204
|
+
convention: params.convention,
|
|
1205
|
+
...params.payload === void 0 ? {} : { payload },
|
|
1212
1206
|
...behavior === void 0 ? {} : { behavior }
|
|
1213
1207
|
});
|
|
1214
1208
|
}
|
|
@@ -1465,4 +1459,4 @@ export {
|
|
|
1465
1459
|
probeTargetCors,
|
|
1466
1460
|
startPajaServer
|
|
1467
1461
|
};
|
|
1468
|
-
//# sourceMappingURL=chunk-
|
|
1462
|
+
//# sourceMappingURL=chunk-EOCGC7A2.js.map
|