@qmuse/cloud-client 1.0.5 → 1.0.6-dev.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/README.md +51 -3
- package/dist/adapters.d.ts +17 -1
- package/dist/adapters.d.ts.map +1 -1
- package/dist/adapters.js +22 -2
- package/dist/adapters.js.map +1 -1
- package/dist/auth.d.ts +8 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +223 -50
- package/dist/auth.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +86 -28
- package/dist/client.js.map +1 -1
- package/dist/diagnostics.d.ts +1 -1
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +23 -2
- package/dist/diagnostics.js.map +1 -1
- package/dist/errors.d.ts +16 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +23 -0
- package/dist/errors.js.map +1 -1
- package/dist/files.d.ts +8 -2
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +197 -48
- package/dist/files.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jobs.d.ts +11 -0
- package/dist/jobs.d.ts.map +1 -0
- package/dist/jobs.js +124 -0
- package/dist/jobs.js.map +1 -0
- package/dist/miniapp.d.ts.map +1 -1
- package/dist/miniapp.js +24 -1
- package/dist/miniapp.js.map +1 -1
- package/dist/types.d.ts +86 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/web-session-coordination.d.ts +15 -0
- package/dist/web-session-coordination.d.ts.map +1 -0
- package/dist/web-session-coordination.js +63 -0
- package/dist/web-session-coordination.js.map +1 -0
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +13 -3
- package/dist/web.js.map +1 -1
- package/docs/auth.md +8 -1
- package/docs/files.md +163 -0
- package/docs/jobs.md +66 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @qmuse/cloud-client
|
|
2
2
|
|
|
3
3
|
用户名密码登录请先读 [认证接入契约与完整示例](docs/auth.md):包含输入字段、用户返回值、恢复会话、注册后登录和退出。
|
|
4
|
+
|
|
5
|
+
异步长任务候选请读 [提交、续查与结果确认契约](docs/jobs.md):包括账号绑定、原业务键重试和回执丢失恢复;需搭配更新后的 Function 认证 helper,尚未公共发布。
|
|
4
6
|
下方 SDK 示例使用宿主已初始化的客户端;QMuse 生成项目通过 `src/services/cloud` 接入,项目接入说明由 CLI 同步此认证契约。
|
|
5
7
|
|
|
6
8
|
Unified Web/PC/mini-program client for QMuse Cloud services. Business APIs use
|
|
@@ -136,8 +138,11 @@ The name is used for both the upload intent and every multipart chunk. For a
|
|
|
136
138
|
|
|
137
139
|
The upload flow creates an intent through `qmuse-cloud-api`, uploads in 5 MiB
|
|
138
140
|
chunks through the injected Web or mini-program data-plane transport, then
|
|
139
|
-
completes the intent through the Function. Failures
|
|
140
|
-
|
|
141
|
+
completes the intent through the Function. Failures preserve the original upload
|
|
142
|
+
reference and never automatically cancel or retransmit the file. The unreleased
|
|
143
|
+
recovery API adds `onUploadState`, `prepareUpload`, `completeUpload` and explicit
|
|
144
|
+
`cancelUpload`; see [file recovery](docs/files.md). An intent expiry does not
|
|
145
|
+
schedule physical file cleanup. Preview/download access is
|
|
141
146
|
authorized by the Function and may return a short-lived File Token URL or an
|
|
142
147
|
authenticated URL that the Web transport converts to a disposable Blob URL.
|
|
143
148
|
The client intentionally exposes no file-list API; applications keep the file
|
|
@@ -195,10 +200,47 @@ Only `/api` paths and an allowlist of business headers are accepted. The client
|
|
|
195
200
|
uses synchronous Function execution, reads `responseStatusCode`, `responseBody`,
|
|
196
201
|
and `responseHeaders`, and maps non-2xx responses to `QmuseCloudHttpError`.
|
|
197
202
|
|
|
203
|
+
Ordinary requests capture the method, path, query, allowed headers and JSON body
|
|
204
|
+
when invoked, before Session preparation can yield. Later form edits do not
|
|
205
|
+
change that submitted intent. A permitted transport401 retry uses the same body
|
|
206
|
+
and business headers. Non-serializable bodies fail before authentication or
|
|
207
|
+
submission with `BODY_NOT_SERIALIZABLE`.
|
|
208
|
+
|
|
198
209
|
The client never replays a completed Function response, including a business
|
|
199
210
|
401, because replaying a write could duplicate side effects. The host adapter is
|
|
200
211
|
responsible for Session coordination and may retry `createExecution` once only
|
|
201
212
|
when the execution API request itself fails with a transport-level 401.
|
|
213
|
+
The shared Auth runtime checks identity before that retry and before returning a
|
|
214
|
+
successful response. Logout, login, explicit Session restore, or renewal to a
|
|
215
|
+
different user or role invalidates an in-flight response with `AUTH_STATE_CHANGED`;
|
|
216
|
+
the same applies when a trusted profile response updates the cached role.
|
|
217
|
+
Same-user, same-role Session renewal keeps ordinary requests valid. A changed
|
|
218
|
+
identity cannot refresh and replay the old request. This applies to file metadata
|
|
219
|
+
and access URLs through the same request path. It does not roll back an operation
|
|
220
|
+
that already ran on the server; reconcile writes before resubmitting them.
|
|
221
|
+
|
|
222
|
+
Login, provider/miniapp login, logout, and logout-all close the old identity
|
|
223
|
+
boundary as soon as they begin. Until that change finishes, new business work,
|
|
224
|
+
Session restore/refresh, and a second authentication change fail with
|
|
225
|
+
`AUTH_STATE_CHANGED`. Successful login opens the new identity; successful logout
|
|
226
|
+
confirms anonymous public access. After a failed change, preserve the actual
|
|
227
|
+
error and explicitly restore the Session before submitting new business work.
|
|
228
|
+
|
|
229
|
+
The Web entry also sends credential-free Session-change notices between
|
|
230
|
+
same-origin tabs, scoped to the AppBase endpoint and Project. Login and logout
|
|
231
|
+
invalidate other tabs' cached identity and pending request boundaries. Receiving
|
|
232
|
+
a notice also blocks new business requests with `AUTH_STATE_CHANGED` until an
|
|
233
|
+
explicit Session restore or successful login acknowledges the current identity.
|
|
234
|
+
Session refresh cannot acknowledge this change. Clear old UI data before
|
|
235
|
+
loading the restored user's data; no old request is replayed. Ordinary requests
|
|
236
|
+
carry an internal expected-user condition, using nonempty `@anonymous` for
|
|
237
|
+
an explicitly anonymous Session so execution transports cannot drop the condition.
|
|
238
|
+
Public file routes check it even without a Session, before creating database
|
|
239
|
+
capabilities. An owner mismatch reported by native Account
|
|
240
|
+
verification or the backend requires the same explicit recovery.
|
|
241
|
+
Storage availability and origin boundaries limit these notices. The backend
|
|
242
|
+
must still check the initiating-user condition against the verified principal
|
|
243
|
+
to protect changes that the SDK has not observed.
|
|
202
244
|
|
|
203
245
|
Direct Storage upload is an internal data-plane optimization, not a claim that
|
|
204
246
|
the bucket ID is secret on the network or that the protocol can only reach the
|
|
@@ -224,6 +266,12 @@ aborts are not reported; server errors, failed executions, network failures and
|
|
|
224
266
|
404/405/408/429 responses are diagnostic candidates. Runtime configuration
|
|
225
267
|
loading and direct Storage transfers are outside this Function-request observer.
|
|
226
268
|
|
|
269
|
+
Request IDs prefer a valid `X-Request-ID` response header. If that header is
|
|
270
|
+
missing or unusable, a small JSON error envelope may supply its validated
|
|
271
|
+
`error.requestId`. No error text, details or other payload fields are forwarded.
|
|
272
|
+
A request ID is correlation metadata and does not imply a W3C Trace ID or
|
|
273
|
+
permission to retrieve backend logs.
|
|
274
|
+
|
|
227
275
|
`QmuseCloudClientOptions.onRequestFailure` is optional for custom host adapters;
|
|
228
276
|
observer failures cannot change request outcomes. The built-in web preview bridge
|
|
229
277
|
uses `qmuse.cloud-diagnostics` version 1 (`ready`, `connect`, `failure`,
|
|
@@ -266,4 +314,4 @@ temporarily normalizes the public package name and registry and restores
|
|
|
266
314
|
|
|
267
315
|
### Public file uploads
|
|
268
316
|
|
|
269
|
-
For
|
|
317
|
+
For Hono services configured for anonymous public uploads, `files.upload({ resource: 'public-file', file })` can run without an application login. The SDK forwards the upload-specific completion credential internally. A missing credential is a protocol error; it does not trigger login or a guest Session. The recovery candidate exposes the original failure through `QmuseCloudUploadError.cause` and retains its upload reference without cancelling. That reference contains a secret and must be stored privately. A lost initial anonymous intent response cannot be recovered from an idempotency key alone. Private files and avatars continue to require application identity. Login, registration, restore and refresh semantics are unchanged. Public direct uploads may be readable before completion; anonymous delete/cancel is not supported.
|
package/dist/adapters.d.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import type { CloudAccountCapability, CloudAuthOptions, CloudExecution, CloudExecutionInput, CloudFileTransport, QmuseCloudClient, QmuseCloudClientOptions } from './types.js';
|
|
1
|
+
import type { CloudAccountCapability, CloudAuthOptions, CloudExecution, CloudExecutionInput, CloudAsyncExecutionInput, CloudFileTransport, QmuseCloudClient, QmuseCloudClientOptions } from './types.js';
|
|
2
2
|
export type AppBaseExecutionInput = Omit<CloudExecutionInput, 'functionId'> & {
|
|
3
3
|
functionId: string;
|
|
4
4
|
};
|
|
5
|
+
export type AppBaseAsyncExecutionInput = Omit<CloudAsyncExecutionInput, 'functionId'> & {
|
|
6
|
+
functionId: string;
|
|
7
|
+
};
|
|
8
|
+
export interface AppBaseExecutionReference {
|
|
9
|
+
functionId: string;
|
|
10
|
+
executionId: string;
|
|
11
|
+
}
|
|
5
12
|
export interface AppBaseFunctionsCapability {
|
|
6
13
|
createExecution(input: AppBaseExecutionInput): Promise<CloudExecution>;
|
|
14
|
+
createAsyncExecution?(input: AppBaseAsyncExecutionInput): Promise<CloudExecution>;
|
|
15
|
+
getExecution?(input: AppBaseExecutionReference): Promise<CloudExecution>;
|
|
7
16
|
}
|
|
8
17
|
export interface AppBaseFunctionsSdkCapability {
|
|
9
18
|
createExecution(...args: never[]): Promise<CloudExecution>;
|
|
19
|
+
getExecution?(...args: never[]): Promise<CloudExecution>;
|
|
10
20
|
}
|
|
11
21
|
export declare function createAppBaseFunctionsCapability(functions: AppBaseFunctionsSdkCapability): AppBaseFunctionsCapability;
|
|
12
22
|
export interface AppBaseAccountSdkCapability {
|
|
@@ -42,14 +52,20 @@ export declare function createAppBaseAccountCapability(account: AppBaseAccountSd
|
|
|
42
52
|
export interface PortableExecutionInput extends Omit<AppBaseExecutionInput, 'path'> {
|
|
43
53
|
xpath: string;
|
|
44
54
|
}
|
|
55
|
+
export interface PortableAsyncExecutionInput extends Omit<AppBaseAsyncExecutionInput, 'path'> {
|
|
56
|
+
xpath: string;
|
|
57
|
+
}
|
|
45
58
|
export interface PortableAppwriteCapability {
|
|
46
59
|
executeFunction(input: PortableExecutionInput): Promise<CloudExecution>;
|
|
60
|
+
executeAsyncFunction?(input: PortableAsyncExecutionInput): Promise<CloudExecution>;
|
|
61
|
+
getFunctionExecution?(input: AppBaseExecutionReference): Promise<CloudExecution>;
|
|
47
62
|
}
|
|
48
63
|
export interface HostAdapterOptions<FileSource = never> {
|
|
49
64
|
onRequestFailure?: QmuseCloudClientOptions['onRequestFailure'];
|
|
50
65
|
functionId?: string;
|
|
51
66
|
auth?: CloudAuthOptions;
|
|
52
67
|
fileTransport?: CloudFileTransport<FileSource>;
|
|
68
|
+
fileScope?: QmuseCloudClientOptions['fileScope'];
|
|
53
69
|
}
|
|
54
70
|
export declare function createAppBaseWebCloudClient<FileSource = never>(functions: AppBaseFunctionsCapability, options?: HostAdapterOptions<FileSource>): QmuseCloudClient<FileSource>;
|
|
55
71
|
export declare function createPortableCloudClient<FileSource = never>(appwrite: PortableAppwriteCapability, options?: HostAdapterOptions<FileSource>): QmuseCloudClient<FileSource>;
|
package/dist/adapters.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../src/adapters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAGpB,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,mBAAmB,EAAE,YAAY,CAAC,GAAG;IAC5E,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../src/adapters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACt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AAU,GAAG,KAAK;IACpD,gBAAgB,CAAC,EAAE,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,aAAa,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC/C,SAAS,CAAC,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;CAClD;AAYD,wBAAgB,2BAA2B,CAAC,UAAU,GAAG,KAAK,EAC5D,SAAS,EAAE,0BAA0B,EACrC,OAAO,GAAE,kBAAkB,CAAC,UAAU,CAAM,GAC3C,gBAAgB,CAAC,UAAU,CAAC,CAgB9B;AAED,wBAAgB,yBAAyB,CAAC,UAAU,GAAG,KAAK,EAC1D,QAAQ,EAAE,0BAA0B,EACpC,OAAO,GAAE,kBAAkB,CAAC,UAAU,CAAM,GAC3C,gBAAgB,CAAC,UAAU,CAAC,CAsB9B"}
|
package/dist/adapters.js
CHANGED
|
@@ -9,6 +9,11 @@ export function createAppBaseFunctionsCapability(functions) {
|
|
|
9
9
|
const { path, ...sdkInput } = input;
|
|
10
10
|
return functions.createExecution({ ...sdkInput, xpath: path });
|
|
11
11
|
},
|
|
12
|
+
createAsyncExecution(input) {
|
|
13
|
+
const { path, ...sdkInput } = input;
|
|
14
|
+
return functions.createExecution({ ...sdkInput, xpath: path });
|
|
15
|
+
},
|
|
16
|
+
...(typeof functions.getExecution === 'function' ? { getExecution: (input) => functions.getExecution(input) } : {}),
|
|
12
17
|
};
|
|
13
18
|
}
|
|
14
19
|
export function createAppBaseAccountCapability(account) {
|
|
@@ -34,25 +39,40 @@ export function createAppBaseWebCloudClient(functions, options = {}) {
|
|
|
34
39
|
if (!functions || typeof functions.createExecution !== 'function') {
|
|
35
40
|
throw new TypeError('An AppBase Functions capability is required');
|
|
36
41
|
}
|
|
42
|
+
const boundFunctionId = options.functionId?.trim() || 'qmuse-cloud-api';
|
|
37
43
|
return createQmuseCloudClient({
|
|
38
|
-
execute: input => functions.createExecution(executionInput(input,
|
|
44
|
+
execute: input => functions.createExecution(executionInput(input, boundFunctionId)),
|
|
45
|
+
...(functions.createAsyncExecution && functions.getExecution ? { jobs: {
|
|
46
|
+
start: (input) => functions.createAsyncExecution({ ...input, functionId: boundFunctionId }),
|
|
47
|
+
get: (input) => functions.getExecution({ ...input, functionId: boundFunctionId }),
|
|
48
|
+
} } : {}),
|
|
39
49
|
...(options.onRequestFailure ? { onRequestFailure: options.onRequestFailure } : {}),
|
|
40
50
|
...(options.auth ? { auth: options.auth } : {}),
|
|
41
51
|
...(options.fileTransport ? { fileTransport: options.fileTransport } : {}),
|
|
52
|
+
...(options.fileScope ? { fileScope: { ...options.fileScope, functionId: boundFunctionId } } : {}),
|
|
42
53
|
});
|
|
43
54
|
}
|
|
44
55
|
export function createPortableCloudClient(appwrite, options = {}) {
|
|
45
56
|
if (!appwrite || typeof appwrite.executeFunction !== 'function') {
|
|
46
57
|
throw new TypeError('A portable Appwrite execution capability is required');
|
|
47
58
|
}
|
|
59
|
+
const boundFunctionId = options.functionId?.trim() || 'qmuse-cloud-api';
|
|
48
60
|
return createQmuseCloudClient({
|
|
49
61
|
execute: input => {
|
|
50
|
-
const { path, ...portableInput } = executionInput(input,
|
|
62
|
+
const { path, ...portableInput } = executionInput(input, boundFunctionId);
|
|
51
63
|
return appwrite.executeFunction({ ...portableInput, xpath: path });
|
|
52
64
|
},
|
|
65
|
+
...(appwrite.executeAsyncFunction && appwrite.getFunctionExecution ? { jobs: {
|
|
66
|
+
start: (input) => {
|
|
67
|
+
const { path, ...payload } = input;
|
|
68
|
+
return appwrite.executeAsyncFunction({ ...payload, functionId: boundFunctionId, xpath: path });
|
|
69
|
+
},
|
|
70
|
+
get: (input) => appwrite.getFunctionExecution({ ...input, functionId: boundFunctionId }),
|
|
71
|
+
} } : {}),
|
|
53
72
|
...(options.onRequestFailure ? { onRequestFailure: options.onRequestFailure } : {}),
|
|
54
73
|
...(options.auth ? { auth: options.auth } : {}),
|
|
55
74
|
...(options.fileTransport ? { fileTransport: options.fileTransport } : {}),
|
|
75
|
+
...(options.fileScope ? { fileScope: { ...options.fileScope, functionId: boundFunctionId } } : {}),
|
|
56
76
|
});
|
|
57
77
|
}
|
|
58
78
|
//# sourceMappingURL=adapters.js.map
|
package/dist/adapters.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../src/adapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../src/adapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAWrD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAmB5C,MAAM,UAAU,gCAAgC,CAC9C,SAAwC;IAExC,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,CAAC,eAAe,KAAK,UAAU,EAAE,CAAC;QAClE,MAAM,IAAI,SAAS,CAAC,iDAAiD,CAAC,CAAC;IACzE,CAAC;IACD,OAAO;QACL,eAAe,CAAC,KAAK;YACnB,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC;YACpC,OAAO,SAAS,CAAC,eAAe,CAAC,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAW,CAAC,CAAC;QAC1E,CAAC;QACD,oBAAoB,CAAC,KAAK;YACxB,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC;YACpC,OAAO,SAAS,CAAC,eAAe,CAAC,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAW,CAAC,CAAC;QAC1E,CAAC;QACD,GAAG,CAAC,OAAO,SAAS,CAAC,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC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O,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnF,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1E,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACnG,CAAC,CAAC;AACL,CAAC"}
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import type { CloudAuthOptions, CloudAuthUser, CloudRequest, CloudResponse, QmuseCloudAuth } from './types.js';
|
|
2
|
-
type AuthRequest = <T>(request: CloudRequest) => Promise<CloudResponse<T>>;
|
|
2
|
+
type AuthRequest = <T>(request: CloudRequest, expectedOwnerId?: string) => Promise<CloudResponse<T>>;
|
|
3
3
|
export type CloudAuthRuntime = QmuseCloudAuth & {
|
|
4
4
|
prepareRequest(): Promise<void>;
|
|
5
|
+
getSessionVersion(): number;
|
|
6
|
+
/** Request identity boundaries; same-user, same-role renewal preserves them. */
|
|
7
|
+
getRequestIdentityVersion(): number;
|
|
8
|
+
/** External Session changes require explicit restore or successful login before business requests. */
|
|
9
|
+
invalidateSession(version: number, requireRestore?: boolean): void;
|
|
10
|
+
/** Verify native identity without advancing the cache version for an unchanged owner. */
|
|
11
|
+
validateSessionOwner(ownerId: string | null): Promise<void>;
|
|
5
12
|
};
|
|
6
13
|
export declare function toCloudAuthUser(value: {
|
|
7
14
|
$id: string;
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EAKb,YAAY,EACZ,aAAa,EACb,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,KAAK,WAAW,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EAKb,YAAY,EACZ,aAAa,EACb,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,KAAK,WAAW,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AAErG,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG;IAC9C,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,iBAAiB,IAAI,MAAM,CAAC;IAC5B,gFAAgF;IAChF,yBAAyB,IAAI,MAAM,CAAC;IACpC,sGAAsG;IACtG,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACnE,yFAAyF;IACzF,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D,CAAC;AAoBF,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAA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