@gasboost/auth 0.2.0 → 0.2.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.
@@ -58,7 +58,45 @@ export type AuthSchema = {
58
58
  };
59
59
  };
60
60
  };
61
- export declare class AuthSchemaConfig {
62
- readonly schema: AuthSchema;
63
- constructor(options?: AuthSchemaOptions);
61
+ type Section<O, K extends PropertyKey> = K extends keyof O ? O[K] : undefined;
62
+ type Fields<T> = [T] extends [null | undefined] ? undefined : "fields" extends keyof NonNullable<T> ? NonNullable<T>["fields"] : undefined;
63
+ type PropertyOrDefault<T, K extends PropertyKey, Default extends string> = [
64
+ T
65
+ ] extends [null | undefined] ? Default : K extends keyof NonNullable<T> ? Exclude<NonNullable<T>[K], undefined> extends infer Value ? [Value] extends [never] ? Default : Value extends string ? Value : Default : Default : Default;
66
+ type ResolveAuthSchema<O extends AuthSchemaOptions> = {
67
+ dbId: O["dbId"];
68
+ user: {
69
+ modelName: PropertyOrDefault<Section<O, "user">, "modelName", "user">;
70
+ fields: {
71
+ id: PropertyOrDefault<Fields<Section<O, "user">>, "id", "id">;
72
+ name: PropertyOrDefault<Fields<Section<O, "user">>, "name", "name">;
73
+ };
74
+ };
75
+ account: {
76
+ modelName: PropertyOrDefault<Section<O, "account">, "modelName", "account">;
77
+ fields: {
78
+ id: PropertyOrDefault<Fields<Section<O, "account">>, "id", "id">;
79
+ userId: PropertyOrDefault<Fields<Section<O, "account">>, "userId", "userId">;
80
+ provider: PropertyOrDefault<Fields<Section<O, "account">>, "provider", "provider">;
81
+ providerAccountId: PropertyOrDefault<Fields<Section<O, "account">>, "providerAccountId", "providerAccountId">;
82
+ passwordHash: PropertyOrDefault<Fields<Section<O, "account">>, "passwordHash", "passwordHash">;
83
+ };
84
+ };
85
+ passwordReset: {
86
+ modelName: PropertyOrDefault<Section<O, "passwordReset">, "modelName", "passwordReset">;
87
+ fields: {
88
+ id: PropertyOrDefault<Fields<Section<O, "passwordReset">>, "id", "id">;
89
+ accountId: PropertyOrDefault<Fields<Section<O, "passwordReset">>, "accountId", "accountId">;
90
+ tokenHash: PropertyOrDefault<Fields<Section<O, "passwordReset">>, "tokenHash", "tokenHash">;
91
+ expiresAt: PropertyOrDefault<Fields<Section<O, "passwordReset">>, "expiresAt", "expiresAt">;
92
+ enabled: PropertyOrDefault<Fields<Section<O, "passwordReset">>, "enabled", "enabled">;
93
+ };
94
+ };
95
+ };
96
+ export declare class AuthSchemaConfig<const O extends AuthSchemaOptions = {
97
+ dbId: "";
98
+ }> {
99
+ readonly schema: ResolveAuthSchema<O>;
100
+ constructor(options?: O);
64
101
  }
102
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gasboost/auth",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Modern authentication for Google Apps Script with email/password, Apps Script authentication, sessions, and password reset.",
5
5
  "keywords": [
6
6
  "google-apps-script",