@go-avro/avro-js 1.6.4 → 1.6.5

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.
@@ -1,7 +1,7 @@
1
1
  import { Socket } from 'socket.io-client';
2
2
  import { InfiniteData, QueryClient, UseInfiniteQueryResult, useMutation, UseQueryResult } from '@tanstack/react-query';
3
3
  import { AuthManager } from '../auth/AuthManager.js';
4
- import { _Event, ActiveSessionSummary, AddressFeatureCollection, ApiInfo, Avro, StorageAnalytics, ClientErrorReport, ErrorLogEntry, PerformanceMetrics, AuditLogEntry, AuditQueryParams, Bill, BillInsightData, BillLineItemStatusUpdate, BillStatus, Break, Chat, CheckIn, Company, DelayEventCreatePayload, EventUpdatePayload, LineItemType, FinancialInsightData, RevenueInsightData, Job, JobUpdate, EventInsightData, AppleLoginResult, LoginResponse, Message, Plan, Route, ServiceMonth, Session, Team, User, UserCompanyAssociation, UserMergeSummary, Skill, Group, Label, RouteScheduleConfig, RouteWritePayload, CatalogItem, Device, DeviceInfo, LocationServicesStatus, Payout, Prepayment, Timecard, TimecardActionType, TimecardStatus } from '../types/api.js';
4
+ import { _Event, ActiveSessionSummary, AddressFeatureCollection, ApiInfo, Avro, StorageAnalytics, ClientErrorReport, ErrorLogEntry, PerformanceMetrics, AuditLogEntry, AuditQueryParams, Bill, BillInsightData, BillLineItemStatusUpdate, BillStatus, Break, Chat, CheckIn, Company, DelayEventCreatePayload, EventUpdatePayload, LineItemType, FinancialInsightData, RevenueInsightData, Job, JobUpdate, EventInsightData, AppleLinkProof, AppleLoginResult, LoginResponse, Message, Plan, Route, ServiceMonth, Session, Team, User, UserCompanyAssociation, UserMergeSummary, Skill, Group, Label, RouteScheduleConfig, RouteWritePayload, CatalogItem, Device, DeviceInfo, LocationServicesStatus, Payout, Prepayment, Timecard, TimecardActionType, TimecardStatus } from '../types/api.js';
5
5
  import { AuthState, Tokens } from '../types/auth.js';
6
6
  import { CancelToken, ClientId, RetryStrategy } from '../types/client.js';
7
7
  import { StandardError } from '../types/error.js';
@@ -884,10 +884,7 @@ export declare class AvroQueryClient {
884
884
  /** Link an Apple ID to the signed-in account (fresh token + raw nonce). */
885
885
  useAppleLink(): ReturnType<typeof useMutation<{
886
886
  msg: string;
887
- }, StandardError, {
888
- token: string;
889
- nonce: string;
890
- authorizationCode?: string | null;
887
+ }, StandardError, AppleLinkProof & {
891
888
  cancelToken?: CancelToken;
892
889
  }>>;
893
890
  /** Unlink the account's Apple ID; the server revokes Apple's grant. */
@@ -702,13 +702,14 @@ export class AvroQueryClient {
702
702
  /** Link an Apple ID to the signed-in account (fresh token + raw nonce). */
703
703
  useAppleLink() {
704
704
  return useMutation({
705
- mutationFn: async ({ token, nonce, authorizationCode, cancelToken, }) => {
705
+ mutationFn: async ({ cancelToken, ...proof }) => {
706
706
  return this.post({
707
707
  path: '/apple/link',
708
708
  data: JSON.stringify({
709
- token,
710
- nonce,
711
- authorization_code: authorizationCode ?? undefined,
709
+ ...('appleToken' in proof
710
+ ? { apple_token: proof.appleToken }
711
+ : { token: proof.token, nonce: proof.nonce }),
712
+ authorization_code: proof.authorizationCode ?? undefined,
712
713
  }),
713
714
  cancelToken,
714
715
  headers: { 'Content-Type': 'application/json' },
@@ -59,7 +59,8 @@ export declare const LoginResponse: {
59
59
  export type LoginResponse = (typeof LoginResponse)[keyof typeof LoginResponse];
60
60
  /**
61
61
  * Outcome of `useAppleLogin`. With no account for the Apple ID yet,
62
- * `apple_token` is a one-time handle (10 min) for `useAppleRegister`.
62
+ * `apple_token` is a one-time handle (10 min) for `useAppleRegister`, or for
63
+ * `useAppleLink` after signing in another way.
63
64
  */
64
65
  export type AppleLoginResult = {
65
66
  status: typeof LoginResponse.SUCCESS;
@@ -69,6 +70,18 @@ export type AppleLoginResult = {
69
70
  email: string | null;
70
71
  is_private_email: boolean;
71
72
  };
73
+ /**
74
+ * Proof of the Apple ID `useAppleLink` attaches: a fresh identity token and
75
+ * its raw nonce, or the `apple_token` handle from a `NEEDS_ACCOUNT` sign-in.
76
+ */
77
+ export type AppleLinkProof = {
78
+ token: string;
79
+ nonce: string;
80
+ authorizationCode?: string | null;
81
+ } | {
82
+ appleToken: string;
83
+ authorizationCode?: string | null;
84
+ };
72
85
  export interface ApiInfo {
73
86
  app_semver: string;
74
87
  build_time: string;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const AVRO_JS_VERSION = "1.6.4";
1
+ export declare const AVRO_JS_VERSION = "1.6.5";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED by scripts/gen-version.js — do not edit by hand.
2
2
  // Regenerated from package.json by the `prebuild` npm hook.
3
- export const AVRO_JS_VERSION = '1.6.4';
3
+ export const AVRO_JS_VERSION = '1.6.5';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",