Skip to content

Commit 9566f89

Browse files
CopilotseesharprunCopilot
authored
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

File tree

javascript/.gitignore

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# Snowpack dependency directory (https://snowpack.dev/)
45+
web_modules/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Optional stylelint cache
57+
.stylelintcache
58+
59+
# Optional REPL history
60+
.node_repl_history
61+
62+
# Output of 'npm pack'
63+
*.tgz
64+
65+
# Yarn Integrity file
66+
.yarn-integrity
67+
68+
# dotenv environment variable files
69+
.env
70+
.env.*
71+
!.env.example
72+
73+
# parcel-bundler cache (https://parceljs.org/)
74+
.cache
75+
.parcel-cache
76+
77+
# Next.js build output
78+
.next
79+
out
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
.output
85+
86+
# Gatsby files
87+
.cache/
88+
# Comment in the public line in if your project uses Gatsby and not Next.js
89+
# https://nextjs.org/blog/next-9-1#public-directory-support
90+
# public
91+
92+
# vuepress build output
93+
.vuepress/dist
94+
95+
# vuepress v2.x temp and cache directory
96+
.temp
97+
.cache
98+
99+
# Sveltekit cache directory
100+
.svelte-kit/
101+
102+
# vitepress build output
103+
**/.vitepress/dist
104+
105+
# vitepress cache directory
106+
**/.vitepress/cache
107+
108+
# Docusaurus cache and generated files
109+
.docusaurus
110+
111+
# Serverless directories
112+
.serverless/
113+
114+
# FuseBox cache
115+
.fusebox/
116+
117+
# DynamoDB Local files
118+
.dynamodb/
119+
120+
# Firebase cache directory
121+
.firebase/
122+
123+
# TernJS port file
124+
.tern-port
125+
126+
# Stores VSCode versions used for testing VSCode extensions
127+
.vscode-test
128+
129+
# pnpm
130+
.pnpm-store
131+
132+
# yarn v3
133+
.pnp.*
134+
.yarn/*
135+
!.yarn/patches
136+
!.yarn/plugins
137+
!.yarn/releases
138+
!.yarn/sdks
139+
!.yarn/versions
140+
141+
# Vite files
142+
vite.config.js.timestamp-*
143+
vite.config.ts.timestamp-*
144+
.vite/

0 commit comments

Comments
 (0)