Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions src/fga/fga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ import { fetchAndDeserializeFGAList } from './utils/fetch-and-deserialize-list';
export class FGA {
constructor(private readonly workos: WorkOS) {}

/**
* @deprecated The FGA module is deprecated. Use the Authorization module instead.
* @see src/authorization/authorization.ts
*/
Comment on lines +62 to +64
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 @see reference may be insufficient for some FGA methods

The @see src/authorization/authorization.ts annotation is applied uniformly to all 12 methods, but 6 of them — checkBatch, writeWarrant, batchWriteWarrants, listWarrants, query, and batchWriteResources — have no direct equivalent in the Authorization module. Developers trying to migrate those calls will find no corresponding method to switch to.

Consider supplementing the @see tag with a link to an external migration guide or changelog entry that covers every FGA method, not only those that map cleanly into Authorization.

async check(
checkOptions: CheckOptions,
options: CheckRequestOptions = {},
Expand All @@ -70,6 +74,10 @@ export class FGA {
return new CheckResult(data);
}

/**
* @deprecated The FGA module is deprecated. Use the Authorization module instead.
* @see src/authorization/authorization.ts
*/
async checkBatch(
checkOptions: CheckBatchOptions,
options: CheckRequestOptions = {},
Expand All @@ -84,6 +92,10 @@ export class FGA {
);
}

/**
* @deprecated The FGA module is deprecated. Use the Authorization module instead.
* @see src/authorization/authorization.ts
*/
async createResource(resource: CreateResourceOptions): Promise<Resource> {
const { data } = await this.workos.post<ResourceResponse>(
'/fga/v1/resources',
Expand All @@ -93,6 +105,10 @@ export class FGA {
return deserializeResource(data);
}

/**
* @deprecated The FGA module is deprecated. Use the Authorization module instead.
* @see src/authorization/authorization.ts
*/
async getResource(
resource: ResourceInterface | ResourceOptions,
): Promise<Resource> {
Expand All @@ -110,6 +126,10 @@ export class FGA {
return deserializeResource(data);
}

/**
* @deprecated The FGA module is deprecated. Use the Authorization module instead.
* @see src/authorization/authorization.ts
*/
async listResources(
options?: ListResourcesOptions,
): Promise<AutoPaginatable<Resource, SerializedListResourcesOptions>> {
Expand All @@ -131,6 +151,10 @@ export class FGA {
);
}

/**
* @deprecated The FGA module is deprecated. Use the Authorization module instead.
* @see src/authorization/authorization.ts
*/
async updateResource(options: UpdateResourceOptions): Promise<Resource> {
const resourceType = isResourceInterface(options.resource)
? options.resource.getResourceType()
Expand All @@ -149,6 +173,10 @@ export class FGA {
return deserializeResource(data);
}

/**
* @deprecated The FGA module is deprecated. Use the Authorization module instead.
* @see src/authorization/authorization.ts
*/
async deleteResource(resource: DeleteResourceOptions): Promise<void> {
const resourceType = isResourceInterface(resource)
? resource.getResourceType()
Expand All @@ -160,6 +188,10 @@ export class FGA {
await this.workos.delete(`/fga/v1/resources/${resourceType}/${resourceId}`);
}

/**
* @deprecated The FGA module is deprecated. Use the Authorization module instead.
* @see src/authorization/authorization.ts
*/
async batchWriteResources(
options: BatchWriteResourcesOptions,
): Promise<Resource[]> {
Expand All @@ -170,6 +202,10 @@ export class FGA {
return deserializeBatchWriteResourcesResponse(data);
}

/**
* @deprecated The FGA module is deprecated. Use the Authorization module instead.
* @see src/authorization/authorization.ts
*/
async writeWarrant(options: WriteWarrantOptions): Promise<WarrantToken> {
const { data } = await this.workos.post<WarrantTokenResponse>(
'/fga/v1/warrants',
Expand All @@ -179,6 +215,10 @@ export class FGA {
return deserializeWarrantToken(data);
}

/**
* @deprecated The FGA module is deprecated. Use the Authorization module instead.
* @see src/authorization/authorization.ts
*/
async batchWriteWarrants(
options: WriteWarrantOptions[],
): Promise<WarrantToken> {
Expand All @@ -190,6 +230,10 @@ export class FGA {
return deserializeWarrantToken(warrantToken);
}

/**
* @deprecated The FGA module is deprecated. Use the Authorization module instead.
* @see src/authorization/authorization.ts
*/
async listWarrants(
options?: ListWarrantsOptions,
requestOptions?: ListWarrantsRequestOptions,
Expand All @@ -214,6 +258,10 @@ export class FGA {
);
}

/**
* @deprecated The FGA module is deprecated. Use the Authorization module instead.
* @see src/authorization/authorization.ts
*/
async query(
options: QueryOptions,
requestOptions: QueryRequestOptions = {},
Expand Down
Loading