Commit 9566f89
Add TypeScript change feed sample (#10)
Implements the first JavaScript/TypeScript sample in the repo: a
self-contained change feed demo using `@azure/cosmos` v4.
## New files
- **`javascript/201-change-feed/src/index.ts`** — ES module with
top-level `await`; connects via key auth, creates `cosmicworks` DB +
`products` container, upserts two items, then drains the change feed
from the beginning using `getChangeFeedIterator` /
`ChangeFeedStartFrom.Beginning()`, stopping on `304 Not Modified`
- **`javascript/201-change-feed/package.json`** — `"dev"` script runs
via `npx ts-node --esm`; no `tsconfig.json`; all dependencies use
floating major-version ranges (`^4`, `^5`, etc.)
- **`javascript/201-change-feed/readme.md`** — run instructions
- **`javascript/.gitignore`** — official Node.js template from
[github/gitignore](https://github.com/github/gitignore)
## Key snippet
```typescript
const iterator = container.items.getChangeFeedIterator<Product>({
changeFeedStartFrom: ChangeFeedStartFrom.Beginning(),
});
while (iterator.hasMoreResults) {
const { result, statusCode } = await iterator.readNext();
if (statusCode === 304) break; // caught up
for (const item of result) {
console.log(`Changed item:\t${item.id} | ${item.name} | Qty: ${item.quantity}`);
}
}
```
Placed under `javascript/` (the directory the existing
`validate-javascript` CI job scans) with prefix `201` (Feature usage
range).
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
Start implementation
<analysis>
[Chronological Review: The conversation began with the user requesting a
review of a user story and a Teams chat to develop a game plan for a
monorepo. The user then defined a numbering standard for samples,
requested a breakdown of work into manageable pieces, and delegated
tasks to cloud agents for creating validation workflows and code
samples. The user also emphasized the need for succinct project updates
and the importance of linking to pull requests for details. The
conversation progressed to updating comments on Azure DevOps work items,
with the user requesting previews of comments before posting and
adjustments to verbosity. The user also directed updates to agent
specifications and simplifications of tool lists. The most recent
requests involved reviewing a work item and planning the implementation
of a TypeScript change feed sample.]
[Intent Mapping: The user explicitly requested to review a work item and
develop a plan for implementing a TypeScript change feed sample. They
indicated that once the plan is ready, they would delegate the
implementation to a cloud agent, highlighting the need for proper
context.]
[Technical Inventory: The conversation involved various tools and
commands, including:
- Azure DevOps for work item management and comments.
- GitHub for repository management and code samples.
- Semantic search for reviewing changes and agent runs.
- Delegation of tasks to cloud agents for specific implementations and
workflows.]
[Code Archaeology: The user referenced specific files and repositories,
including the Azure DevOps work item and the agent specification file
located at
C:\Users\sidandrews\.copilot\agents\azure-devops-work-item-manager.agent.md.
They also discussed the need for links to code samples in the public
repository.]
[Progress Assessment: The user has made significant progress in defining
project structure, delegating tasks, and refining communication
strategies. They have outlined specific tasks for cloud agents and are
preparing to implement a TypeScript sample.]
[Context Validation: All necessary context for continuing work on the
TypeScript change feed sample is captured, including the user’s goals
for succinctness in updates and the need for proper delegation.]
[Recent Commands Analysis: The last agent commands included:
- 'semantic_search' to review the work item and gather context for the
TypeScript change feed sample.
- The user requested to review the work item at the provided Azure
DevOps link and develop a plan for implementation.
- The agent was actively working on gathering context and preparing to
assist in planning the implementation of the TypeScript sample when the
token budget was exceeded.]
</analysis>
<summary>
1. Conversation Overview:
- Primary Objectives: The user aims to implement a TypeScript change
feed sample based on a specific work item and has been delegating tasks
to cloud agents for various components of the project.
- Session Context: The conversation has evolved from initial project
planning to detailed task delegation and refinement of communication
strategies, focusing on succinctness and clarity in updates.
- User Intent Evolution: The user has shifted from broad project
planning to specific implementation details, emphasizing the need for
proper context and delegation.
2. Technical Foundation:
- Azure DevOps: Used for managing work items and comments.
- GitHub: Referenced for code samples and repository management.
- Semantic Search: Utilized for reviewing changes and agent runs.
3. Codebase Status:
- Agent Specification File:
C:\Users\sidandrews\.copilot\agents\azure-devops-work-item-manager.agent.md
- Purpose: To manage Azure DevOps work items and comments.
- Current State: The user has requested updates to the agent's
specification for handling comments and verbosity.
4. Problem Resolution:
- Issues Encountered: The user expressed concerns about verbosity in
project updates and the need for succinct communication.
- Solutions Implemented: The user has directed updates to agent
specifications and emphasized linking to detailed pull requests for
further information.
5. Progress Tracking:
- Completed Tasks: The user has defined a numbering standard for samples
and delegated tasks to cloud agents.
- Partially Complete Work: The plan for the TypeScript change feed
sample is in development, awaiting further context.
6. Active Work State:
- Current Focus: The user is preparing to develop a plan for
implementing the TypeScript change feed sample based on the Azure DevOps
work item.
- Recent Context: The user has been refining project updates and
delegating tasks to cloud agents while ensuring proper context for
future implementations.
7. Recent Operations:
- Last Agent Commands: 'semantic_search' to gather context for the
TypeScript change feed sample.
- Tool Results Summary: The agent was actively reviewing the work item
and preparing to assist in planning the implementation when the token...
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
Created from [VS
Code](https://code.visualstudio.com/docs/copilot/copilot-coding-agent).
<!-- START COPILOT CODING AGENT TIPS -->
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Signed-off-by: Sidney Andrews <sidandrews@microsoft.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: seesharprun <5067401+seesharprun@users.noreply.github.com>
Co-authored-by: Sidney Andrews <sidandrews@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>1 parent 05b5226 commit 9566f89
5 files changed
Lines changed: 843 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
0 commit comments