From 17742ec6dd990c8bcf6149048e1fd783917700f3 Mon Sep 17 00:00:00 2001 From: Amin Chirazi <32016576+AminChirazi@users.noreply.github.com> Date: Tue, 28 Jul 2026 12:05:02 +0400 Subject: [PATCH] feat: expose plans and masking on the client facade, bump to 0.9.0 Version 0.8.1 -> 0.9.0. A minor bump rather than a patch: this adds surface, it does not fix anything. Also completes the previous commit, which had a real gap. Every other resource is reachable BOTH as `client.sets.get_sets()` and as `client.get_sets()`, but plans and masking policies were only wired as properties. Two consequences: they read differently from every other resource, and - the part that actually matters - `artifacts/autocomplete-types.ts` is generated from the facade, so they were invisible to the editor autocomplete that ships to users. The artifact went from 89 methods to 98 once the facade methods existed. The artifact is regenerated here rather than left to a follow-up push, which is the hygiene #25 established: it is committed so consumers can fetch it at a tagged ref, and a tag cut at the bump commit permanently carries whatever artifact was in the tree at that moment. 69 tests pass, 24 skipped. `ruff check --select F,E9` reports 7 findings across the package, identical to the count on main - all pre-existing, none from this change. Co-Authored-By: Claude Opus 5 --- artifacts/autocomplete-types.ts | 76 ++++++++++++++++++- pyproject.toml | 2 +- src/datamaker/main.py | 129 ++++++++++++++++++++++++++++++++ uv.lock | 2 +- 4 files changed, 205 insertions(+), 4 deletions(-) diff --git a/artifacts/autocomplete-types.ts b/artifacts/autocomplete-types.ts index cf72e8d..1659739 100644 --- a/artifacts/autocomplete-types.ts +++ b/artifacts/autocomplete-types.ts @@ -1,6 +1,6 @@ // This file is auto-generated by the datamaker-py SDK // DO NOT EDIT MANUALLY -// Generated from version 0.8.1 +// Generated from version 0.9.0 // Monaco Editor CompletionItemKind enum values // Reference: https://microsoft.github.io/monaco-editor/api/enums/monaco.languages.CompletionItemKind.html @@ -49,7 +49,7 @@ export interface DataMakerFieldType { documentation?: string; } -export const SDK_VERSION = "0.8.1"; +export const SDK_VERSION = "0.9.0"; export const METHOD_SUGGESTIONS: DataMakerMethod[] = [ { @@ -764,6 +764,78 @@ export const METHOD_SUGGESTIONS: DataMakerMethod[] = [ detail: "Method: delete_keymap", sortText: "delete_keymap", }, + { + label: "get_plans", + kind: CompletionItemKind.Method, + insertText: "get_plans()", + documentation: "List the plans in the caller's active project. Returns: A list of plan dictionaries.", + detail: "Method: get_plans", + sortText: "get_plans", + }, + { + label: "get_plan", + kind: CompletionItemKind.Method, + insertText: "get_plan(${1:plan_id}: str)", + documentation: "Get a single plan by ID, including its full spec and history. Args: plan_id: The unique identifier of the plan. Returns: The plan dictionary.", + detail: "Method: get_plan", + sortText: "get_plan", + }, + { + label: "update_plan", + kind: CompletionItemKind.Method, + insertText: "update_plan(${1:plan_id}: str)", + documentation: "Update a plan. Args: plan_id: The unique identifier of the plan. **fields: Fields to change, e.g. title, summary, status. Returns: The updated plan dictionary.", + detail: "Method: update_plan", + sortText: "update_plan", + }, + { + label: "delete_plan", + kind: CompletionItemKind.Method, + insertText: "delete_plan(${1:plan_id}: str)", + documentation: "Delete a plan. Args: plan_id: The unique identifier of the plan. Returns: ``{\"success\": True}``. Note this differs from the other resources, which answer ``{\"message\": ...}``.", + detail: "Method: delete_plan", + sortText: "delete_plan", + }, + { + label: "get_masking_policies", + kind: CompletionItemKind.Method, + insertText: "get_masking_policies(${1:project_id}: Optional[str])", + documentation: "Get the masking policies in the caller's project/team scope. Args: project_id: Optional project ID to scope the listing to. Falls back to the DATAMAKER_PROJECT_ID env var. Returns: A list of masking policy dictionaries.", + detail: "Method: get_masking_policies", + sortText: "get_masking_policies", + }, + { + label: "get_masking_policy", + kind: CompletionItemKind.Method, + insertText: "get_masking_policy(${1:policy_id}: str)", + documentation: "Get a single masking policy by ID. Args: policy_id: The unique identifier of the policy. Returns: The masking policy dictionary.", + detail: "Method: get_masking_policy", + sortText: "get_masking_policy", + }, + { + label: "create_masking_policy", + kind: CompletionItemKind.Method, + insertText: "create_masking_policy(${1:name}: str, ${2:fields}: any, ${3:description}: Optional[str], ${4:consistent}: Optional[bool], ${5:reversible}: Optional[bool], ${6:key_map_name}: Optional[str], ${7:project_id}: Optional[str])", + documentation: "Create a masking policy. Args: name: The policy name. fields: The field rule list. description: Optional description. consistent: Same input masks to the same output. Omit to take the API's default. reversible: Record the mapping so masking can be reversed. Needs key_map_name to be useful. key_map_name: The KeyMap a reversible policy mints mappings into. project_id: Project to create it in. Falls back to DATAMAKER_PROJECT_ID. Returns: The created masking policy dictionary.", + detail: "Method: create_masking_policy", + sortText: "create_masking_policy", + }, + { + label: "update_masking_policy", + kind: CompletionItemKind.Method, + insertText: "update_masking_policy(${1:policy_id}: str)", + documentation: "Update a masking policy. Args: policy_id: The unique identifier of the policy. **fields: Fields to change. Use API spellings, e.g. keyMapName. Returns: The updated masking policy dictionary.", + detail: "Method: update_masking_policy", + sortText: "update_masking_policy", + }, + { + label: "delete_masking_policy", + kind: CompletionItemKind.Method, + insertText: "delete_masking_policy(${1:policy_id}: str)", + documentation: "Delete a masking policy. Args: policy_id: The unique identifier of the policy. Returns: ``{\"message\": \"Masking policy deleted\"}``.", + detail: "Method: delete_masking_policy", + sortText: "delete_masking_policy", + }, ]; export const FIELD_TYPE_SUGGESTIONS: DataMakerFieldType[] = [ diff --git a/pyproject.toml b/pyproject.toml index 76b692b..3081931 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "datamaker-py" -version = "0.8.1" +version = "0.9.0" description = "The official Python library for the Automators DataMaker API." readme = "README.md" requires-python = ">=3.11" diff --git a/src/datamaker/main.py b/src/datamaker/main.py index 7f567d8..1664367 100644 --- a/src/datamaker/main.py +++ b/src/datamaker/main.py @@ -938,6 +938,135 @@ def delete_keymap( # =================== PROPERTY ACCESS TO CLIENTS =================== # For advanced users who want direct access to specific clients + + # =================== PLAN METHODS =================== + def get_plans(self): + """List the plans in the caller's active project. + + Returns: + A list of plan dictionaries. + """ + return self._plans.get_plans() + + def get_plan(self, plan_id: str): + """Get a single plan by ID, including its full spec and history. + + Args: + plan_id: The unique identifier of the plan. + + Returns: + The plan dictionary. + """ + return self._plans.get_plan(plan_id) + + def update_plan(self, plan_id: str, **fields): + """Update a plan. + + Args: + plan_id: The unique identifier of the plan. + **fields: Fields to change, e.g. title, summary, status. + + Returns: + The updated plan dictionary. + """ + return self._plans.update_plan(plan_id, **fields) + + def delete_plan(self, plan_id: str): + """Delete a plan. + + Args: + plan_id: The unique identifier of the plan. + + Returns: + ``{"success": True}``. Note this differs from the other resources, + which answer ``{"message": ...}``. + """ + return self._plans.delete_plan(plan_id) + + # =================== MASKING POLICY METHODS =================== + def get_masking_policies(self, project_id: Optional[str] = None): + """Get the masking policies in the caller's project/team scope. + + Args: + project_id: Optional project ID to scope the listing to. Falls back + to the DATAMAKER_PROJECT_ID env var. + + Returns: + A list of masking policy dictionaries. + """ + return self._masking_policies.get_masking_policies(project_id) + + def get_masking_policy(self, policy_id: str): + """Get a single masking policy by ID. + + Args: + policy_id: The unique identifier of the policy. + + Returns: + The masking policy dictionary. + """ + return self._masking_policies.get_masking_policy(policy_id) + + def create_masking_policy( + self, + name: str, + fields, + description: Optional[str] = None, + consistent: Optional[bool] = None, + reversible: Optional[bool] = None, + key_map_name: Optional[str] = None, + project_id: Optional[str] = None, + ): + """Create a masking policy. + + Args: + name: The policy name. + fields: The field rule list. + description: Optional description. + consistent: Same input masks to the same output. Omit to take the + API's default. + reversible: Record the mapping so masking can be reversed. Needs + key_map_name to be useful. + key_map_name: The KeyMap a reversible policy mints mappings into. + project_id: Project to create it in. Falls back to + DATAMAKER_PROJECT_ID. + + Returns: + The created masking policy dictionary. + """ + return self._masking_policies.create_masking_policy( + name=name, + fields=fields, + description=description, + consistent=consistent, + reversible=reversible, + key_map_name=key_map_name, + project_id=project_id, + ) + + def update_masking_policy(self, policy_id: str, **fields): + """Update a masking policy. + + Args: + policy_id: The unique identifier of the policy. + **fields: Fields to change. Use API spellings, e.g. keyMapName. + + Returns: + The updated masking policy dictionary. + """ + return self._masking_policies.update_masking_policy(policy_id, **fields) + + def delete_masking_policy(self, policy_id: str): + """Delete a masking policy. + + Args: + policy_id: The unique identifier of the policy. + + Returns: + ``{"message": "Masking policy deleted"}``. + """ + return self._masking_policies.delete_masking_policy(policy_id) + @property def generation(self): """Access to generation client.""" diff --git a/uv.lock b/uv.lock index 4708481..df4cc8b 100644 --- a/uv.lock +++ b/uv.lock @@ -52,7 +52,7 @@ wheels = [ [[package]] name = "datamaker-py" -version = "0.8.1" +version = "0.9.0" source = { editable = "." } dependencies = [ { name = "python-dotenv" },