@meshagent/meshagent-ts-auth 0.36.1 → 0.36.3
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/CHANGELOG.md +10 -0
- package/dist/browser/ma-auth.global.js +57 -43
- package/dist/cjs/ensure-login.js +1 -1
- package/dist/esm/ensure-login.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [0.36.3]
|
|
2
|
+
- Storage client now supports move operations and emits file moved events.
|
|
3
|
+
- Secrets client now supports existence checks.
|
|
4
|
+
- Project user add calls now omit permission fields unless explicitly set.
|
|
5
|
+
- Updated JS toolchain dependencies: esbuild 0.28.0, jest 30.3.0, mocha 12.0.0-beta-9.2, @tailwindcss/vite 4.2.2, @vitejs/plugin-react 6.0.1, vite 8.0.7.
|
|
6
|
+
|
|
7
|
+
## [0.36.2]
|
|
8
|
+
- Breaking: Removed share-connect API from the TypeScript client (`connectShare` / RoomShareConnectionInfo).
|
|
9
|
+
- OAuth helpers now default requested scope to `profile` (TS auth + React auth).
|
|
10
|
+
|
|
1
11
|
## [0.36.1]
|
|
2
12
|
- Stability
|
|
3
13
|
|
|
@@ -6148,7 +6148,7 @@ meshagent.auth = (() => {
|
|
|
6148
6148
|
} catch (e) {
|
|
6149
6149
|
}
|
|
6150
6150
|
var varStorage = _localStorage;
|
|
6151
|
-
var EqualityTraitSymbol = Symbol("Equality");
|
|
6151
|
+
var EqualityTraitSymbol = /* @__PURE__ */ Symbol("Equality");
|
|
6152
6152
|
var equals = (a, b) => a === b || !!a?.[EqualityTraitSymbol]?.(b) || false;
|
|
6153
6153
|
var isObject2 = (o) => typeof o === "object";
|
|
6154
6154
|
var assign = Object.assign;
|
|
@@ -6354,7 +6354,7 @@ meshagent.auth = (() => {
|
|
|
6354
6354
|
return str;
|
|
6355
6355
|
};
|
|
6356
6356
|
var oneOf = (gen, array) => array[int31(gen, 0, array.length - 1)];
|
|
6357
|
-
var schemaSymbol = Symbol("0schema");
|
|
6357
|
+
var schemaSymbol = /* @__PURE__ */ Symbol("0schema");
|
|
6358
6358
|
var ValidationError = class {
|
|
6359
6359
|
constructor() {
|
|
6360
6360
|
this._rerrs = [];
|
|
@@ -6632,7 +6632,7 @@ meshagent.auth = (() => {
|
|
|
6632
6632
|
}
|
|
6633
6633
|
};
|
|
6634
6634
|
var $$stringTemplate = $constructedBy($StringTemplate);
|
|
6635
|
-
var isOptionalSymbol = Symbol("optional");
|
|
6635
|
+
var isOptionalSymbol = /* @__PURE__ */ Symbol("optional");
|
|
6636
6636
|
var $Optional = class extends Schema {
|
|
6637
6637
|
/**
|
|
6638
6638
|
* @param {S} shape
|
|
@@ -16503,7 +16503,7 @@ ${err.toString()}`);
|
|
|
16503
16503
|
"../meshagent-ts/dist/browser/room-event.js"(exports) {
|
|
16504
16504
|
"use strict";
|
|
16505
16505
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16506
|
-
exports.RoomLogEvent = exports.FileUpdatedEvent = exports.FileDeletedEvent = exports.FileCreatedEvent = exports.RoomMessageEvent = exports.RoomMessage = exports.RoomEvent = void 0;
|
|
16506
|
+
exports.RoomLogEvent = exports.FileMovedEvent = exports.FileUpdatedEvent = exports.FileDeletedEvent = exports.FileCreatedEvent = exports.RoomMessageEvent = exports.RoomMessage = exports.RoomEvent = void 0;
|
|
16507
16507
|
var RoomEvent = class {
|
|
16508
16508
|
};
|
|
16509
16509
|
exports.RoomEvent = RoomEvent;
|
|
@@ -16571,6 +16571,21 @@ ${err.toString()}`);
|
|
|
16571
16571
|
}
|
|
16572
16572
|
};
|
|
16573
16573
|
exports.FileUpdatedEvent = FileUpdatedEvent;
|
|
16574
|
+
var FileMovedEvent = class extends RoomEvent {
|
|
16575
|
+
constructor({ sourcePath, destinationPath, participantId }) {
|
|
16576
|
+
super();
|
|
16577
|
+
this.sourcePath = sourcePath;
|
|
16578
|
+
this.destinationPath = destinationPath;
|
|
16579
|
+
this.participantId = participantId;
|
|
16580
|
+
}
|
|
16581
|
+
get name() {
|
|
16582
|
+
return "file moved";
|
|
16583
|
+
}
|
|
16584
|
+
get description() {
|
|
16585
|
+
return `a file was moved from ${this.sourcePath} to ${this.destinationPath}`;
|
|
16586
|
+
}
|
|
16587
|
+
};
|
|
16588
|
+
exports.FileMovedEvent = FileMovedEvent;
|
|
16574
16589
|
var RoomLogEvent = class extends RoomEvent {
|
|
16575
16590
|
constructor({ type, data }) {
|
|
16576
16591
|
super();
|
|
@@ -17703,7 +17718,7 @@ ${err.toString()}`);
|
|
|
17703
17718
|
var init_helpers = __esm({
|
|
17704
17719
|
"../node_modules/jose/dist/webapi/lib/helpers.js"() {
|
|
17705
17720
|
init_base64url();
|
|
17706
|
-
unprotected = Symbol();
|
|
17721
|
+
unprotected = /* @__PURE__ */ Symbol();
|
|
17707
17722
|
}
|
|
17708
17723
|
});
|
|
17709
17724
|
|
|
@@ -20828,8 +20843,8 @@ ${newlined}
|
|
|
20828
20843
|
const VERSION = "v6.2.2";
|
|
20829
20844
|
USER_AGENT = `${NAME}/${VERSION}`;
|
|
20830
20845
|
}
|
|
20831
|
-
customFetch = Symbol();
|
|
20832
|
-
jwksCache = Symbol();
|
|
20846
|
+
customFetch = /* @__PURE__ */ Symbol();
|
|
20847
|
+
jwksCache = /* @__PURE__ */ Symbol();
|
|
20833
20848
|
RemoteJWKSet = class {
|
|
20834
20849
|
constructor(url, options) {
|
|
20835
20850
|
__privateAdd(this, _url);
|
|
@@ -22654,28 +22669,6 @@ ${newlined}
|
|
|
22654
22669
|
settings: settings && typeof settings === "object" ? settings : {}
|
|
22655
22670
|
};
|
|
22656
22671
|
}
|
|
22657
|
-
parseRoomShareConnectionInfo(data) {
|
|
22658
|
-
if (!data || typeof data !== "object") {
|
|
22659
|
-
throw new requirement_1.RoomException("Invalid room share connection payload");
|
|
22660
|
-
}
|
|
22661
|
-
const { jwt, room_name: roomNameRaw, roomName, project_id: projectIdRaw, projectId, settings, room_url: roomUrlRaw, roomUrl } = data;
|
|
22662
|
-
if (typeof jwt !== "string") {
|
|
22663
|
-
throw new requirement_1.RoomException("Invalid room share connection payload: missing jwt");
|
|
22664
|
-
}
|
|
22665
|
-
const roomNameValue = typeof roomName === "string" ? roomName : roomNameRaw;
|
|
22666
|
-
const projectIdValue = typeof projectId === "string" ? projectId : projectIdRaw;
|
|
22667
|
-
const roomUrlValue = typeof roomUrl === "string" ? roomUrl : roomUrlRaw;
|
|
22668
|
-
if (typeof roomNameValue !== "string" || typeof projectIdValue !== "string" || typeof roomUrlValue !== "string") {
|
|
22669
|
-
throw new requirement_1.RoomException("Invalid room share connection payload: missing fields");
|
|
22670
|
-
}
|
|
22671
|
-
return {
|
|
22672
|
-
jwt,
|
|
22673
|
-
roomName: roomNameValue,
|
|
22674
|
-
projectId: projectIdValue,
|
|
22675
|
-
settings: settings && typeof settings === "object" ? settings : {},
|
|
22676
|
-
roomUrl: roomUrlValue
|
|
22677
|
-
};
|
|
22678
|
-
}
|
|
22679
22672
|
parseRoomSession(data) {
|
|
22680
22673
|
if (!data || typeof data !== "object") {
|
|
22681
22674
|
throw new requirement_1.RoomException("Invalid room session payload");
|
|
@@ -23080,14 +23073,6 @@ ${newlined}
|
|
|
23080
23073
|
const shares = Array.isArray(data?.shares) ? data.shares : [];
|
|
23081
23074
|
return shares.map((item) => this.parseRoomShare(item));
|
|
23082
23075
|
}
|
|
23083
|
-
async connectShare(shareId) {
|
|
23084
|
-
const data = await this.request(`/shares/${shareId}/connect`, {
|
|
23085
|
-
method: "POST",
|
|
23086
|
-
json: {},
|
|
23087
|
-
action: "connect share"
|
|
23088
|
-
});
|
|
23089
|
-
return this.parseRoomShareConnectionInfo(data);
|
|
23090
|
-
}
|
|
23091
23076
|
async createProject(name, settings) {
|
|
23092
23077
|
return await this.request(`/accounts/projects`, {
|
|
23093
23078
|
method: "POST",
|
|
@@ -23096,15 +23081,15 @@ ${newlined}
|
|
|
23096
23081
|
});
|
|
23097
23082
|
}
|
|
23098
23083
|
async addUserToProject(projectId, userId, options = {}) {
|
|
23099
|
-
const { isAdmin
|
|
23084
|
+
const { isAdmin, isDeveloper, canCreateRooms } = options;
|
|
23100
23085
|
return await this.request(`/accounts/projects/${projectId}/users`, {
|
|
23101
23086
|
method: "POST",
|
|
23102
23087
|
json: {
|
|
23103
23088
|
project_id: projectId,
|
|
23104
23089
|
user_id: userId,
|
|
23105
|
-
is_admin: isAdmin,
|
|
23106
|
-
is_developer: isDeveloper,
|
|
23107
|
-
can_create_rooms: canCreateRooms
|
|
23090
|
+
...isAdmin !== void 0 ? { is_admin: isAdmin } : {},
|
|
23091
|
+
...isDeveloper !== void 0 ? { is_developer: isDeveloper } : {},
|
|
23092
|
+
...canCreateRooms !== void 0 ? { can_create_rooms: canCreateRooms } : {}
|
|
23108
23093
|
},
|
|
23109
23094
|
action: "add user to project"
|
|
23110
23095
|
});
|
|
@@ -25057,7 +25042,7 @@ ${newlined}
|
|
|
25057
25042
|
await this._task;
|
|
25058
25043
|
}
|
|
25059
25044
|
};
|
|
25060
|
-
SyncOpenStreamState.INPUT_STREAM_CLOSE = Symbol("sync-open-input-close");
|
|
25045
|
+
SyncOpenStreamState.INPUT_STREAM_CLOSE = /* @__PURE__ */ Symbol("sync-open-input-close");
|
|
25061
25046
|
var SyncClient = class extends event_emitter_1.EventEmitter {
|
|
25062
25047
|
constructor({ room }) {
|
|
25063
25048
|
super();
|
|
@@ -25356,6 +25341,7 @@ ${newlined}
|
|
|
25356
25341
|
super();
|
|
25357
25342
|
this.client = room;
|
|
25358
25343
|
this.client.protocol.addHandler("storage.file.deleted", this._handleFileDeleted.bind(this));
|
|
25344
|
+
this.client.protocol.addHandler("storage.file.moved", this._handleFileMoved.bind(this));
|
|
25359
25345
|
this.client.protocol.addHandler("storage.file.updated", this._handleFileUpdated.bind(this));
|
|
25360
25346
|
}
|
|
25361
25347
|
async _handleFileUpdated(protocol, messageId, type, bytes) {
|
|
@@ -25370,6 +25356,16 @@ ${newlined}
|
|
|
25370
25356
|
this.client.emit(event);
|
|
25371
25357
|
this.emit("file.deleted", event);
|
|
25372
25358
|
}
|
|
25359
|
+
async _handleFileMoved(protocol, messageId, type, bytes) {
|
|
25360
|
+
const [data, _] = (0, utils_1.unpackMessage)(bytes || new Uint8Array());
|
|
25361
|
+
const event = new room_event_1.FileMovedEvent({
|
|
25362
|
+
sourcePath: data["source_path"],
|
|
25363
|
+
destinationPath: data["destination_path"],
|
|
25364
|
+
participantId: data["participant_id"]
|
|
25365
|
+
});
|
|
25366
|
+
this.client.emit(event);
|
|
25367
|
+
this.emit("file.moved", event);
|
|
25368
|
+
}
|
|
25373
25369
|
_unexpectedResponseError(operation) {
|
|
25374
25370
|
return _unexpectedStorageResponseError(operation);
|
|
25375
25371
|
}
|
|
@@ -25416,6 +25412,13 @@ ${newlined}
|
|
|
25416
25412
|
async delete(path, { recursive = null } = {}) {
|
|
25417
25413
|
await this._invoke("delete", { path, recursive });
|
|
25418
25414
|
}
|
|
25415
|
+
async move(sourcePath, destinationPath, { overwrite = false } = {}) {
|
|
25416
|
+
await this._invoke("move", {
|
|
25417
|
+
source_path: sourcePath,
|
|
25418
|
+
destination_path: destinationPath,
|
|
25419
|
+
overwrite
|
|
25420
|
+
});
|
|
25421
|
+
}
|
|
25419
25422
|
async exists(path) {
|
|
25420
25423
|
const result = await this._invoke("exists", { path });
|
|
25421
25424
|
if (!(result instanceof response_1.JsonContent)) {
|
|
@@ -26011,6 +26014,17 @@ ${newlined}
|
|
|
26011
26014
|
}
|
|
26012
26015
|
return secrets.map((item) => this.parseSecretInfo(item));
|
|
26013
26016
|
}
|
|
26017
|
+
async exists({ secretId, delegatedTo, forIdentity }) {
|
|
26018
|
+
const response = await this.invoke("exists", {
|
|
26019
|
+
secret_id: secretId,
|
|
26020
|
+
delegated_to: delegatedTo ?? null,
|
|
26021
|
+
for_identity: forIdentity ?? null
|
|
26022
|
+
});
|
|
26023
|
+
if (!(response instanceof response_1.JsonContent) || typeof response.json["exists"] !== "boolean") {
|
|
26024
|
+
throw this.unexpectedResponse("exists");
|
|
26025
|
+
}
|
|
26026
|
+
return response.json["exists"];
|
|
26027
|
+
}
|
|
26014
26028
|
async deleteSecret({ secretId, delegatedTo }) {
|
|
26015
26029
|
const response = await this.invoke("delete_secret", {
|
|
26016
26030
|
id: secretId,
|
|
@@ -27085,7 +27099,7 @@ ${newlined}
|
|
|
27085
27099
|
const pkce = await generator.generate();
|
|
27086
27100
|
await cache2.saveVerifier(pkce.codeVerifier);
|
|
27087
27101
|
const query = new URLSearchParams({
|
|
27088
|
-
scope: "
|
|
27102
|
+
scope: "profile",
|
|
27089
27103
|
client_id: oauthClientId,
|
|
27090
27104
|
code_challenge: pkce.codeChallenge,
|
|
27091
27105
|
response_type: "code",
|
package/dist/cjs/ensure-login.js
CHANGED
|
@@ -82,7 +82,7 @@ async function ensureLogin({ oauthClientId, serverUrl, callbackUrl, provider, })
|
|
|
82
82
|
const pkce = await generator.generate();
|
|
83
83
|
await cache.saveVerifier(pkce.codeVerifier);
|
|
84
84
|
const query = new URLSearchParams({
|
|
85
|
-
scope: "
|
|
85
|
+
scope: "profile",
|
|
86
86
|
client_id: oauthClientId,
|
|
87
87
|
code_challenge: pkce.codeChallenge,
|
|
88
88
|
response_type: "code",
|
package/dist/esm/ensure-login.js
CHANGED
|
@@ -79,7 +79,7 @@ export async function ensureLogin({ oauthClientId, serverUrl, callbackUrl, provi
|
|
|
79
79
|
const pkce = await generator.generate();
|
|
80
80
|
await cache.saveVerifier(pkce.codeVerifier);
|
|
81
81
|
const query = new URLSearchParams({
|
|
82
|
-
scope: "
|
|
82
|
+
scope: "profile",
|
|
83
83
|
client_id: oauthClientId,
|
|
84
84
|
code_challenge: pkce.codeChallenge,
|
|
85
85
|
response_type: "code",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshagent/meshagent-ts-auth",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.3",
|
|
4
4
|
"description": "Meshagent Typescript Auth",
|
|
5
5
|
"homepage": "https://github.com/meshagent/meshagent-ts-auth",
|
|
6
6
|
"scripts": {
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"CHANGELOG.md"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@meshagent/meshagent": "^0.36.
|
|
40
|
+
"@meshagent/meshagent": "^0.36.3",
|
|
41
41
|
"typescript": "^5.8.3"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"esbuild": "^0.
|
|
44
|
+
"esbuild": "^0.28.0",
|
|
45
45
|
"jest": "^30.3.0"
|
|
46
46
|
},
|
|
47
47
|
"overrides": {
|
|
48
48
|
"rollup": "4.52.5"
|
|
49
49
|
}
|
|
50
|
-
}
|
|
50
|
+
}
|